diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-01-10 10:09:34 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-01-10 10:09:34 +0000 |
commit | 0ed895388b89c1092f88da7c501587b70c4e899e (patch) | |
tree | 7e9537ecc7af04355e6e7dc256a892edef75352d /app | |
parent | 6e94d2f2af616dd3180c1b4eebe35b467198bb2d (diff) | |
download | redmine-0ed895388b89c1092f88da7c501587b70c4e899e.tar.gz redmine-0ed895388b89c1092f88da7c501587b70c4e899e.zip |
Option to search open issues only (#10734).
git-svn-id: http://svn.redmine.org/redmine/trunk@13858 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/search_controller.rb | 3 | ||||
-rw-r--r-- | app/models/issue.rb | 3 | ||||
-rw-r--r-- | app/views/search/index.html.erb | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index e140878a9..9bdfb0f5d 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -24,6 +24,7 @@ class SearchController < ApplicationController @all_words = params[:all_words] ? params[:all_words].present? : true @titles_only = params[:titles_only] ? params[:titles_only].present? : false @search_attachments = params[:attachments].presence || '0' + @open_issues = params[:open_issues] ? params[:open_issues].present? : false # quick jump to an issue if (m = @question.match(/^#?(\d+)$/)) && (issue = Issue.visible.find_by_id(m[1].to_i)) @@ -56,7 +57,7 @@ class SearchController < ApplicationController fetcher = Redmine::Search::Fetcher.new( @question, User.current, @scope, projects_to_search, - :all_words => @all_words, :titles_only => @titles_only, :attachments => @search_attachments, + :all_words => @all_words, :titles_only => @titles_only, :attachments => @search_attachments, :open_issues => @open_issues, :cache => params[:page].present? ) diff --git a/app/models/issue.rb b/app/models/issue.rb index e7a444d7d..0f6312f2c 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -47,7 +47,8 @@ class Issue < ActiveRecord::Base acts_as_customizable acts_as_watchable acts_as_searchable :columns => ['subject', "#{table_name}.description"], - :preload => [:project, :status, :tracker] + :preload => [:project, :status, :tracker], + :scope => lambda {|options| options[:open_issues] ? self.open : self.all} acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"}, :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}}, diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb index aaf08d369..935abf5a2 100644 --- a/app/views/search/index.html.erb +++ b/app/views/search/index.html.erb @@ -20,6 +20,7 @@ <fieldset class="collapsible collapsed"> <legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend> <div id="options-content" style="display:none;"> + <p><label><%= check_box_tag 'open_issues', 1, @open_issues %> <%= l(:label_search_open_issues_only) %></label></p> <p> <label><%= radio_button_tag 'attachments', '0', @search_attachments == '0' %> <%= l(:label_search_attachments_no) %></label> <label><%= radio_button_tag 'attachments', '1', @search_attachments == '1' %> <%= l(:label_search_attachments_yes) %></label> |