From f5e22ea23531412372a4e2c6f4bb1b7b46c2a54e Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 3 Mar 2017 19:06:09 -0600 Subject: [PATCH] /post_{flags,appeals}: convert search forms to simple form. --- app/views/post_appeals/_search.html.erb | 52 +++---------------- app/views/post_flags/_search.html.erb | 66 ++++--------------------- 2 files changed, 17 insertions(+), 101 deletions(-) diff --git a/app/views/post_appeals/_search.html.erb b/app/views/post_appeals/_search.html.erb index 11bf48eec..3f59219fb 100644 --- a/app/views/post_appeals/_search.html.erb +++ b/app/views/post_appeals/_search.html.erb @@ -1,45 +1,7 @@ - - - <%= form_tag(post_appeals_path, :method => :get, :class => "simple_form") do %> - - - - - - - - - - - - - - - - - - - - - - - <% end %> - - +<%= simple_form_for(:search, url: post_appeals_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %> + <%= f.input :reason_matches, label: "Reason", input_html: { value: params[:search][:reason_matches] } %> + <%= f.input :post_id, label: "Post ID", input_html: { value: params[:search][:post_id] } %> + <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name] } %> + <%= f.input :is_resolved, label: "Resolved?", collection: [["Yes", true], ["No", false]], selected: params[:search][:is_resolved] %> + <%= f.submit "Search" %> +<% end %> diff --git a/app/views/post_flags/_search.html.erb b/app/views/post_flags/_search.html.erb index f94594d05..18f6bd435 100644 --- a/app/views/post_flags/_search.html.erb +++ b/app/views/post_flags/_search.html.erb @@ -1,56 +1,10 @@ - - - <%= form_tag(post_flags_path, :method => :get, :class => "simple_form") do %> - - - - - - - - - - - <% if CurrentUser.user.is_moderator? %> - - - - - <% end %> - - - - - - - - - - - - - - <% end %> - - +<%= simple_form_for(:search, url: post_flags_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %> + <%= f.input :reason_matches, label: "Reason", input_html: { value: params[:search][:reason_matches] } %> + <%= f.input :post_id, label: "Post ID", input_html: { value: params[:search][:post_id] } %> + <% if CurrentUser.is_moderator? %> + <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name] } %> + <% end %> + <%= f.input :is_resolved, label: "Resolved?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:is_resolved] %> + <%= f.input :category, label: "Category", collection: ["normal", "unapproved", "rejected", "deleted", "banned"], include_blank: true, selected: params[:search][:category] %> + <%= f.submit "Search" %> +<% end %>