mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -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 'truncate_html'
|
||||
gem 'html_truncator'
|
||||
|
||||
# we had issues with latest, stick to the rev till we figure this out
|
||||
# PR that makes it all hang together welcome
|
||||
|
|
|
@ -208,6 +208,8 @@ GEM
|
|||
highline (1.6.20)
|
||||
hike (1.2.3)
|
||||
hiredis (0.4.5)
|
||||
html_truncator (0.3.1)
|
||||
nokogiri (~> 1.5)
|
||||
httpauth (0.2.0)
|
||||
i18n (0.6.5)
|
||||
ice_cube (0.11.0)
|
||||
|
@ -442,7 +444,6 @@ GEM
|
|||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
trollop (2.0)
|
||||
truncate_html (0.9.2)
|
||||
tzinfo (0.3.38)
|
||||
uglifier (2.3.1)
|
||||
execjs (>= 0.3.0)
|
||||
|
@ -484,6 +485,7 @@ DEPENDENCIES
|
|||
handlebars-source (= 1.0.12)
|
||||
highline
|
||||
hiredis
|
||||
html_truncator
|
||||
image_optim
|
||||
image_sorcery
|
||||
librarian (>= 0.0.25)
|
||||
|
@ -544,7 +546,6 @@ DEPENDENCIES
|
|||
therubyracer
|
||||
thin
|
||||
timecop
|
||||
truncate_html
|
||||
uglifier
|
||||
unf
|
||||
unicorn
|
||||
|
|
|
@ -30,7 +30,6 @@ module UserNotificationsHelper
|
|||
end
|
||||
|
||||
def email_excerpt(html)
|
||||
html_string = TruncateHtml::HtmlString.new(html)
|
||||
raw Sanitize.clean(TruncateHtml::HtmlTruncator.new(html_string, length: 1000).truncate, Sanitize::Config::RELAXED)
|
||||
raw Sanitize.clean(HTML_Truncator.truncate(html, 300), Sanitize::Config::RELAXED)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,7 +34,9 @@ module Email
|
|||
|
||||
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
|
||||
content_type 'text/html; charset=UTF-8'
|
||||
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 h1', 'font-size: 20px;')
|
||||
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
|
||||
|
||||
def to_html
|
||||
|
|
Loading…
Reference in a new issue