<% title "Thread Search" %>

Thread Search

Leave a field blank to ignore that search aspect.

<% label = Label.where(name: params[:label]).first %> <%= form_tag({controller: "forumthreads", action: "index"}, method: :get, enforce_utf8: false) 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") %> <% end %>
Forum <%= select_tag "id", options_for_select(forums, params[:id]), include_blank: "Search All Threads" %>
Label <%= select_tag "label", options_for_select(label_list, params[:label]), include_blank: "Label" %>
Title <%= text_field_tag "title", params[:title], placeholder: "Search Titles" %>
Content <%= text_field_tag "content", params[:content], placeholder: "Search Contents" %>
Author <%= render partial: "md_editor_user", locals: {name: "author", content: params[:author]} %>
Replies <%= text_field_tag "reply", params[:reply], placeholder: "Search Replies" %>
<%= submit_tag "Go", class: "btn blue", style: "width:50px", name: nil %>