##// END OF EJS Templates
Adds #activity_provider shortcut method to the plugin API....
Jean-Philippe Lang -
r1693:d05bcda2bad6
parent child
Show More
@@ -30,14 +30,6 module Redmine
30 end
30 end
31
31
32 # Registers an activity provider
32 # Registers an activity provider
33 #
34 # Options:
35 # * :class_name - one or more model(s) that provide these events (inferred from event_type by default)
36 # * :default - setting this option to false will make the events not displayed by default
37 #
38 # Examples:
39 # register :issues
40 # register :myevents, :class_name => 'Meeting'
41 def register(event_type, options={})
33 def register(event_type, options={})
42 options.assert_valid_keys(:class_name, :default)
34 options.assert_valid_keys(:class_name, :default)
43
35
@@ -116,6 +116,32 module Redmine #:nodoc:
116 self.instance_eval(&block)
116 self.instance_eval(&block)
117 @project_module = nil
117 @project_module = nil
118 end
118 end
119
120 # Registers an activity provider.
121 #
122 # Options:
123 # * <tt>:class_name</tt> - one or more model(s) that provide these events (inferred from event_type by default)
124 # * <tt>:default</tt> - setting this option to false will make the events not displayed by default
125 #
126 # A model can provide several activity event types.
127 #
128 # Examples:
129 # register :news
130 # register :scrums, :class_name => 'Meeting'
131 # register :issues, :class_name => ['Issue', 'Journal']
132 #
133 # Retrieving events:
134 # Associated model(s) must implement the find_events class method.
135 # ActiveRecord models can use acts_as_activity_provider as a way to implement this class method.
136 #
137 # The following call should return all the scrum events visible by current user that occured in the 5 last days:
138 # Meeting.find_events('scrums', User.current, 5.days.ago, Date.today)
139 # Meeting.find_events('scrums', User.current, 5.days.ago, Date.today, :project => foo) # events for project foo only
140 #
141 # Note that :view_scrums permission is required to view these events in the activity view.
142 def activity_provider(*args)
143 Redmine::Activity.register(*args)
144 end
119
145
120 # Returns +true+ if the plugin can be configured.
146 # Returns +true+ if the plugin can be configured.
121 def configurable?
147 def configurable?
General Comments 0
You need to be logged in to leave comments. Login now