diff --git a/app/controllers/moderator/post/queues_controller.rb b/app/controllers/moderator/post/queues_controller.rb
index c1d7d4254..bf6c57053 100644
--- a/app/controllers/moderator/post/queues_controller.rb
+++ b/app/controllers/moderator/post/queues_controller.rb
@@ -10,12 +10,12 @@ module Moderator
def show
cookies.permanent[:moderated] = Time.now.to_i
- if params[:per_page]
- cookies.permanent["mq_per_page"] = params[:per_page]
+ if search_params[:per_page]
+ cookies.permanent["mq_per_page"] = search_params[:per_page]
end
::Post.without_timeout do
- @posts = ::Post.includes(:disapprovals, :uploader).order("posts.id asc").pending_or_flagged.available_for_moderation(params[:hidden]).tag_match(params[:query]).paginate(params[:page], :limit => per_page)
+ @posts = ::Post.includes(:disapprovals, :uploader).order("posts.id asc").pending_or_flagged.available_for_moderation(search_params[:hidden]).tag_match(search_params[:tags]).paginate(params[:page], :limit => per_page)
@posts.each # hack to force rails to eager load
end
respond_with(@posts)
@@ -45,7 +45,7 @@ module Moderator
end
def per_page
- cookies["mq_per_page"] || params[:per_page] || 25
+ cookies["mq_per_page"] || search_params[:per_page] || 25
end
end
end
diff --git a/app/logical/moderator/ip_addr_search.rb b/app/logical/moderator/ip_addr_search.rb
index 4f3e8cdd5..c80a441a4 100644
--- a/app/logical/moderator/ip_addr_search.rb
+++ b/app/logical/moderator/ip_addr_search.rb
@@ -8,11 +8,11 @@ module Moderator
def execute
if params[:user_id].present?
- search_by_user_id(params[:user_id].split(/,/).map(&:strip))
+ search_by_user_id(params[:user_id].split)
elsif params[:user_name].present?
- search_by_user_name(params[:user_name].split(/,/).map(&:strip))
+ search_by_user_name(params[:user_name].split)
elsif params[:ip_addr].present?
- search_by_ip_addr(params[:ip_addr].split(/,/).map(&:strip))
+ search_by_ip_addr(params[:ip_addr].split)
else
[]
end
diff --git a/app/views/artist_versions/search.html.erb b/app/views/artist_versions/search.html.erb
index a9c1c55b3..3eec6346e 100644
--- a/app/views/artist_versions/search.html.erb
+++ b/app/views/artist_versions/search.html.erb
@@ -2,13 +2,11 @@
Search Changes
-
- <%= form_tag(artist_versions_path, :method => :get, :class => "simple_form") do %>
- <%= search_field "updater_name", :label => "User", :data => { autocomplete: "user" } %>
- <%= search_field "name", :label => "Name", :data => { autocomplete: "artist" } %>
- <%= submit_tag "Search" %>
- <% end %>
-
+ <%= search_form_for(artist_versions_path) do |f| %>
+ <%= f.input :updater_name, label: "Updater", input_html: { value: params.dig(:search, :updater_name), "data-autocomplete": "user" } %>
+ <%= f.input :name, label: "Artist", input_html: { value: params.dig(:search, :name), "data-autocomplete": "artist" } %>
+ <%= f.submit "Search" %>
+ <% end %>
diff --git a/app/views/forum_posts/search.html.erb b/app/views/forum_posts/search.html.erb
index 4caa22276..9a5d9f914 100644
--- a/app/views/forum_posts/search.html.erb
+++ b/app/views/forum_posts/search.html.erb
@@ -1,15 +1,13 @@
Search Forum
- <%= form_tag(forum_posts_path, :method => :get, :class => "simple_form") do %>
- <%= search_field "topic_title_matches", :label => "Title" %>
- <%= search_field "body_matches", :label => "Body" %>
- <%= search_field "creator_name", :label => "Author", :data => { autocomplete: "user" } %>
-
-
- <%= select "search", "topic_category_id", ForumTopic::CATEGORIES.invert.to_a, :include_blank => true %>
-
- <%= submit_tag "Search" %>
+
+ <%= search_form_for(forum_posts_path) do |f| %>
+ <%= f.input :topic_title_matches, label: "Title" %>
+ <%= f.input :body_matches, label: "Body" %>
+ <%= f.input :creator_name, label: "Creator", input_html: { "data-autocomplete": "user" } %>
+ <%= f.input :topic_category_id, label: "Category", collection: ForumTopic::CATEGORIES.invert.to_a, include_blank: true %>
+ <%= f.submit "Search" %>
<% end %>
diff --git a/app/views/meta_searches/tags.html.erb b/app/views/meta_searches/tags.html.erb
index 33704598f..25351df5e 100644
--- a/app/views/meta_searches/tags.html.erb
+++ b/app/views/meta_searches/tags.html.erb
@@ -3,9 +3,9 @@
MetaSearch Tags
- <%= form_tag(meta_searches_tags_path, :method => :get) do %>
- <%= text_field_tag "name", params[:name], :data => { :autocomplete => "tag" } %>
- <%= submit_tag "Go" %>
+ <%= search_form_for(meta_searches_tags_path) do |f| %>
+ <%= f.input :name, input_html: { value: params.dig(:search, :name), "data-autocomplete": "tag" } %>
+ <%= f.submit "Search" %>
<% end %>
diff --git a/app/views/moderator/dashboards/_search_ip_addr.html.erb b/app/views/moderator/dashboards/_search_ip_addr.html.erb
index 826e3b046..f11163713 100644
--- a/app/views/moderator/dashboards/_search_ip_addr.html.erb
+++ b/app/views/moderator/dashboards/_search_ip_addr.html.erb
@@ -1,19 +1,5 @@
-<%= form_tag(moderator_ip_addrs_path, :method => :get, :class => "simple_form") do %>
-
-
- <%= text_field_tag "search[ip_addr]", params[:ip_addrs] %>
- Separate with commas
-
-
- <%= submit_tag "Search" %>
-<% end %>
-
-<%= form_tag(moderator_ip_addrs_path, :method => :get, :class => "simple_form") do %>
-
-
- <%= text_field_tag "search[user_name]", params[:user_names], data: { autocomplete: "user" } %>
- Separate with commas
-
-
- <%= submit_tag "Search" %>
+<%= search_form_for(moderator_ip_addrs_path) do |f| %>
+ <%= f.input :ip_addr, label: "IPs ", hint: "Separate with spaces", input_html: { value: params.dig(:search, :ip_addr) } %>
+ <%= f.input :user_name, label: "Users", hint: "Separate with spaces", input_html: { value: params.dig(:search, :user_name), "data-autocomplete": "user" } %>
+ <%= f.submit "Search" %>
<% end %>
diff --git a/app/views/moderator/ip_addrs/search.html.erb b/app/views/moderator/ip_addrs/search.html.erb
index 51b21a81a..ebee88249 100644
--- a/app/views/moderator/ip_addrs/search.html.erb
+++ b/app/views/moderator/ip_addrs/search.html.erb
@@ -2,10 +2,10 @@
Search IP Addresses
- <%= form_tag(moderator_ip_addrs_path, :method => :get, :class => "simple_form") do %>
- <%= search_field "user_name", :label => "User" %>
- <%= search_field "ip_addr", :label => "IP Addr" %>
- <%= submit_tag "Search" %>
+ <%= search_form_for(moderator_ip_addrs_path) do |f| %>
+ <%= f.input :ip_addr, label: "IPs ", hint: "Separate with spaces", input_html: { value: params.dig(:search, :ip_addr) } %>
+ <%= f.input :user_name, label: "Users", hint: "Separate with spaces", input_html: { value: params.dig(:search, :user_name), "data-autocomplete": "user" } %>
+ <%= f.submit "Search" %>
<% end %>
diff --git a/app/views/moderator/post/queues/show.html.erb b/app/views/moderator/post/queues/show.html.erb
index c8116bfe9..e2bd5ded8 100644
--- a/app/views/moderator/post/queues/show.html.erb
+++ b/app/views/moderator/post/queues/show.html.erb
@@ -3,13 +3,11 @@
Moderation Queue
-
- <%= form_tag(moderator_post_queue_path, :method => :get) do %>
- <%= text_field_tag "query", params[:query], :size => 40, :data => { :autocomplete => "tag-query" } %>
- <%= select_tag "per_page", options_for_select(%w(25 50 100 200), cookies["mq_per_page"])%>
- <%= submit_tag "Search" %>
- <% end %>
-
+ <%= search_form_for(moderator_post_queue_path) do |f| %>
+ <%= f.input :tags, input_html: { value: params.dig(:search, :tags), "data-autocomplete": "tag-query" } %>
+ <%= f.input :per_page, label: "Posts", collection: %w[25 50 100 200], selected: cookies[:mq_per_page] %>
+ <%= f.submit "Search" %>
+ <% end %>
Deletion Guidelines
@@ -17,10 +15,10 @@
<%= render "desc" %>
- <% if params[:hidden] %>
- <%= link_to "View pending posts", moderator_post_queue_path(:query => params[:query], :hidden => nil) %>.
+ <% if params.dig(:search, :hidden) %>
+ <%= link_to "View pending posts", moderator_post_queue_path(search: { tags: params.dig(:search, :tags), hidden: nil }) %>.
<% else %>
- <%= link_to "View hidden posts", moderator_post_queue_path(:query => params[:query], :hidden => true) %>.
+ <%= link_to "View hidden posts", moderator_post_queue_path(search: { tags: params.dig(:search, :tags), hidden: true, }) %>.
<% end %>
diff --git a/app/views/pools/_search.html.erb b/app/views/pools/_search.html.erb
index 15f817d3f..4e8889f3e 100644
--- a/app/views/pools/_search.html.erb
+++ b/app/views/pools/_search.html.erb
@@ -1,72 +1,10 @@
-
-
- <%= form_tag path, :method => :get, :class => "simple_form" do %>
-
- |
-
-
- <%= text_field "search", "name_matches", :value => params[:search][:name_matches], :data => { autocomplete: "pool" } %>
-
- |
-
-
-
- |
-
-
- <%= text_field "search", "description_matches", :value => params[:search][:description_matches] %>
-
- |
-
-
-
- |
-
-
- <%= text_field "search", "post_tags_match", :value => params[:search][:post_tags_match], :data => { autocomplete: "tag-query" } %>
-
- |
-
-
-
- |
-
-
- <%= text_field "search", "creator_name", :value => params[:search][:creator_name], :data => { autocomplete: "pool" } %>
-
- |
-
-
-
- |
-
-
- <%= select "search", "is_active", ["", ["Active", "true"], ["Inactive", "false"]], :selected => params[:search][:is_active] %>
-
- |
-
-
-
- |
-
-
- <%= select "search", "category", [["Series", "series"], ["Collection", "collection"]], :selected => params[:search][:category], :include_blank => true %>
-
- |
-
-
-
- |
-
-
- <%= select "search", "order", [["Last updated", "updated_at"], ["Name", "name"], ["Recently created", "created_at"], ["Post count", "post_count"]], :selected => params[:search][:order], :include_blank => true %>
-
- |
-
-
-
- | <%= submit_tag "Search" %> |
-
- <% end %>
-
-
+<%= search_form_for(path) do |f| %>
+ <%= f.input :name_matches, label: "Name", input_html: { value: params.dig(:search, :name_matches), "data-autocomplete": "pool" } %>
+ <%= f.input :description_matches, label: "Description", input_html: { value: params.dig(:search, :description_matches) } %>
+ <%= f.input :post_tags_match, label: "Post tags", input_html: { value: params.dig(:search, :post_tags_match), "data-autocomplete": "tag-query" } %>
+ <%= f.input :creator_name, label: "Creator", input_html: { value: params.dig(:search, :creator_name), "data-autocomplete": "user" } %>
+ <%= f.input :is_active, label: "Status", as: :select, collection: [%w[Active true], %w[Inactive false]], include_blank: true, selected: params.dig(:search, :is_active) %>
+ <%= f.input :category, collection: %w[series collection], include_blank: true, selected: params[:search][:category] %>
+ <%= f.input :order, collection: [%w[Last\ updated updated_at], %w[Name name], %w[Recently\ created created_at], %w[Post\ count post_count]], include_blank: true, selected: params.dig(:search, :order) %>
+ <%= f.submit "Search" %>
+<% end %>
diff --git a/app/views/post_versions/search.html.erb b/app/views/post_versions/search.html.erb
index 28942d50e..1e058581b 100644
--- a/app/views/post_versions/search.html.erb
+++ b/app/views/post_versions/search.html.erb
@@ -2,13 +2,11 @@
Search Changes
-
- <%= form_tag(post_versions_path, :method => :get, :class => "simple_form") do %>
- <%= search_field "updater_name", :label => "User", :data => { autocomplete: "user" } %>
- <%= search_field "post_id", :label => "Post" %>
- <%= submit_tag "Search" %>
- <% end %>
-
+ <%= search_form_for(post_versions_path) do |f| %>
+ <%= f.input :updater_name, label: "Updater", input_html: { "data-autocomplete": "user" } %>
+ <%= f.input :post_id %>
+ <%= f.submit "Search" %>
+ <% end %>
diff --git a/app/views/user_feedbacks/search.html.erb b/app/views/user_feedbacks/search.html.erb
index 44ecb31b2..4624b08ff 100644
--- a/app/views/user_feedbacks/search.html.erb
+++ b/app/views/user_feedbacks/search.html.erb
@@ -2,19 +2,12 @@
Search User Feedbacks
- <%= form_tag(user_feedbacks_path, :method => :get, :class => "simple_form") do %>
- <%= search_field "user_name", :label => "User", :data => { autocomplete: "user" } %>
- <%= search_field "creator_name", :label => "Creator", :data => { autocomplete: "user" } %>
- <%= search_field "body_matches", :label => "Message" %>
-
-
-
- <%= select "search", "category", %w(positive negative neutral), :include_blank => true %>
-
-
-
- <%= submit_tag "Search" %>
-
+ <%= search_form_for(user_feedbacks_path) do |f| %>
+ <%= f.input :user_name, input_html: { value: params.dig(:search, :user_name), "data-autocomplete": "user" } %>
+ <%= f.input :creator_name, input_html: { value: params.dig(:search, :creator_name), "data-autocomplete": "user" } %>
+ <%= f.input :body_matches, label: "Message", input_html: { value: params.dig(:search, :body_matches) } %>
+ <%= f.input :category, collection: %w[positive negative neutral], include_blank: true, selected: params.dig(:search, :category) %>
+ <%= f.submit "Search" %>
<% end %>
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
index 097e39d50..757a8af71 100644
--- a/app/views/users/index.html.erb
+++ b/app/views/users/index.html.erb
@@ -2,11 +2,6 @@
Users
- <% form_tag(users_path, :method => :get, :class => "simple_form") do %>
- <%= search_field "name_matches", :label => "Name" %>
- <%= submit_tag "Search" %>
- <% end %>
-
diff --git a/app/views/wiki_pages/search.html.erb b/app/views/wiki_pages/search.html.erb
index 2d0fe2e45..09a511be4 100644
--- a/app/views/wiki_pages/search.html.erb
+++ b/app/views/wiki_pages/search.html.erb
@@ -1,27 +1,14 @@
- <%= form_tag(wiki_pages_path, :method => :get, :class => "simple_form") do %>
- <%= search_field "title", :hint => "Use * for wildcard searches", :data => { :autocomplete => "wiki-page" } %>
- <%= search_field "creator_name", :data => { :autocomplete => "user" } %>
- <%= search_field "body_matches", :label => "Body" %>
- <%= search_field "other_names_match", :label => "Other names", :hint => "Use * for wildcard searches" %>
-
-
-
- <%= select "search", "other_names_present", ["yes", "no"], :include_blank => true %>
-
-
-
-
- <%= select "search", "order", [%w[Name title], %w[Date time], %w[Posts post_count]] %>
-
-
-
-
- <%= select "search", "hide_deleted", ["Yes", "No"] %>
-
-
- <%= submit_tag "Search" %>
+ <%= search_form_for(wiki_pages_path) do |f| %>
+ <%= f.input :title, hint: "Use * for wildcard searches", input_html: { "data-autocomplete": "wiki-page" } %>
+ <%= f.input :other_names_match, label: "Other names", hint: "Use * for wildcard searches" %>
+ <%= f.input :creator_name, input_html: { "data-autocomplete": "user" } %>
+ <%= f.input :body_matches, label: "Body" %>
+ <%= f.input :other_names_present, as: :select %>
+ <%= f.input :hide_deleted, as: :select, include_blank: false %>
+ <%= f.input :order, collection: [%w[Name title], %w[Date time], %w[Posts post_count]], include_blank: false %>
+ <%= f.submit "Search" %>
<% end %>