From bd4fba08e5bec539a746e9be422b9c2baab51406 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 5 Aug 2013 17:19:49 +0000 Subject: [PATCH] One click filter in search view (#2865). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12080 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/search/index.html.erb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb index d4d671aa9..2e2d91fb1 100644 --- a/app/views/search/index.html.erb +++ b/app/views/search/index.html.erb @@ -1,7 +1,7 @@

<%= l(:label_search) %>

-<%= form_tag({}, :method => :get) do %> +<%= form_tag({}, :method => :get, :id => 'search-form') do %> <%= label_tag "search-input", l(:description_search), :class => "hidden-for-sighted" %>

<%= text_field_tag 'q', @question, :size => 60, :id => 'search-input' %> <%= javascript_tag "$('#search-input').focus()" %> @@ -11,13 +11,14 @@ <%= hidden_field_tag 'titles_only', '', :id => nil %>

-

+ +

<% @object_types.each do |t| %> - + <% end %>

-

<%= submit_tag l(:button_submit), :name => 'submit' %>

+

<%= submit_tag l(:button_submit) %>

<% end %>
@@ -50,3 +51,14 @@

<% html_title(l(:label_search)) -%> + +<%= javascript_tag do %> +$("#search-types a").click(function(e){ + e.preventDefault(); + $("#search-types input[type=checkbox]").attr('checked', false); + $(this).siblings("input[type=checkbox]").attr('checked', true); + if ($("#search-input").val() != "") { + $("#search-form").submit(); + } +}); +<% end %>