From dc6e9466e7e4b23db56c89a78e06f5d8d4fcc0ae Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Wed, 11 May 2011 13:59:32 -0300 Subject: [PATCH] Fixing mailer extension --- config/initializers/action_mailer_extensions.rb | 28 ---------------------------- config/initializers/plugins.rb | 1 + lib/noosfero/plugin/mailer_base.rb | 25 +++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 28 deletions(-) delete mode 100644 config/initializers/action_mailer_extensions.rb create mode 100644 lib/noosfero/plugin/mailer_base.rb diff --git a/config/initializers/action_mailer_extensions.rb b/config/initializers/action_mailer_extensions.rb deleted file mode 100644 index 02269a2..0000000 --- a/config/initializers/action_mailer_extensions.rb +++ /dev/null @@ -1,28 +0,0 @@ -module ActionMailer - class Base - class_inheritable_accessor :view_paths - - def self.prepend_view_path(path) - view_paths.unshift(*path) - ActionView::TemplateFinder.process_view_paths(path) - end - - def self.append_view_path(path) - view_paths.push(*path) - ActionView::TemplateFinder.process_view_paths(path) - end - - def self.view_paths - @view_paths ||= [template_root] - end - - def view_paths - self.class.view_paths - end - - def initialize_template_class(assigns) - ActionView::Base.new(view_paths, assigns, self) - end - - end -end diff --git a/config/initializers/plugins.rb b/config/initializers/plugins.rb index 5348975..4e679a6 100644 --- a/config/initializers/plugins.rb +++ b/config/initializers/plugins.rb @@ -2,4 +2,5 @@ require 'noosfero/plugin' require 'noosfero/plugin/manager' require 'noosfero/plugin/context' require 'noosfero/plugin/active_record' +require 'noosfero/plugin/mailer_base' Noosfero::Plugin.init_system diff --git a/lib/noosfero/plugin/mailer_base.rb b/lib/noosfero/plugin/mailer_base.rb new file mode 100644 index 0000000..4c54836 --- /dev/null +++ b/lib/noosfero/plugin/mailer_base.rb @@ -0,0 +1,25 @@ +class Noosfero::Plugin::MailerBase < ActionMailer::Base + class_inheritable_accessor :view_paths + + def self.prepend_view_path(path) + view_paths.unshift(*path) + ActionView::TemplateFinder.process_view_paths(path) + end + + def self.append_view_path(path) + view_paths.push(*path) + ActionView::TemplateFinder.process_view_paths(path) + end + + def self.view_paths + @view_paths ||= [template_root] + end + + def view_paths + self.class.view_paths + end + + def initialize_template_class(assigns) + ActionView::Base.new(view_paths, assigns, self) + end +end -- libgit2 0.21.2