GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Enable the use of layouts in ActionMailer templates, this fork's goal is to enable content_for blocks
Clone URL: git://github.com/willcodeforfoo/action_mailer_layouts.git
Disable version checks, effectively making this Edge Rails/2.1 compatible 
only
Tue Jul 01 07:22:35 -0700 2008
commit  6cfc439cb315aad4dd1a788f828b2da64d2d5b1e
tree    71c757d036de4ca3f4ff52cce9aacd76e37a9205
parent  805f33af1f18d11ecc08a7723d635344375721d7
...
11
12
13
14
 
15
16
 
 
 
17
18
19
...
22
23
24
25
26
27
 
 
28
29
 
30
31
32
...
11
12
13
 
14
15
16
17
18
19
20
21
22
...
25
26
27
 
 
 
28
29
30
31
32
33
34
35
0
@@ -11,9 +11,12 @@ module ActionMailer
0
       md = /^([^\.]+)\.([^\.]+\.[^\.]+)\.(erb|rhtml|rxml)$/.match(method_name)
0
       layout << ".#{md.captures[1]}" if md && md.captures[1]
0
       layout << ".#{md.captures[2]}" if md && md.captures[2]
0
- layout << ".rhtml" if Rails::VERSION::MAJOR < 2
0
+
0
       if File.exists?(File.join(layouts_path, layout))
0
         body[:content_for_layout] = render_message_without_layouts(method_name, body)
0
+
0
+ # TODO: extract content_for blocks and somehow put them in body[:content_for_...]
0
+
0
         initialize_layout_template_class(body).render(:file => "/#{layout}")
0
       else
0
         render_message_without_layouts(method_name, body)
0
@@ -22,11 +25,11 @@ module ActionMailer
0
     
0
     def initialize_layout_template_class(assigns)
0
       # for Rails 2.1 (and greater), we have to process view paths first!
0
- if Rails::VERSION::MAJOR >= 2 and Rails::VERSION::MINOR >= 1
0
- ActionView::TemplateFinder.process_view_paths(layouts_path)
0
- end
0
+ ActionView::TemplateFinder.process_view_paths(layouts_path)
0
+
0
       returning(template = ActionView::Base.new(layouts_path, assigns, self)) do
0
         template.extend self.class.master_helper_module
0
+ template.extend ActionView::Helpers::CaptureHelper
0
       end
0
     end
0
   

Comments

    No one has commented yet.