Commit dc6e9466e7e4b23db56c89a78e06f5d8d4fcc0ae

Authored by Rodrigo Souto
Committed by Daniela Feitosa
1 parent 7e6ff7d5

Fixing mailer extension

(ActionItem1996)
config/initializers/action_mailer_extensions.rb
@@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
1 -module ActionMailer  
2 - class Base  
3 - class_inheritable_accessor :view_paths  
4 -  
5 - def self.prepend_view_path(path)  
6 - view_paths.unshift(*path)  
7 - ActionView::TemplateFinder.process_view_paths(path)  
8 - end  
9 -  
10 - def self.append_view_path(path)  
11 - view_paths.push(*path)  
12 - ActionView::TemplateFinder.process_view_paths(path)  
13 - end  
14 -  
15 - def self.view_paths  
16 - @view_paths ||= [template_root]  
17 - end  
18 -  
19 - def view_paths  
20 - self.class.view_paths  
21 - end  
22 -  
23 - def initialize_template_class(assigns)  
24 - ActionView::Base.new(view_paths, assigns, self)  
25 - end  
26 -  
27 - end  
28 -end  
config/initializers/plugins.rb
@@ -2,4 +2,5 @@ require 'noosfero/plugin' @@ -2,4 +2,5 @@ require 'noosfero/plugin'
2 require 'noosfero/plugin/manager' 2 require 'noosfero/plugin/manager'
3 require 'noosfero/plugin/context' 3 require 'noosfero/plugin/context'
4 require 'noosfero/plugin/active_record' 4 require 'noosfero/plugin/active_record'
  5 +require 'noosfero/plugin/mailer_base'
5 Noosfero::Plugin.init_system 6 Noosfero::Plugin.init_system
lib/noosfero/plugin/mailer_base.rb 0 → 100644
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
  1 +class Noosfero::Plugin::MailerBase < ActionMailer::Base
  2 + class_inheritable_accessor :view_paths
  3 +
  4 + def self.prepend_view_path(path)
  5 + view_paths.unshift(*path)
  6 + ActionView::TemplateFinder.process_view_paths(path)
  7 + end
  8 +
  9 + def self.append_view_path(path)
  10 + view_paths.push(*path)
  11 + ActionView::TemplateFinder.process_view_paths(path)
  12 + end
  13 +
  14 + def self.view_paths
  15 + @view_paths ||= [template_root]
  16 + end
  17 +
  18 + def view_paths
  19 + self.class.view_paths
  20 + end
  21 +
  22 + def initialize_template_class(assigns)
  23 + ActionView::Base.new(view_paths, assigns, self)
  24 + end
  25 +end