mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
FIX: Missing styles in HTML digest emails
This commit is contained in:
parent
9b6538832d
commit
3da2285ef1
5 changed files with 12 additions and 6 deletions
2
Gemfile
2
Gemfile
|
@ -59,7 +59,7 @@ gem 'redis', :require => ["redis", "redis/connection/hiredis"]
|
||||||
|
|
||||||
gem 'active_model_serializers'
|
gem 'active_model_serializers'
|
||||||
|
|
||||||
gem 'truncate_html'
|
gem 'html_truncator'
|
||||||
|
|
||||||
# we had issues with latest, stick to the rev till we figure this out
|
# we had issues with latest, stick to the rev till we figure this out
|
||||||
# PR that makes it all hang together welcome
|
# PR that makes it all hang together welcome
|
||||||
|
|
|
@ -208,6 +208,8 @@ GEM
|
||||||
highline (1.6.20)
|
highline (1.6.20)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
hiredis (0.4.5)
|
hiredis (0.4.5)
|
||||||
|
html_truncator (0.3.1)
|
||||||
|
nokogiri (~> 1.5)
|
||||||
httpauth (0.2.0)
|
httpauth (0.2.0)
|
||||||
i18n (0.6.5)
|
i18n (0.6.5)
|
||||||
ice_cube (0.11.0)
|
ice_cube (0.11.0)
|
||||||
|
@ -442,7 +444,6 @@ GEM
|
||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
trollop (2.0)
|
trollop (2.0)
|
||||||
truncate_html (0.9.2)
|
|
||||||
tzinfo (0.3.38)
|
tzinfo (0.3.38)
|
||||||
uglifier (2.3.1)
|
uglifier (2.3.1)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
|
@ -484,6 +485,7 @@ DEPENDENCIES
|
||||||
handlebars-source (= 1.0.12)
|
handlebars-source (= 1.0.12)
|
||||||
highline
|
highline
|
||||||
hiredis
|
hiredis
|
||||||
|
html_truncator
|
||||||
image_optim
|
image_optim
|
||||||
image_sorcery
|
image_sorcery
|
||||||
librarian (>= 0.0.25)
|
librarian (>= 0.0.25)
|
||||||
|
@ -544,7 +546,6 @@ DEPENDENCIES
|
||||||
therubyracer
|
therubyracer
|
||||||
thin
|
thin
|
||||||
timecop
|
timecop
|
||||||
truncate_html
|
|
||||||
uglifier
|
uglifier
|
||||||
unf
|
unf
|
||||||
unicorn
|
unicorn
|
||||||
|
|
|
@ -30,7 +30,6 @@ module UserNotificationsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def email_excerpt(html)
|
def email_excerpt(html)
|
||||||
html_string = TruncateHtml::HtmlString.new(html)
|
raw Sanitize.clean(HTML_Truncator.truncate(html, 300), Sanitize::Config::RELAXED)
|
||||||
raw Sanitize.clean(TruncateHtml::HtmlTruncator.new(html_string, length: 1000).truncate, Sanitize::Config::RELAXED)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,7 +34,9 @@ module Email
|
||||||
|
|
||||||
renderer = Email::Renderer.new(@message, opts)
|
renderer = Email::Renderer.new(@message, opts)
|
||||||
|
|
||||||
unless @message.html_part
|
if @message.html_part
|
||||||
|
@message.html_part.body = renderer.html
|
||||||
|
else
|
||||||
@message.html_part = Mail::Part.new do
|
@message.html_part = Mail::Part.new do
|
||||||
content_type 'text/html; charset=UTF-8'
|
content_type 'text/html; charset=UTF-8'
|
||||||
body renderer.html
|
body renderer.html
|
||||||
|
|
|
@ -59,6 +59,10 @@ module Email
|
||||||
style('div.digest-post', 'margin-left: 15px; margin-top: 20px; max-width: 694px;')
|
style('div.digest-post', 'margin-left: 15px; margin-top: 20px; max-width: 694px;')
|
||||||
style('div.digest-post h1', 'font-size: 20px;')
|
style('div.digest-post h1', 'font-size: 20px;')
|
||||||
style('span.footer-notice', 'color:#666; font-size:80%')
|
style('span.footer-notice', 'color:#666; font-size:80%')
|
||||||
|
|
||||||
|
style('pre', 'white-space: pre-wrap')
|
||||||
|
style('code', 'background-color: f1f1ff; padding: 2px 5px;')
|
||||||
|
style('pre code', 'display: block; background-color: f1f1ff; padding: 5px')
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_html
|
def to_html
|
||||||
|
|
Loading…
Reference in a new issue