From 6d2a89142af235b5d0a9e30350859fb99ac665f3 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 12 Apr 2008 16:54:14 +0000 Subject: 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 --- vendor/plugins/acts_as_event/lib/acts_as_event.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'vendor') 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__ -- cgit v1.2.3