summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-17 20:05:51 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-17 20:05:51 +0000
commitc11d30ebc9f50abf476779e046ba1792453a585d (patch)
treefd0df1a93996674bf71853e2e3f02afafa3e762b /lib
parentb733accfe336e7870a9d420584bf1c11e5778b49 (diff)
downloadredmine-c11d30ebc9f50abf476779e046ba1792453a585d.tar.gz
redmine-c11d30ebc9f50abf476779e046ba1792453a585d.zip
Makes search providers extensible (#3936).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3444 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine.rb11
-rw-r--r--lib/redmine/search.rb17
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/redmine.rb b/lib/redmine.rb
index d9a1f4063..09ee2f5c9 100644
--- a/lib/redmine.rb
+++ b/lib/redmine.rb
@@ -1,6 +1,7 @@
require 'redmine/access_control'
require 'redmine/menu_manager'
require 'redmine/activity'
+require 'redmine/search'
require 'redmine/mime_type'
require 'redmine/core_ext'
require 'redmine/themes'
@@ -178,6 +179,16 @@ Redmine::Activity.map do |activity|
activity.register :time_entries, :default => false
end
+Redmine::Search.map do |search|
+ search.register :issues
+ search.register :news
+ search.register :documents
+ search.register :changesets
+ search.register :wiki_pages
+ search.register :messages
+ search.register :projects
+end
+
Redmine::WikiFormatting.map do |format|
format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper
end
diff --git a/lib/redmine/search.rb b/lib/redmine/search.rb
index ed1f629ea..153197ea1 100644
--- a/lib/redmine/search.rb
+++ b/lib/redmine/search.rb
@@ -17,6 +17,23 @@
module Redmine
module Search
+
+ mattr_accessor :available_search_types
+
+ @@available_search_types = []
+
+ class << self
+ def map(&block)
+ yield self
+ end
+
+ # Registers a search provider
+ def register(search_type, options={})
+ search_type = search_type.to_s
+ @@available_search_types << search_type unless @@available_search_types.include?(search_type)
+ end
+ end
+
module Controller
def self.included(base)
base.extend(ClassMethods)