summaryrefslogtreecommitdiffstats
path: root/vendor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/plugins')
-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__