wiki: include search form on search results page.

Include the search form on the search results page so you can more
easily refine your search.
This commit is contained in:
evazion
2020-12-17 20:35:38 -06:00
parent 25069865b7
commit 2c92794eba
3 changed files with 12 additions and 11 deletions

View File

@@ -0,0 +1,9 @@
<%= search_form_for(wiki_pages_path) do |f| %>
<%= f.input :title_normalize, label: "Title", hint: "Use * for wildcard", input_html: { value: params[:search][:title_normalize], "data-autocomplete": "wiki-page" } %>
<%= f.input :other_names_match, label: "Other names", hint: "Use * for wildcard", input_html: { value: params[:search][:other_names_match] } %>
<%= f.input :body_matches, label: "Body", hint: "Use * for wildcard", input_html: { value: params[:search][:body_matches] } %>
<%= f.input :linked_to, hint: "Find wikis linking to this wiki", input_html: { value: params[:search][:linked_to], "data-autocomplete": "wiki-page" } %>
<%= f.input :is_deleted, label: "Deleted?", as: :select, include_blank: true, selected: params[:search][:is_deleted] %>
<%= f.input :order, collection: [%w[Newest created_at], %w[Title title], %w[Posts post_count]], include_blank: true, selected: params[:search][:order] %>
<%= f.submit "Search" %>
<% end %>

View File

@@ -3,6 +3,8 @@
<% content_for(:content) do %>
<h1>Wiki</h1>
<%= render "search" %>
<%= table_for @wiki_pages, width: "100%" do |t| %>
<% t.column "Title" do |wiki_page| %>
<span class="<%= tag_class(wiki_page.tag) %>"><%= link_to_wiki wiki_page.title %></span>

View File

@@ -1,16 +1,6 @@
<div id="c-wiki-pages">
<div id="a-search">
<%= search_form_for(wiki_pages_path) do |f| %>
<%= f.input :title_normalize, label: "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 :body_matches, label: "Body" %>
<%= f.input :linked_to, hint: "Which wikis link to the specified wiki.", input_html: { "data-autocomplete": "wiki-page" } %>
<%= f.input :not_linked_to, hint: "Which wikis do not link to the specified wiki.", input_html: { "data-autocomplete": "wiki-page" } %>
<%= 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 %>
<%= render "search" %>
</div>
</div>