views: migrate search forms to use simple form.

Migrate various forms to be built using simple form instead of raw html.
Also adds autocomplete="off" to these forms (#4162).
This commit is contained in:
evazion
2019-09-10 14:29:07 -05:00
parent 1743f3797f
commit a1b48f5e3f
13 changed files with 68 additions and 177 deletions

View File

@@ -1,19 +1,5 @@
<%= form_tag(moderator_ip_addrs_path, :method => :get, :class => "simple_form") do %>
<div class="input">
<label for="user_ids">Search IPs</label>
<%= text_field_tag "search[ip_addr]", params[:ip_addrs] %>
<span class="hint">Separate with commas</span>
</div>
<%= submit_tag "Search" %>
<% end %>
<%= form_tag(moderator_ip_addrs_path, :method => :get, :class => "simple_form") do %>
<div class="input">
<label for="user_names">Search User Names</label>
<%= text_field_tag "search[user_name]", params[:user_names], data: { autocomplete: "user" } %>
<span class="hint">Separate with commas</span>
</div>
<%= 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 %>

View File

@@ -2,10 +2,10 @@
<div id="a-search">
<h1>Search IP Addresses</h1>
<%= 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 %>
</div>
</div>

View File

@@ -3,13 +3,11 @@
<div>
<h1>Moderation Queue</h1>
<div id="search">
<%= 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 %>
</div>
<%= 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 %>
<div id="moderation-guideline">
<h1>Deletion Guidelines</h1>
@@ -17,10 +15,10 @@
<%= render "desc" %>
<p>
<% 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 %>
</p>
</div>