diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index be70dc328..f6f69f0f9 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -5,6 +5,8 @@ class CommentsController < ApplicationController
skip_before_action :api_check
def index
+ params[:group_by] ||= "comment" if params[:search]
+
if params[:group_by] == "comment" || request.format == Mime::Type.lookup("application/atom+xml")
index_by_comment
elsif request.format == Mime::Type.lookup("text/javascript")
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index c30aeddfd..53b506749 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -158,6 +158,14 @@ 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)
+ tag.li do
+ search_form_for(url, classes: "quick-search-form one-line-form") do |f|
+ f.input attribute, label: false, placeholder: "Search #{name}", input_html: { id: nil, "data-autocomplete": autocomplete }
+ end
+ end
+ end
+
def search_form_for(url, classes: "inline-form", &block)
defaults = { required: false }
html_options = { autocomplete: "off", class: "search-form #{classes}" }
diff --git a/app/javascript/src/styles/common/simple_form.scss b/app/javascript/src/styles/common/simple_form.scss
index ea24e0e36..4dc05d850 100644
--- a/app/javascript/src/styles/common/simple_form.scss
+++ b/app/javascript/src/styles/common/simple_form.scss
@@ -78,6 +78,10 @@ form.inline-form {
}
}
+form.quick-search-form {
+ margin: 0;
+}
+
form.one-line-form {
> input, > div.input {
display: inline;
diff --git a/app/views/artist_commentaries/_quick_search.html.erb b/app/views/artist_commentaries/_quick_search.html.erb
deleted file mode 100644
index 5c24eb488..000000000
--- a/app/views/artist_commentaries/_quick_search.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<%= form_tag(artist_commentaries_path, :method => :get) do %>
- <%= text_field "search", "text_matches", :id => "quick_search_text_matches", :placeholder => "Search commentary" %>
-<% end %>
diff --git a/app/views/artist_commentaries/_secondary_links.html.erb b/app/views/artist_commentaries/_secondary_links.html.erb
index c1fd0226e..45b8a9ebf 100644
--- a/app/views/artist_commentaries/_secondary_links.html.erb
+++ b/app/views/artist_commentaries/_secondary_links.html.erb
@@ -1,6 +1,6 @@
<% content_for(:secondary_links) do %>