aliases/implications: split name search field into 'from' and 'to'.

Split the name field on the alias and implication search forms so that
you can search just for antecedents or consequents without having to
search both.
This commit is contained in:
evazion
2020-02-27 19:49:50 -06:00
parent a97f435342
commit d2fb9d9f85
2 changed files with 5 additions and 4 deletions

View File

@@ -9,9 +9,9 @@
<%= link_to "»", tag_aliases_path(search: { consequent_name_ilike: tag_alias.consequent_name }) %>
<span class="count"><%= tag_alias.consequent_tag&.post_count.to_i %></span>
<% end %>
<% t.column "Reference", width: "10%" do |tag_alias| %>
<% t.column "Topic", width: "10%" do |tag_alias| %>
<% if tag_alias.forum_topic_id %>
<%= link_to tag_alias.forum_topic_id, forum_topic_path(tag_alias.forum_topic_id) %>
<%= link_to "topic ##{tag_alias.forum_topic_id}", forum_topic_path(tag_alias.forum_topic_id) %>
<% end %>
<% end %>
<% t.column "Approver", width: "15%" do |tag_alias| %>

View File

@@ -1,14 +1,15 @@
<%# url %>
<%= search_form_for(url) do |f| %>
<%= f.input :name_matches, label: "Name", input_html: { value: params[:search][:name_matches], data: { autocomplete: "tag" } } %>
<%= f.input :status, label: "Status", collection: %w[Approved Active Pending Deleted Retired Processing Queued], include_blank: true, selected: params[:search][:status] %>
<%= f.input :antecedent_name_ilike, label: "From", input_html: { value: params[:search][:antecedent_name_ilike], data: { autocomplete: "tag" } } %>
<%= f.input :consequent_name_ilike, label: "To", input_html: { value: params[:search][:consequent_name_ilike], data: { autocomplete: "tag" } } %>
<%= f.simple_fields_for :antecedent_tag do |fa| %>
<%= fa.input :category, label: "From Category", collection: TagCategory.canonical_mapping.to_a, include_blank: true, selected: params.dig(:search, :antecedent_tag, :category) %>
<% end %>
<%= f.simple_fields_for :consequent_tag do |fa| %>
<%= fa.input :category, label: "To Category", collection: TagCategory.canonical_mapping.to_a, include_blank: true, selected: params.dig(:search, :consequent_tag, :category) %>
<% end %>
<%= f.input :status, label: "Status", collection: %w[Approved Active Pending Deleted Retired Processing Queued], include_blank: true, selected: params[:search][:status] %>
<%= f.input :order, label: "Order", collection: [%w[Status status], %w[Recently\ created created_at], %w[Recently\ updated updated_at], %w[Name name], %w[Tag\ count tag_count]], selected: params[:search][:order] %>
<%= f.submit "Search" %>
<% end %>