maildown 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/maildown/ext/action_mailer.rb +16 -1
- data/lib/maildown/version.rb +1 -1
- data/lib/maildown.rb +9 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/mailers/user_no_layout_mailer.rb +11 -0
- data/test/dummy/app/mailers/user_with_layout_mailer.rb +11 -0
- data/test/dummy/app/views/layouts/mail_layout.html.erb +1 -0
- data/test/dummy/app/views/layouts/mail_layout.text.erb +1 -0
- data/test/dummy/app/views/user_no_layout_mailer/welcome.md.erb +1 -0
- data/test/dummy/app/views/user_with_layout_mailer/welcome.md.erb +1 -0
- data/test/dummy/config/environments/development.rb +2 -2
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/log/test.log +2815 -0
- data/test/dummy/test/mailers/previews/user_no_layout_mailer_preview.rb +4 -0
- data/test/dummy/test/mailers/previews/user_with_layout_mailer_preview.rb +4 -0
- data/test/dummy/test/mailers/user_no_layout_mailer_test.rb +7 -0
- data/test/dummy/test/mailers/user_with_layout_mailer_test.rb +7 -0
- data/test/integration/layouts_test.rb +35 -0
- metadata +28 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3015c6cd2855144aaa66368e064f210e38b9558f07eaeef739f4330e5d7325cb
|
4
|
+
data.tar.gz: 3e7ce8df93af569dad9ead634a7df86f9fcf75a5797858ab64f9485e0cbc95c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb872109df5155820dbc63005e45afef0af5db00688f5bb69210166422e9a2c1233ae7a4e7cedf63c1f000fec75cddb057be51903daa7ba2309ce94ae4045526
|
7
|
+
data.tar.gz: dd047ceec3b6898e5488aefe6c131ce74b6136fbac8855c03c691c83cc16e83db692539df16bb02856e7a17066b76369dc6b0050cd0dff55be9de5b8f3238169
|
@@ -11,7 +11,22 @@ class ActionMailer::Base
|
|
11
11
|
responses = original_collect_responses(*args, &block)
|
12
12
|
md = ::Maildown::Md.new(responses)
|
13
13
|
if md.contains_md?
|
14
|
-
|
14
|
+
rendered_response = md.to_responses
|
15
|
+
|
16
|
+
if Maildown.enable_layouts
|
17
|
+
text = rendered_response[0]
|
18
|
+
html = rendered_response[1]
|
19
|
+
|
20
|
+
layout_name = _layout(text[:content_type])
|
21
|
+
text[:layout] = "#{layout_name}.text.erb"
|
22
|
+
text[:body] = render(text)
|
23
|
+
|
24
|
+
layout_name = _layout(html[:content_type])
|
25
|
+
html[:layout] = "#{layout_name}.html.erb"
|
26
|
+
html[:body] = render(html)
|
27
|
+
end
|
28
|
+
|
29
|
+
return rendered_response
|
15
30
|
else
|
16
31
|
return responses
|
17
32
|
end
|
data/lib/maildown/version.rb
CHANGED
data/lib/maildown.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Maildown
|
2
2
|
@allow_indentations = false
|
3
|
+
@enable_layouts = false
|
3
4
|
|
4
5
|
def self.allow_indentation
|
5
6
|
@allow_indentations
|
@@ -8,6 +9,14 @@ module Maildown
|
|
8
9
|
def self.allow_indentation=(allow_indentations)
|
9
10
|
@allow_indentations = allow_indentations
|
10
11
|
end
|
12
|
+
|
13
|
+
def self.enable_layouts
|
14
|
+
@enable_layouts
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.enable_layouts=(enable_layouts)
|
18
|
+
@enable_layouts = enable_layouts
|
19
|
+
end
|
11
20
|
end
|
12
21
|
|
13
22
|
require 'maildown/markdown_engine'
|
@@ -0,0 +1 @@
|
|
1
|
+
HTML<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
TEXT<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
## Welcome!
|
@@ -0,0 +1 @@
|
|
1
|
+
## Welcome!
|
@@ -20,10 +20,10 @@ Dummy::Application.configure do
|
|
20
20
|
config.active_support.deprecation = :log
|
21
21
|
|
22
22
|
# Raise an error on page load if there are pending migrations
|
23
|
-
config.active_record.migration_error = :page_load
|
23
|
+
# config.active_record.migration_error = :page_load
|
24
24
|
|
25
25
|
# Debug mode disables concatenation and preprocessing of assets.
|
26
26
|
# This option may cause significant delays in view rendering with a large
|
27
27
|
# number of complex assets.
|
28
|
-
config.assets.debug = true
|
28
|
+
# config.assets.debug = true
|
29
29
|
end
|
File without changes
|