summaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-04-12 16:54:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-04-12 16:54:14 +0000
commit6d2a89142af235b5d0a9e30350859fb99ac665f3 (patch)
tree6d1ee51c6fe03dd5020299f9c50ad8ee0b688b57 /vendor
parent85f040c5362dd89829f694a58f4e91ced7fcd33e (diff)
downloadredmine-6d2a89142af235b5d0a9e30350859fb99ac665f3.tar.gz
redmine-6d2a89142af235b5d0a9e30350859fb99ac665f3.zip
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
Diffstat (limited to 'vendor')
-rw-r--r--vendor/plugins/acts_as_event/lib/acts_as_event.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/vendor/plugins/acts_as_event/lib/acts_as_event.rb b/vendor/plugins/acts_as_event/lib/acts_as_event.rb
index a0d1822ad..d7f437a5e 100644
--- a/vendor/plugins/acts_as_event/lib/acts_as_event.rb
+++ b/vendor/plugins/acts_as_event/lib/acts_as_event.rb
@@ -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__