diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-27 18:38:31 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-27 18:38:31 +0000 |
commit | d05bcda2bad6bc54b1aaaf91c93ca9c6976c4b66 (patch) | |
tree | 8078a0a4cf0b6d29cb22933035c4e99bbca5a66d /lib | |
parent | a774c5c48b5e596770340b6ac27ea9f0a1e1141f (diff) | |
download | redmine-d05bcda2bad6bc54b1aaaf91c93ca9c6976c4b66.tar.gz redmine-d05bcda2bad6bc54b1aaaf91c93ca9c6976c4b66.zip |
Adds #activity_provider shortcut method to the plugin API.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1702 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/activity.rb | 8 | ||||
-rw-r--r-- | lib/redmine/plugin.rb | 26 |
2 files changed, 26 insertions, 8 deletions
diff --git a/lib/redmine/activity.rb b/lib/redmine/activity.rb index 144ce95ed..565a53f36 100644 --- a/lib/redmine/activity.rb +++ b/lib/redmine/activity.rb @@ -30,14 +30,6 @@ module Redmine end # Registers an activity provider - # - # Options: - # * :class_name - one or more model(s) that provide these events (inferred from event_type by default) - # * :default - setting this option to false will make the events not displayed by default - # - # Examples: - # register :issues - # register :myevents, :class_name => 'Meeting' def register(event_type, options={}) options.assert_valid_keys(:class_name, :default) diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb index 36632c13e..cf6c194a2 100644 --- a/lib/redmine/plugin.rb +++ b/lib/redmine/plugin.rb @@ -116,6 +116,32 @@ module Redmine #:nodoc: self.instance_eval(&block) @project_module = nil end + + # Registers an activity provider. + # + # Options: + # * <tt>:class_name</tt> - one or more model(s) that provide these events (inferred from event_type by default) + # * <tt>:default</tt> - setting this option to false will make the events not displayed by default + # + # A model can provide several activity event types. + # + # Examples: + # register :news + # register :scrums, :class_name => 'Meeting' + # register :issues, :class_name => ['Issue', 'Journal'] + # + # Retrieving events: + # Associated model(s) must implement the find_events class method. + # ActiveRecord models can use acts_as_activity_provider as a way to implement this class method. + # + # The following call should return all the scrum events visible by current user that occured in the 5 last days: + # Meeting.find_events('scrums', User.current, 5.days.ago, Date.today) + # Meeting.find_events('scrums', User.current, 5.days.ago, Date.today, :project => foo) # events for project foo only + # + # Note that :view_scrums permission is required to view these events in the activity view. + def activity_provider(*args) + Redmine::Activity.register(*args) + end # Returns +true+ if the plugin can be configured. def configurable? |