summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-10-21 17:07:18 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-10-21 17:07:18 +0000
commit07aa3c55bdc72a7ab3565c5903a4560b6785aac5 (patch)
tree76bc2e808f42389512284541f45d4ffa3e16c673 /app
parent739e11702a810b0a84959679a634cf72f75815e6 (diff)
downloadredmine-07aa3c55bdc72a7ab3565c5903a4560b6785aac5.tar.gz
redmine-07aa3c55bdc72a7ab3565c5903a4560b6785aac5.zip
Contextual quick search (#3263).
Eg. when viewing issues, the quick search will search issues only. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2943 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb1
-rw-r--r--app/controllers/boards_controller.rb1
-rw-r--r--app/controllers/documents_controller.rb1
-rw-r--r--app/controllers/issues_controller.rb1
-rw-r--r--app/controllers/messages_controller.rb1
-rw-r--r--app/controllers/news_controller.rb1
-rw-r--r--app/controllers/repositories_controller.rb2
-rw-r--r--app/controllers/wiki_controller.rb1
-rw-r--r--app/views/layouts/base.rhtml1
9 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 59d117e4f..68377b6f7 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -26,6 +26,7 @@ class ApplicationController < ActionController::Base
before_filter :user_setup, :check_if_login_required, :set_localization
filter_parameter_logging :password
+ include Redmine::Search::Controller
include Redmine::MenuManager::MenuController
helper Redmine::MenuManager::MenuHelper
diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb
index eaac14e5b..436398d1c 100644
--- a/app/controllers/boards_controller.rb
+++ b/app/controllers/boards_controller.rb
@@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class BoardsController < ApplicationController
+ default_search_scope :messages
before_filter :find_project, :authorize
helper :messages
diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb
index c2e08768f..c9eecf4f7 100644
--- a/app/controllers/documents_controller.rb
+++ b/app/controllers/documents_controller.rb
@@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class DocumentsController < ApplicationController
+ default_search_scope :documents
before_filter :find_project, :only => [:index, :new]
before_filter :find_document, :except => [:index, :new]
before_filter :authorize
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 74fe25d78..bebba10a4 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -17,6 +17,7 @@
class IssuesController < ApplicationController
menu_item :new_issue, :only => :new
+ default_search_scope :issues
before_filter :find_issue, :only => [:show, :edit, :reply]
before_filter :find_issues, :only => [:bulk_edit, :move, :destroy]
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index f328e9b60..88609738a 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -17,6 +17,7 @@
class MessagesController < ApplicationController
menu_item :boards
+ default_search_scope :messages
before_filter :find_board, :only => [:new, :preview]
before_filter :find_message, :except => [:new, :preview]
before_filter :authorize, :except => [:preview, :edit, :destroy]
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index a8ad716ee..68d2b2a8b 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class NewsController < ApplicationController
+ default_search_scope :news
before_filter :find_news, :except => [:new, :index, :preview]
before_filter :find_project, :only => [:new, :preview]
before_filter :authorize, :except => [:index, :preview]
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 7527f0d9a..8e39d42c7 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -24,6 +24,8 @@ class InvalidRevisionParam < Exception; end
class RepositoriesController < ApplicationController
menu_item :repository
+ default_search_scope :changesets
+
before_filter :find_repository, :except => :edit
before_filter :find_project, :only => :edit
before_filter :authorize
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index b000b0596..63382f81c 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -18,6 +18,7 @@
require 'diff'
class WikiController < ApplicationController
+ default_search_scope :wiki_pages
before_filter :find_wiki, :authorize
before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy]
diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml
index 471953a66..d8fdcf0d5 100644
--- a/app/views/layouts/base.rhtml
+++ b/app/views/layouts/base.rhtml
@@ -31,6 +31,7 @@
<div id="header">
<div id="quick-search">
<% form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %>
+ <%= hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope %>
<%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>:
<%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %>
<% end %>