From 217f5e6c81e1d68c634edbd9c4e8f6f8d2857b7c Mon Sep 17 00:00:00 2001 From: BrokenEagle Date: Sat, 25 Jan 2020 20:32:33 +0000 Subject: [PATCH] Added redirect parameter to quick search function - Also fixed quick search parameter on wiki pages --- app/helpers/application_helper.rb | 4 ++-- app/views/artists/_secondary_links.html.erb | 2 +- app/views/pools/_secondary_links.html.erb | 2 +- app/views/users/_secondary_links.html.erb | 2 +- app/views/wiki_pages/_secondary_links.html.erb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d31a7cf71..9338030d9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -179,11 +179,11 @@ module ApplicationHelper tag.input value: "Preview", type: "button", class: "dtext-preview-button", "data-input-id": input_id, "data-preview-id": preview_id end - def quick_search_form_for(attribute, url, name, autocomplete: nil, &block) + def quick_search_form_for(attribute, url, name, autocomplete: nil, redirect: false, &block) tag.li do search_form_for(url, classes: "quick-search-form one-line-form") do |f| out = f.input attribute, label: false, placeholder: "Search #{name}", input_html: { id: nil, "data-autocomplete": autocomplete } - out += tag.input type: :hidden, name: :redirect, value: 1 + out += tag.input type: :hidden, name: :redirect, value: redirect out += capture { yield f } if block_given? out end diff --git a/app/views/artists/_secondary_links.html.erb b/app/views/artists/_secondary_links.html.erb index 37aaf4726..f67a0d8ea 100644 --- a/app/views/artists/_secondary_links.html.erb +++ b/app/views/artists/_secondary_links.html.erb @@ -1,5 +1,5 @@ <% content_for(:secondary_links) do %> - <%= quick_search_form_for(:any_name_or_url_matches, artists_path, "artists", autocomplete: "artist") %> + <%= quick_search_form_for(:any_name_or_url_matches, artists_path, "artists", autocomplete: "artist", redirect: true) %> <%= subnav_link_to "Listing", artists_path %> <%= subnav_link_to "Banned", artists_path(search: { is_banned: "true", order: "updated_at" }) %> <% if CurrentUser.is_member? %> diff --git a/app/views/pools/_secondary_links.html.erb b/app/views/pools/_secondary_links.html.erb index 1ae571893..505ff6af0 100644 --- a/app/views/pools/_secondary_links.html.erb +++ b/app/views/pools/_secondary_links.html.erb @@ -1,5 +1,5 @@ <% content_for(:secondary_links) do %> - <%= quick_search_form_for(:name_matches, pools_path, "pools", autocomplete: "pool") %> + <%= quick_search_form_for(:name_matches, pools_path, "pools", autocomplete: "pool", redirect: true) %> <%= subnav_link_to "Gallery", gallery_pools_path %> <%= subnav_link_to "Listing", pools_path %> <%= subnav_link_to "New", new_pool_path %> diff --git a/app/views/users/_secondary_links.html.erb b/app/views/users/_secondary_links.html.erb index 26571d8fb..b1eb70d31 100644 --- a/app/views/users/_secondary_links.html.erb +++ b/app/views/users/_secondary_links.html.erb @@ -1,5 +1,5 @@ <% content_for(:secondary_links) do %> - <%= quick_search_form_for(:name_matches, users_path, "users", autocomplete: "user") %> + <%= quick_search_form_for(:name_matches, users_path, "users", autocomplete: "user", redirect: true) %> <%= subnav_link_to "Listing", users_path %> <%= subnav_link_to "Search", search_users_path %> diff --git a/app/views/wiki_pages/_secondary_links.html.erb b/app/views/wiki_pages/_secondary_links.html.erb index 070f1e085..35f0d03dc 100644 --- a/app/views/wiki_pages/_secondary_links.html.erb +++ b/app/views/wiki_pages/_secondary_links.html.erb @@ -1,5 +1,5 @@ <% content_for(:secondary_links) do %> - <%= quick_search_form_for(:title, wiki_pages_path, "wiki pages", autocomplete: "wiki-page") %> + <%= quick_search_form_for(:title_normalize, wiki_pages_path, "wiki pages", autocomplete: "wiki-page", redirect: true) %> <%= subnav_link_to "Listing", wiki_pages_path %> <%= subnav_link_to "Search", search_wiki_pages_path %> <% if CurrentUser.is_member? %>