1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<% title "Thread Search" %>
<h1>Thread Search</h1>
<h3>Leave a field blank to ignore that search aspect.</h3>
<% label = Label.where(name: params[:label]).first %>
<table>
<tbody>
<%= form_tag(forumthreads_path, method: :get) do %>
<%
forums = []
Forum.select{|f| f.can_read?(current_user)}.sort_by{ |f| f.forumgroup && f.forumgroup.position || 0 }.each do |f|
forums << ["#{f.forumgroup.name} → #{f.name}", f.id] if f.forumgroup
end
%>
<% label_list = Label.pluck(:name).prepend("No Label") %>
<tr>
<td>Forum</td>
<td><%= select_tag "forum", options_for_select(forums, params[:forum]), include_blank: "Search All Threads" %></td>
</tr>
<tr>
<td>Label</td>
<td>
<%= select_tag "label", options_for_select(label_list, params[:label]), include_blank: "Label" %>
</td>
</tr>
<tr>
<td>Title</td>
<td>
<%= text_field_tag "title", params[:title], placeholder: "Search Titles" %>
</td>
</tr>
<tr>
<td>Content</td>
<td>
<%= text_field_tag "content", params[:content], placeholder: "Search Contents" %>
</td>
<tr>
<td>Author</td>
<td>
<%= render partial: "md_editor_user", locals: {name: "author", content: params[:author]} %>
</td>
</tr>
<td>Replies</td>
<td>
<%= text_field_tag "reply", params[:reply], placeholder: "Search Replies" %>
</td>
</tr>
<tr>
<td>
<%= submit_tag "Go", class: "btn blue", style: "width:50px", name: nil %>
</td>
</tr>
<% end %>
</tbody>
</table>
|