/post_{flags,appeals}: convert search forms to simple form.

This commit is contained in:
evazion
2017-03-03 19:06:09 -06:00
parent 652e251040
commit f5e22ea235
2 changed files with 17 additions and 101 deletions

View File

@@ -1,45 +1,7 @@
<table class="search"> <%= simple_form_for(:search, url: post_appeals_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
<tbody> <%= f.input :reason_matches, label: "Reason", input_html: { value: params[:search][:reason_matches] } %>
<%= form_tag(post_appeals_path, :method => :get, :class => "simple_form") do %> <%= f.input :post_id, label: "Post ID", input_html: { value: params[:search][:post_id] } %>
<tr> <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name] } %>
<th><label for="search_reason_matches">Reason</label></th> <%= f.input :is_resolved, label: "Resolved?", collection: [["Yes", true], ["No", false]], selected: params[:search][:is_resolved] %>
<td> <%= f.submit "Search" %>
<div class="input"> <% end %>
<%= text_field "search", "reason_matches", :label => "Reason", :value => params[:search][:reason_matches] %>
</div>
</td>
</tr>
<tr>
<th><label for="search_post_id">Post ID</label></th>
<td>
<div class="input">
<%= text_field "search", "post_id", :value => params[:search][:post_id] %>
</div>
</td>
</tr>
<tr>
<th><label for="search_creator_name">Creator</th>
<td>
<div class="input">
<%= text_field "search", "creator_name", :value => params[:search][:creator_name] %>
</div>
</td>
</tr>
<tr>
<th><label for="search_is_resolved">Resolved</label></th>
<td>
<div class="input">
<%= select "search", "is_resolved", ["true", "false"], :selected => params[:search][:is_resolved], :include_blank => true %>
</div>
</td>
</tr>
<tr>
<td><%= submit_tag "Search" %><td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -1,56 +1,10 @@
<table class="search"> <%= simple_form_for(:search, url: post_flags_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
<tbody> <%= f.input :reason_matches, label: "Reason", input_html: { value: params[:search][:reason_matches] } %>
<%= form_tag(post_flags_path, :method => :get, :class => "simple_form") do %> <%= f.input :post_id, label: "Post ID", input_html: { value: params[:search][:post_id] } %>
<tr> <% if CurrentUser.is_moderator? %>
<th><label for="search_reason_matches">Reason</label></th> <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name] } %>
<td> <% end %>
<div class="input"> <%= f.input :is_resolved, label: "Resolved?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:is_resolved] %>
<%= text_field "search", "reason_matches", :label => "Reason", :value => params[:search][:reason_matches] %> <%= f.input :category, label: "Category", collection: ["normal", "unapproved", "rejected", "deleted", "banned"], include_blank: true, selected: params[:search][:category] %>
</div> <%= f.submit "Search" %>
</td> <% end %>
</tr>
<tr>
<th><label for="search_post_id">Post ID</label></th>
<td>
<div class="input">
<%= text_field "search", "post_id", :value => params[:search][:post_id] %>
</div>
</td>
</tr>
<% if CurrentUser.user.is_moderator? %>
<tr>
<th><label for="search_creator_name">Creator</th>
<td>
<div class="input">
<%= text_field "search", "creator_name", :value => params[:search][:creator_name] %>
</div>
</td>
</tr>
<% end %>
<tr>
<th><label for="search_is_resolved">Resolved</label></th>
<td>
<div class="input">
<%= select "search", "is_resolved", ["true", "false"], :selected => params[:search][:is_resolved], :include_blank => true %>
</div>
</td>
</tr>
<tr>
<th><label for="search_category">Category</label></th>
<td>
<div class="input">
<%= select "search", "category", ["normal", "unapproved", "banned"], :selected => params[:search][:category], :include_blank => true %>
</div>
</td>
</tr>
<tr>
<td><%= submit_tag "Search" %><td>
</tr>
<% end %>
</tbody>
</table>