From 389c7779e6ed985cfae60cd532daa82565fbe80d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 9 Jul 2011 11:25:01 +0000 Subject: Fixed: search options get lost after clicking on a specific result type (#7501). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6201 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/search_controller.rb | 8 ++++---- app/helpers/search_helper.rb | 6 +++--- app/views/search/index.rhtml | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index f2e146b2f..440497c6e 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,5 +1,5 @@ -# redMine - project management software -# Copyright (C) 2006 Jean-Philippe Lang +# Redmine - project management software +# Copyright (C) 2006-2011 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -24,8 +24,8 @@ class SearchController < ApplicationController def index @question = params[:q] || "" @question.strip! - @all_words = params[:all_words] || (params[:submit] ? false : true) - @titles_only = !params[:titles_only].nil? + @all_words = params[:all_words] ? params[:all_words].present? : true + @titles_only = params[:titles_only] ? params[:titles_only].present? : false projects_to_search = case params[:scope] diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index b8f416c58..da3610e95 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -1,5 +1,5 @@ -# redMine - project management software -# Copyright (C) 2006-2007 Jean-Philippe Lang +# Redmine - project management software +# Copyright (C) 2006-2011 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -57,7 +57,7 @@ module SearchHelper c = results_by_type[t] next if c == 0 text = "#{type_label(t)} (#{c})" - links << link_to(text, :q => params[:q], :titles_only => params[:title_only], :all_words => params[:all_words], :scope => params[:scope], t => 1) + links << link_to(text, :q => params[:q], :titles_only => params[:titles_only], :all_words => params[:all_words], :scope => params[:scope], t => 1) end ('') unless links.empty? end diff --git a/app/views/search/index.rhtml b/app/views/search/index.rhtml index 13ec567d9..0cedc4b14 100644 --- a/app/views/search/index.rhtml +++ b/app/views/search/index.rhtml @@ -5,7 +5,9 @@

<%= text_field_tag 'q', @question, :size => 60, :id => 'search-input' %> <%= javascript_tag "Field.focus('search-input')" %> <%= project_select_tag %> +<%= hidden_field_tag 'all_words', '', :id => nil %> +<%= hidden_field_tag 'titles_only', '', :id => nil %>

-- cgit v1.2.3