awesomemailer 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -0
- data/VERSION +1 -1
- data/awesomemailer.gemspec +1 -1
- data/lib/awesome_mailer/base.rb +0 -2
- data/lib/awesome_mailer/renderer.rb +17 -2
- metadata +1 -1
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/awesomemailer.gemspec
CHANGED
data/lib/awesome_mailer/base.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'css_parser'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
1
4
|
module AwesomeMailer
|
2
5
|
class Renderer
|
3
6
|
attr_accessor :document
|
@@ -49,7 +52,6 @@ module AwesomeMailer
|
|
49
52
|
declarations -= vendor_specific_declarations
|
50
53
|
append_styles_to_head!(document, selector, vendor_specific_declarations, media_query)
|
51
54
|
end
|
52
|
-
|
53
55
|
# Include regular styles inline
|
54
56
|
append_styles_to_body!(document, selector, declarations)
|
55
57
|
end
|
@@ -58,6 +60,13 @@ module AwesomeMailer
|
|
58
60
|
end
|
59
61
|
end
|
60
62
|
|
63
|
+
def asset_host
|
64
|
+
rails? && (
|
65
|
+
Rails.configuration.action_mailer.try(:asset_host) ||
|
66
|
+
Rails.configuration.action_controller.try(:asset_host)
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
61
70
|
def asset_pipeline_path
|
62
71
|
return false unless sprockets?
|
63
72
|
/^#{Regexp.escape(Rails.configuration.assets[:prefix])}\//
|
@@ -67,6 +76,12 @@ module AwesomeMailer
|
|
67
76
|
@css_parser ||= CssParser::Parser.new
|
68
77
|
end
|
69
78
|
|
79
|
+
def default_host
|
80
|
+
if host = AwesomeMailer::Base.default_url_options[:host]
|
81
|
+
"#{AwesomeMailer::Base.default_url_options[:scheme] || 'http'}://#{host}"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
70
85
|
def head
|
71
86
|
@head ||= document.at('head') || Nokogiri::XML::Node.new('head', document.root).tap do |head|
|
72
87
|
document.root.children.first.add_previous_sibling(head)
|
@@ -82,7 +97,7 @@ module AwesomeMailer
|
|
82
97
|
end
|
83
98
|
|
84
99
|
def host
|
85
|
-
if host =
|
100
|
+
if host = asset_host || default_host
|
86
101
|
Addressable::URI.heuristic_parse(host, scheme: 'http')
|
87
102
|
end
|
88
103
|
end
|