FIX: replace polls with a link in emails

This commit is contained in:
Régis Hanol
2015-10-22 19:10:07 +02:00
parent 57fc1e5e0c
commit 515fc49727
5 changed files with 20 additions and 8 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ module Email
html_override.gsub!("%{unsubscribe_link}", unsubscribe_link)
end
styled = Email::Styles.new(html_override)
styled = Email::Styles.new(html_override, @opts)
styled.format_basic
if style = @opts[:style]
+2 -2
View File
@@ -16,11 +16,11 @@ module Email
def html
if @message.html_part
style = Email::Styles.new(@message.html_part.body.to_s)
style = Email::Styles.new(@message.html_part.body.to_s, @opts)
style.format_basic
style.format_html
else
style = Email::Styles.new(PrettyText.cook(text))
style = Email::Styles.new(PrettyText.cook(text), @opts)
style.format_basic
end
+3 -2
View File
@@ -6,8 +6,9 @@ module Email
class Styles
@@plugin_callbacks = []
def initialize(html)
def initialize(html, opts=nil)
@html = html
@opts = opts || {}
@fragment = Nokogiri::HTML.fragment(@html)
end
@@ -146,7 +147,7 @@ module Email
# this method is reserved for styles specific to plugin
def plugin_styles
@@plugin_callbacks.each { |block| block.call(@fragment) }
@@plugin_callbacks.each { |block| block.call(@fragment, @opts) }
end
def to_html