Added tertiary color to digest

Added hash to color in helper

Added anchor_color to topic and site name links

Styled the unsubscribe link
This commit is contained in:
Joe Buhlig 2016-02-12 11:09:29 -06:00
parent 6fc2d9db3a
commit 6763a9923a
3 changed files with 10 additions and 9 deletions

View File

@ -28,8 +28,8 @@ module UserNotificationsHelper
logo_url logo_url
end end
def html_site_link def html_site_link(color)
"<a href='#{Discourse.base_url}'>#{@site_name}</a>" "<a href='#{Discourse.base_url}' style='color: ##{color}'>#{@site_name}</a>"
end end
def first_paragraph_from(html) def first_paragraph_from(html)

View File

@ -62,6 +62,7 @@ class UserNotifications < ActionMailer::Base
@site_name = SiteSetting.email_prefix.presence || SiteSetting.title @site_name = SiteSetting.email_prefix.presence || SiteSetting.title
@header_color = ColorScheme.hex_for_name('header_background') @header_color = ColorScheme.hex_for_name('header_background')
@anchor_color = ColorScheme.hex_for_name('tertiary')
@last_seen_at = short_date(@user.last_seen_at || @user.created_at) @last_seen_at = short_date(@user.last_seen_at || @user.created_at)
# A list of topics to show the user # A list of topics to show the user

View File

@ -1,7 +1,7 @@
<table style="border: 20px solid #eee;" cellspacing="0" cellpadding="0"> <table style="border: 20px solid #eee;" cellspacing="0" cellpadding="0">
<tr> <tr>
<td style="padding: 10px 10px; background-color: #<%= @header_color %>;"> <td style="padding: 10px 10px; background-color: #<%= @header_color %>;">
<a href="<%= Discourse.base_url %>"> <a href="<%= Discourse.base_url %>" style='color: #<%= @anchor_color %>'>
<%- if logo_url.blank? %> <%- if logo_url.blank? %>
<%= SiteSetting.title %> <%= SiteSetting.title %>
<%- else %> <%- else %>
@ -11,7 +11,7 @@
</tr> </tr>
<tr> <tr>
<td style="background-color: #fff; padding: 10px 10px; font-family: Arial, Helvetica, sans-serif; font-size: 14px;"> <td style="background-color: #fff; padding: 10px 10px; font-family: Arial, Helvetica, sans-serif; font-size: 14px;">
<%= raw(t 'user_notifications.digest.why', site_link: html_site_link, last_seen_at: @last_seen_at) %> <%= raw(t 'user_notifications.digest.why', site_link: html_site_link(@anchor_color), last_seen_at: @last_seen_at) %>
<%- if @featured_topics.present? %> <%- if @featured_topics.present? %>
<hr/> <hr/>
@ -20,7 +20,7 @@
<%- @featured_topics.each_with_index do |t, i| %> <%- @featured_topics.each_with_index do |t, i| %>
<div class='featured-topic'> <div class='featured-topic'>
<a href='<%= Discourse.base_url + t.relative_url %>'><%= raw unescape_emoji(t.title) %></a> <a href='<%= Discourse.base_url + t.relative_url %>' style='color: #<%= @anchor_color %>'><%= raw unescape_emoji(t.title) %></a>
<br/> <br/>
<%= category_badge(t.category, inline_style: true, absolute_url: true) %> <%= category_badge(t.category, inline_style: true, absolute_url: true) %>
</div> </div>
@ -43,7 +43,7 @@
<%- @new_topics.each do |t| %> <%- @new_topics.each do |t| %>
<ul> <ul>
<li> <li>
<a href='<%= Discourse.base_url + t.relative_url %>'><%= raw unescape_emoji(t.title) %></a> <a href='<%= Discourse.base_url + t.relative_url %>' style='color: #<%= @anchor_color %>'><%= raw unescape_emoji(t.title) %></a>
<span class='post-count'><%= t.posts_count %></span> <span class='post-count'><%= t.posts_count %></span>
<%= category_badge(t.category, inline_style: true, absolute_url: true) %> <%= category_badge(t.category, inline_style: true, absolute_url: true) %>
</li> </li>
@ -58,7 +58,7 @@
<div> <div>
<%- @new_by_category.first(10).each do |c| %> <%- @new_by_category.first(10).each do |c| %>
<span style='white-space: nowrap'> <span style='white-space: nowrap'>
<a href='<%= Discourse.base_url %><%= c[0].url %>' style='color: #333'><%= c[0].name %></b> <span style='color: #777; margin: 0 10px 0 5px; font-size: 0.9em;'> <%= c[1] %></span> <a href='<%= Discourse.base_url %><%= c[0].url %>' style='color: #<%= @anchor_color %>'><%= c[0].name %></b> <span style='color: #777; margin: 0 10px 0 5px; font-size: 0.9em;'> <%= c[1] %></span>
</span> </span>
<%- end %> <%- end %>
</div> </div>
@ -72,6 +72,6 @@
<div class='footer'> <div class='footer'>
<%=raw(t :'user_notifications.digest.unsubscribe', <%=raw(t :'user_notifications.digest.unsubscribe',
site_link: html_site_link, site_link: html_site_link(@anchor_color),
unsubscribe_link: link_to(t('user_notifications.digest.click_here'), email_unsubscribe_url(host: Discourse.base_url, key: @unsubscribe_key))) %> unsubscribe_link: link_to(t('user_notifications.digest.click_here'), email_unsubscribe_url(host: Discourse.base_url, key: @unsubscribe_key), {:style=>'color: #' + @anchor_color })) %>
</div> </div>