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