diff options
author | francis <francis> | 2008-09-04 06:04:33 +0000 |
---|---|---|
committer | francis <francis> | 2008-09-04 06:04:33 +0000 |
commit | 481936b26741b33ff842406e6af161aba4b2d9b1 (patch) | |
tree | 8745c80772532cb0a33f2166740448665a589eb3 | |
parent | ebbee5b7b8ee1dbe581c4ab374232bd2834dadd5 (diff) |
Upgrade to new version for Rails 2.1
-rw-r--r-- | vendor/plugins/action_mailer_layouts/CHANGELOG | 12 | ||||
-rw-r--r-- | vendor/plugins/action_mailer_layouts/init.rb | 4 | ||||
-rw-r--r-- | vendor/plugins/action_mailer_layouts/plugin.rb | 13 |
3 files changed, 23 insertions, 6 deletions
diff --git a/vendor/plugins/action_mailer_layouts/CHANGELOG b/vendor/plugins/action_mailer_layouts/CHANGELOG index 077d78f78..0b3f47667 100644 --- a/vendor/plugins/action_mailer_layouts/CHANGELOG +++ b/vendor/plugins/action_mailer_layouts/CHANGELOG @@ -1,3 +1,15 @@ +2008-06-03 +* Added support for Rails 2.0 and 2.1. Thanks to Scott Windsor. + +2008-02-08 +* Added support for *.<format>.erb layouts and templates. Thanks to Eric Wollensen. + +2007-12-20 +* Fixed a bug present when specifying the layout with a string (eg: layout 'subdir/layout_template') in a multipart mail, which caused the plugin to only render one part and not the other. Thanks to Andres Koetsier. + +2007-12-12 +* Now works with Rails 2.0. + 2007-11-27 * Now supports helpers defined in the mailer class. Thanks to Marshall Roch. diff --git a/vendor/plugins/action_mailer_layouts/init.rb b/vendor/plugins/action_mailer_layouts/init.rb index 9c2209171..8289c4eb9 100644 --- a/vendor/plugins/action_mailer_layouts/init.rb +++ b/vendor/plugins/action_mailer_layouts/init.rb @@ -1,7 +1,7 @@ begin - require(File.join(File.dirname(__FILE__), 'plugin.rb')) + require File.join(File.dirname(__FILE__), 'plugin.rb') ActionController::Base.logger.fatal '** Loaded layouts plugin for ActionMailer' rescue Exception => e puts e.inspect ActionController::Base.logger.fatal e if ActionController::Base.logger -end +end
\ No newline at end of file diff --git a/vendor/plugins/action_mailer_layouts/plugin.rb b/vendor/plugins/action_mailer_layouts/plugin.rb index 60475d0f7..377471e21 100644 --- a/vendor/plugins/action_mailer_layouts/plugin.rb +++ b/vendor/plugins/action_mailer_layouts/plugin.rb @@ -7,19 +7,24 @@ module ActionMailer alias_method :render_message_without_layouts, :render_message def render_message(method_name, body) - layout = "./" + (@layout ? @layout.to_s : self.class.to_s.underscore) - md = /^([^\.]+)\.([^\.]+\.[^\.]+)\.(rhtml|rxml)$/.match(method_name) + layout = (@layout ? @layout.to_s.clone : self.class.to_s.underscore) + md = /^([^\.]+)\.([^\.]+\.[^\.]+)\.(erb|rhtml|rxml)$/.match(method_name) layout << ".#{md.captures[1]}" if md && md.captures[1] - layout << ".rhtml" + layout << ".#{md.captures[2]}" if md && md.captures[2] + layout << ".rhtml" # if Rails::VERSION::MAJOR < 2 if File.exists?(File.join(layouts_path, layout)) body[:content_for_layout] = render_message_without_layouts(method_name, body) - initialize_layout_template_class(body).render(:file => layout) + initialize_layout_template_class(body).render(:file => "/#{layout}") else render_message_without_layouts(method_name, body) end end def initialize_layout_template_class(assigns) + # for Rails 2.1 (and greater), we have to process view paths first! + if Rails::VERSION::MAJOR >= 2 and Rails::VERSION::MINOR >= 1 + ActionView::TemplateFinder.process_view_paths(layouts_path) + end returning(template = ActionView::Base.new(layouts_path, assigns, self)) do template.extend self.class.master_helper_module end |