Add an icon to each event on the activity view.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1342 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
+13
-6
@@ -25,11 +25,12 @@ module Redmine
|
||||
module ClassMethods
|
||||
def acts_as_event(options = {})
|
||||
return if self.included_modules.include?(Redmine::Acts::Event::InstanceMethods)
|
||||
options[:datetime] ||= 'created_on'
|
||||
options[:title] ||= 'title'
|
||||
options[:description] ||= 'description'
|
||||
options[:author] ||= 'author'
|
||||
options[:datetime] ||= :created_on
|
||||
options[:title] ||= :title
|
||||
options[:description] ||= :description
|
||||
options[:author] ||= :author
|
||||
options[:url] ||= {:controller => 'welcome'}
|
||||
options[:type] ||= self.name.underscore.dasherize
|
||||
cattr_accessor :event_options
|
||||
self.event_options = options
|
||||
send :include, Redmine::Acts::Event::InstanceMethods
|
||||
@@ -41,11 +42,17 @@ module Redmine
|
||||
base.extend ClassMethods
|
||||
end
|
||||
|
||||
%w(datetime title description author).each do |attr|
|
||||
%w(datetime title description author type).each do |attr|
|
||||
src = <<-END_SRC
|
||||
def event_#{attr}
|
||||
option = event_options[:#{attr}]
|
||||
option.is_a?(Proc) ? option.call(self) : send(option)
|
||||
if option.is_a?(Proc)
|
||||
option.call(self)
|
||||
elsif option.is_a?(Symbol)
|
||||
send(option)
|
||||
else
|
||||
option
|
||||
end
|
||||
end
|
||||
END_SRC
|
||||
class_eval src, __FILE__, __LINE__
|
||||
|
||||
Reference in New Issue
Block a user