FEATURE: New summary/digest email design

This commit is contained in:
Neil Lalonde 2016-11-10 18:16:24 -05:00
parent 7bd88b706a
commit 45f368126f
12 changed files with 477 additions and 119 deletions

View File

@ -107,6 +107,14 @@ module ApplicationHelper
AgeWords.age_words(secs)
end
def short_date(dt)
if dt.year == Time.now.year
I18n.l(dt, format: :short_no_year)
else
I18n.l(dt, format: :date_only)
end
end
def guardian
@guardian ||= Guardian.new(current_user)
end

View File

@ -48,9 +48,9 @@ module UserNotificationsHelper
doc.css('div').first
end
def email_excerpt(html, posts_count)
def email_excerpt(html, posts_count=nil)
# only include 1st paragraph when more than 1 posts
html = first_paragraph_from(html).to_s if posts_count > 1
html = first_paragraph_from(html).to_s if posts_count.nil? || posts_count > 1
PrettyText.format_for_email(html).html_safe
end
@ -93,4 +93,8 @@ module UserNotificationsHelper
PrettyText.format_for_email(I18n.t(i18n_key)).html_safe
end
def email_image_url(basename)
UrlHelper.absolute("#{Discourse.base_uri}/images/emails/#{basename}")
end
end

View File

@ -99,28 +99,22 @@ class UserNotifications < ActionMailer::Base
@last_seen_at = short_date(user.last_seen_at || user.created_at)
# A list of topics to show the user
@featured_topics = Topic.for_digest(user, min_date, limit: SiteSetting.digest_topics, top_order: true).to_a
@preheader_text = I18n.t('user_notifications.digest.preheader', last_seen_at: @last_seen_at)
# Don't send email unless there is content in it
if @featured_topics.present?
featured_topic_ids = @featured_topics.map(&:id)
@new_topics_count = Topic.new_since_last_seen(user, min_date).count
@unread_messages = user.unread_private_messages
@unread_notifications = user.unread_notifications
@new_topics_since_seen = Topic.new_since_last_seen(user, min_date, featured_topic_ids).count
if @new_topics_since_seen > SiteSetting.digest_topics
category_counts = Topic.new_since_last_seen(user, min_date, featured_topic_ids).group(:category_id).count
topics_for_digest = Topic.for_digest(user, min_date, limit: SiteSetting.digest_topics + 3, top_order: true).to_a
@new_by_category = []
if category_counts.present?
Category.where(id: category_counts.keys).each do |c|
@new_by_category << [c, category_counts[c.id]]
end
@new_by_category.sort_by! {|c| -c[1]}
end
end
@popular_topics = topics_for_digest[0,SiteSetting.digest_topics]
@popular_posts = SiteSetting.digest_posts > 0 ? Post.where("post_number > ?", 1).where("score > ?", 5.0).order("score DESC").limit(SiteSetting.digest_posts) : []
@other_new_for_you = topics_for_digest.size > SiteSetting.digest_topics ? topics_for_digest[SiteSetting.digest_topics..-1] : []
@featured_topics, @new_topics = @featured_topics[0..4], @featured_topics[5..-1]
topic_lookup = TopicUser.lookup_for(user, @other_new_for_you)
@other_new_for_you.each { |t| t.user_data = topic_lookup[t.id] }
if @popular_topics.present?
opts = {
from_alias: I18n.t('user_notifications.digest.from', site_name: SiteSetting.title),
subject: I18n.t('user_notifications.digest.subject_template', site_name: @site_name, date: short_date(Time.now)),
@ -132,6 +126,7 @@ class UserNotifications < ActionMailer::Base
end
end
def user_replied(user, opts)
opts[:allow_reply_by_email] = true
opts[:use_site_subject] = true
@ -421,7 +416,8 @@ class UserNotifications < ActionMailer::Base
@date = short_date(Time.now)
@base_url = Discourse.base_url
@site_name = SiteSetting.email_prefix.presence || SiteSetting.title
@header_color = ColorScheme.hex_for_name('header_background')
@header_color = ColorScheme.hex_for_name('header_primary')
@header_bgcolor = ColorScheme.hex_for_name('header_background')
@anchor_color = ColorScheme.hex_for_name('tertiary')
@markdown_linker = MarkdownLinker.new(@base_url)
@unsubscribe_key = UnsubscribeKey.create_key_for(@user, "digest")

View File

@ -373,9 +373,9 @@ class Topic < ActiveRecord::Base
end
# Using the digest query, figure out what's new for a user since last seen
def self.new_since_last_seen(user, since, featured_topic_ids)
def self.new_since_last_seen(user, since, featured_topic_ids=nil)
topics = Topic.for_digest(user, since)
topics.where("topics.id NOT IN (?)", featured_topic_ids)
featured_topic_ids ? topics.where("topics.id NOT IN (?)", featured_topic_ids) : topics
end
def meta_data=(data)

View File

@ -1,88 +1,403 @@
<table style="border: 20px solid #eee;" cellspacing="0" cellpadding="0">
<tr>
<%- if I18n.t('user_notifications.digest.custom.html.header').present? %>
<td style="padding: 10px 10px;">
<%= raw(t 'user_notifications.digest.custom.html.header') %>
</td>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-type" name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
<title></title>
</head>
<body style="-moz-box-sizing:border-box;-ms-text-size-adjust:100%;-webkit-box-sizing:border-box;-webkit-text-size-adjust:100%;box-sizing:border-box;color:#0a0a0a;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;min-width:100%;padding:0;text-align:left;width:100%">
<!--[if mso]>
<style type="text/css">
body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !important;}
</style>
<![endif]-->
<span class="preheader" style="display:none!important;color:#f3f3f3;font-size:1px;line-height:1px;max-height:0;max-width:0;mso-hide:all!important;opacity:0;overflow:hidden;visibility:hidden">
<%= @preheader_text %>
</span>
<table style="background-color:#<%= @header_bgcolor -%>;width:100%;">
<tr>
<td align="center" style="text-align: center;padding: 20px 0;">
<a href="<%= Discourse.base_url %>" style="color:#<%= @header_color -%>;font-size:28px;text-decoration:none;">
<%- if logo_url.blank? %>
<%= SiteSetting.title %>
<%- else %>
<td style="padding: 10px 10px; background-color: #<%= @header_color %>;">
<a href="<%= Discourse.base_url %>" style='color: #<%= @anchor_color %>'>
<%- if logo_url.blank? %>
<%= SiteSetting.title %>
<%- else %>
<img src="<%= logo_url %>" style="max-height: 35px; min-height: 35px; height: 35px;" class='site-logo' alt="<%= SiteSetting.title %>">
<%- end %>
</a>
</td>
<img src="<%= logo_url %>" height="40" style="-ms-interpolation-mode:bicubic;clear:both;display:block;height:40px;margin:auto;max-width:100%;outline:0;text-decoration:none;" alt="<%= SiteSetting.title %>">
<%- end %>
</tr>
<tr>
<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(@anchor_color), last_seen_at: @last_seen_at) %>
</a>
<%- if @featured_topics.present? %>
<hr/>
<h3><%=t 'user_notifications.digest.top_topics' %></h3>
<%- @featured_topics.each_with_index do |t, i| %>
<div class='featured-topic'>
<a href='<%= Discourse.base_url_no_prefix + t.relative_url %>' style='color: #<%= @anchor_color %>'><%= raw format_topic_title(t.title) %></a>
<br/>
<%= category_badge(t.category, inline_style: true, absolute_url: true) %>
</div>
<%- if t.best_post.present? && !t.best_post.user_deleted %>
<div class='digest-post'>
<%= email_excerpt(t.best_post.cooked, @featured_topics.size) %>
</div>
<%- end %>
<%= digest_custom_html("below_post_#{i+1}") %>
<%- if i < @featured_topics.size - 1 %><% end %>
<%- end %>
<%- end %>
<%= digest_custom_html("above_popular_topics") %>
<%- if @new_topics.present? %>
<hr/>
<h3><%=t 'user_notifications.digest.other_new_topics' %></h3>
<%- @new_topics.each do |t| %>
<ul>
<li>
<a href='<%= Discourse.base_url_no_prefix + t.relative_url %>' style='color: #<%= @anchor_color %>'><%= raw format_topic_title(t.title) %></a>
<span class='post-count'><%= t.posts_count %></span>
<%= category_badge(t.category, inline_style: true, absolute_url: true) %>
</li>
</ul>
<%- end -%>
<%- end -%>
<%= digest_custom_html("below_popular_topics") %>
<%- if @new_topics_since_seen > 0 %>
<%- if @new_by_category.present? %>
<p><%= t('user_notifications.digest.more_topics_category', last_seen_at: @last_seen_at, new_topics_since_seen: @new_topics_since_seen) %></p>
<div>
<%- @new_by_category.first(10).each do |c| %>
<span style='white-space: nowrap'>
<a href='<%= Discourse.base_url_no_prefix %><%= 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></a>
</span>
<%- end %>
</div>
<%- else %>
<p><%= t('user_notifications.digest.more_topics', last_seen_at: @last_seen_at, new_topics_since_seen: @new_topics_since_seen) %></p>
<%- end %>
<%- end -%>
</td>
</tr>
</td>
</tr>
</table>
<table class="body" style="width:100%;background:#f3f3f3;padding:0;border-spacing:0;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:200;line-height:1.3;vertical-align:top;">
<tr>
<td class="side-spacer" style="width:5%;vertical-align:top;padding:0;">
<div style="background-color:#2F70AC;">
<table class="spacer" style="border-spacing:0;padding:0;width:100%">
<tbody>
<tr>
<td height="400px" style="height:400px;border-collapse:collapse!important;margin:0;mso-line-height-rule:exactly;padding:0;">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</td>
<td style="vertical-align:top;padding:0;font-family:Helvetica,Arial,sans-serif;">
<table align="center" style="border-spacing:0;background:#fefefe;background-color:#2F70AC;margin:0;padding:0;text-align:inherit;vertical-align:top;width:100%">
<tbody>
<tr>
<td style="border-collapse:collapse!important;color:#0a0a0a;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:normal">
<br/>
<center style="color:#fff;font-size:28px;font-weight:400;"><%=t 'user_notifications.digest.since_last_visit' %></center>
<table style="margin-bottom:20px;padding:0;vertical-align:top;width:100%">
<tbody>
<tr>
<td style="text-align:center;color:#fff;font-size:3em;font-weight:400;width:33%;">
<strong><%= @new_topics_count -%></strong>
</td>
<td style="text-align:center;color:#fff;font-size:3em;font-weight:400;">
<strong><%= @unread_messages -%></strong>
</td>
<td style="text-align:center;color:#fff;font-size:3em;font-weight:400;width:33%;">
<strong><%= @unread_notifications -%></strong>
</td>
</tr>
<tr>
<td style="color:#fff;font-size:16px;font-weight:400;text-align:center;width:33%;">
<%=t 'user_notifications.digest.new_topics' %>
</td>
<td style="color:#fff;font-size:16px;font-weight:400;text-align:center;">
<%=t 'user_notifications.digest.unread_messages' %>
</td>
<td style="color:#fff;font-size:16px;font-weight:400;text-align:center;width:33%;">
<%=t 'user_notifications.digest.unread_notifications' %>
</td>
</tr>
</tbody>
</table>
<center style="color:#fff;font-size:34px;font-weight:400;margin-bottom: 8px;"><%=t 'user_notifications.digest.popular_topics' %></center>
</td>
</tr>
</tbody>
</table>
<table align="center" style="border-spacing:0;background:#fefefe;margin:0;padding:0;text-align:center;vertical-align:top;width:100%">
<tbody>
<tr>
<td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;color:#0a0a0a;hyphens:auto;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:normal">
<% @popular_topics.each_with_index do |t, i| %>
<!-- Beginning of Popular Topic -->
<table style="width:100%">
<tbody>
<tr>
<td style="margin:0;padding:0 8px 16px 16px;text-align:left;vertical-align:top;width:75%">
<p style="color:#8f8f8f;line-height:1.3;margin: 20px 0 10px 0;">
<%= category_badge(t.category, inline_style: true, absolute_url: true) %>
</p>
</td>
<td style="margin:0;padding: 0 16px 16px 8px;text-align:right;vertical-align:top;width:25%">
<p class="text-right" style="color:#8f8f8f;line-height:1.3;margin:20px 0 10px 0;font-weight:400;">
<%= short_date(t.created_at) %>
</p>
</td>
</tr>
</tbody>
</table>
<table style="vertical-align:top;width:100%">
<tbody>
<tr>
<td style="padding: 0 8px 8px 16px; text-align:left; width: <%= t.image_url.present? ? "80%" : "100%" -%>;">
<h2 style="font-size:24px;font-weight:400;line-height:1.3;margin:0 0 10px 0;padding:0;word-wrap:normal">
<a href="<%= Discourse.base_url_no_prefix + t.relative_url %>" style="color:#2F70AC;font-weight:400;line-height:1.3;margin:0;padding:0;text-decoration:none">
<strong><%= t.title -%></strong>
</a>
</h2>
</td>
<% if t.image_url.present? %>
<td style="color:#0a0a0a;line-height:1.3;margin:0;padding:0 16px 8px 8px;text-align:right;width:20%" align="right">
<img src="<%= Discourse.base_url_no_prefix + t.image_url -%>" height="64" style="-ms-interpolation-mode:bicubic;margin:auto;max-height:64px;max-width:100%;outline:0;text-align:right;text-decoration:none;">
</td>
<% end %>
</tr>
</tbody>
</table>
<table style="padding:0;position:relative;text-align:left;vertical-align:top;width:100%">
<tbody>
<tr>
<td style="color:#0a0a0a;line-height:1.3;margin:0 auto;padding:0 8px 0 16px;width:60px;">
<img src="<%= t.user.small_avatar_url -%>" style="-ms-interpolation-mode:bicubic;border-radius:50%;clear:both;display:block;float:none;height:50px;width:50px;margin:0;max-width:100%;outline:0;text-align:center;text-decoration:none;" align="center">
</td>
<td style="color:#0a0a0a;padding:0 16px 0 8px;text-align:left;">
<h6 style="color:inherit;font-size:18px;font-weight:400;line-height:1.3;margin:0;padding:0;word-wrap:normal;"><%= t.user.try(:username) -%></h6>
<% if t.user.try(:name).present? %>
<p style="color:#8f8f8f;line-height:1.3;margin:0 0 16px 0;padding:0;"><%= t.user.name -%></p>
<% end %>
</td>
</tr>
</tbody>
</table>
<%- if t.first_post.present? && !t.first_post.user_deleted %>
<table style="border-bottom:1px solid #f3f3f3;padding:0;text-align:left;vertical-align:top;width:100%">
<tbody>
<tr>
<td style="color:#0a0a0a;line-height:1.3;padding:0 16px 16px 16px;text-align:left;width:100%;font-weight:normal;">
<%= email_excerpt(t.first_post.cooked) %>
</td>
</tr>
</tbody>
</table>
<%- end %>
<table style="padding:0;text-align:left;vertical-align:top;width:100%; margin-top:20px;">
<tbody>
<tr style="vertical-align:top;">
<td style="padding:0 8px 16px 16px;text-align:left;white-space: nowrap;vertical-align: top;">
<img src="<%= email_image_url 'heart.png' -%>" style="-ms-interpolation-mode:bicubic;clear:both;display:inline-block;float:left;height:20px;margin:0;max-width:100%;opacity:.4;outline:0;text-decoration:none;width:auto">
<p style="color:#8f8f8f;float:left;line-height:1.3;margin:0 5px 10px 5px;padding:0;text-align:left;font-weight:400;"><%= t.like_count -%></p>
</td>
<td style="padding:0 8px 16px 8px;text-align:left;white-space: nowrap;vertical-align: top;">
<img src="<%= email_image_url 'comment.png' -%>" style="-ms-interpolation-mode:bicubic;clear:none;display:inline-block;float:left;height:20px;margin:0;max-width:100%;opacity:.4;outline:0;text-decoration:none;width:auto">
<p style="color:#8f8f8f;float:left;line-height:1.3;margin:0 5px 10px 5px;padding:0;text-align:left;font-weight:400;"><%= t.posts_count - 1 -%></p>
</td>
<td style="padding:0 8px 16px 8px;text-align:left;white-space: nowrap;vertical-align: top;">
<% t.posters_summary.each do |ps| %>
<% if ps.user %>
<img src="<%= ps.user.small_avatar_url -%>" style="-ms-interpolation-mode:bicubic;border-radius:50%;clear:both;display:inline-block;height:20px;width:20px;outline:0;text-decoration:none;">
<% end %>
<% end %>
</td>
<td style="line-height:1.3;padding:0 16px 0 8px;text-align:right;white-space: nowrap;vertical-align: top;">
<a href="<%= Discourse.base_url_no_prefix + t.relative_url %>" style="width:100%;background-color:#2199e8;color:#fff;text-decoration:none;padding:8px 16px;white-space: nowrap;">
<%=t 'user_notifications.digest.join_the_discussion' %>
</a>
</td>
</tr>
</tbody>
</table>
<div style="background-color:#f3f3f3;">
<table class="spacer" style="padding:0;width:100%">
<tbody><tr><td height="20px" style="border-collapse:collapse!important;line-height:20px;margin:0;mso-line-height-rule:exactly;padding:0;">&#xA0;</td></tr></tbody>
</table>
</div>
<!-- End of Popular Topic -->
<%= digest_custom_html("below_post_#{i+1}") %>
<% end %>
</td>
</tr>
</tbody>
</table>
</td>
<td class="side-spacer" style="width:5%;vertical-align:top;padding:0;">
<!-- Blue background that goes down part-way behind content -->
<div style="background-color:#2F70AC;">
<table class="spacer" style="border-spacing:0;padding:0;width:100%">
<tbody>
<tr>
<td height="400px" style="height:400px;border-collapse:collapse!important;margin:0;mso-line-height-rule:exactly;padding:0;">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</table>
<% if @popular_posts.present? %>
<table style="background-color: #f3f3f3; width: 100%;">
<tr>
<td>
<h1 style="color:#0a0a0a;font-size:34px;font-weight:400;line-height:1.3; padding: 30px 0 10px 0;text-align:center;">
<%=t 'user_notifications.digest.popular_posts' %>
</h1>
</td>
</tr>
</table>
<table class="body" style="width:100%;background:#f3f3f3;border-spacing:0;border-collapse:collapse!important;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:200;line-height:1.3;padding:0;text-align:left;vertical-align:top;">
<tr>
<td class="side-spacer" style="width:5%;padding:0;">&nbsp;</td>
<td align="center" valign="top" style="width:90%;border-collapse:collapse!important;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;">
<% @popular_posts.each do |post| %>
<!-- Beginning of Popular Post -->
<table style="width:100%;background:#fefefe;border-spacing:0;padding:0;text-align:left;vertical-align:top;">
<tbody>
<tr>
<td style="color:#0a0a0a;line-height:1.3;font-weight:200;padding:16px;text-align:left;width:100%;">
<%= email_excerpt(post.cooked) %>
</td>
</tr>
</tbody>
</table>
<table style="border-spacing:0;background-color:#f3f3f3;padding:0;text-align:left;vertical-align:top;width:100%">
<tbody>
<tr>
<td style="border-spacing:0;padding:0;color:#0a0a0a;line-height:1.3;padding:0 0 0 65px;text-align:left;">
<img src="<%= email_image_url 'right_triangle.png' -%>" style="-ms-interpolation-mode:bicubic;clear:both;display:block;height:20px;width:20px;outline:0;text-decoration:none;">
</td>
</tr>
</tbody>
</table>
<table style="background-color:#f3f3f3;padding:0;position:relative;text-align:left;vertical-align:top;width:100%">
<tbody>
<tr>
<td style="padding:0 8px 8px 8px;text-align:left;width:60px;vertical-align:top;">
<img src="<%= post.user.small_avatar_url -%>" style="-ms-interpolation-mode:bicubic;border-radius:50%;clear:both;display:block;height:50px;width:50px;outline:0;">
</td>
<td style="color:#0a0a0a;line-height:1.3;padding:0 8px 8px 8px;text-align:left;">
<h6 style="color:inherit;font-size:16px;font-weight:400;margin:0;padding:0;text-align:left;word-wrap:normal;"><%= post.user.username -%></h6>
<p style="color:#8f8f8f;font-size:16px;line-height:1.3;margin:0;padding:0;text-align:left;"><%= post.user.name -%></p>
</td>
<td style="color:#0a0a0a;line-height:1.3;padding:0 8px 8px 8px;text-align:right;">
<p style="color:#8f8f8f;line-height:1.3;margin:0 0 10px 0;padding:0;text-align:right;">
<%=t 'user_notifications.digest.from_topic_label' %>
<a href="<%= post.full_url -%>" style="color:#2199e8;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left;text-decoration:none"><%= post.topic.title -%></a>
</p>
<a href="<%= post.full_url -%>" style="width:100%;background-color:#2199e8;color:#fff;text-decoration:none;padding:8px 16px;white-space: nowrap;">
<%=t 'user_notifications.digest.join_the_discussion' %>
</a>
</td>
</tr>
</tbody>
</table>
<div style="background-color:#f3f3f3">
<table class="spacer" style="padding:0;text-align:left;vertical-align:top;width:100%">
<tbody><tr><td height="40px" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;color:#0a0a0a;font-size:40px;font-weight:400;hyphens:auto;line-height:40px;margin:0;mso-line-height-rule:exactly;padding:0;text-align:left;vertical-align:top;word-wrap:normal">&#xA0;</td></tr></tbody>
</table>
</div>
<!-- End of Popular Post -->
<% end %>
<% end %>
<% if @other_new_for_you.present? %>
<center style="color:#0a0a0a;font-size:34px;font-weight:400;margin-bottom: 8px;"><%=t 'user_notifications.digest.more_new' %></center>
<%= digest_custom_html("above_popular_topics") %>
<table style="padding:0;text-align:left;vertical-align:top;width:100%">
<tbody>
<% @other_new_for_you.each do |t| %>
<!-- Begin new topic -->
<tr style="vertical-align:top;">
<td style="padding:20px 8px 0 16px;text-align:left;">
<p style="background:#2F70AC;border-radius:50%;color:#fff;height:30px;line-height:30px;margin:0 0 10px 0;padding:0;text-align:center;width:30px;font-weight: 400;">
<%= t.user_data ? (t.highest_post_number - t.user_data.last_read_post_number) : t.highest_post_number %>
</p>
</td>
<td style="padding:24px 8px 16px 8px;text-align:left;">
<a href="#" style="color:#2F70AC;font-weight:400;line-height:1.3;margin:0;padding:0;text-decoration:none">
<strong><%= t.title -%></strong>
</a>
</td>
<td style="padding:26px 8px 16px 8px;text-align:left;">
<p style="color:#0a0a0a;line-height:1.3;margin:0 0 10px 0;padding:0;text-align:left"><%= t.category.try(:name) -%></p>
</td>
<td style="padding:24px 8px 16px 8px;text-align:left;">
<% t.posters_summary[0,2].each do |ps| %>
<% if ps.user %>
<img src="<%= ps.user.small_avatar_url -%>" style="height:20px;width:20px;margin:0 5px 5px 0;-ms-interpolation-mode:bicubic;border-radius:50%;clear:both;display:inline-block;outline:0;text-decoration:none;">
<% end %>
<% end %>
</td>
<td style="padding:24px 8px 16px 8px;text-align:left;">
<img src="<%= email_image_url 'heart.png' -%>" style="-ms-interpolation-mode:bicubic;clear:both;display:inline-block;float:left;height:20px;margin:0;max-width:100%;opacity:.4;outline:0;text-decoration:none;width:auto">
<p style="color:#8f8f8f;float:left;line-height:1.3;margin:0 5px 10px 5px;padding:0;text-align:left;font-weight:400;"><%= t.like_count -%></p>
</td>
<td style="padding:24px 16px 16px 8px;text-align:left;">
<img src="<%= email_image_url 'comment.png' -%>" style="-ms-interpolation-mode:bicubic;clear:none;display:inline-block;float:left;height:20px;margin:0;max-width:100%;opacity:.4;outline:0;text-decoration:none;width:auto">
<p style="color:#8f8f8f;float:left;line-height:1.3;margin:0 5px 10px 5px;padding:0;text-align:left;font-weight:400;"><%= t.posts_count - 1 -%></p>
</td>
</tr>
<tr><td colspan="6" height="10px" style="border-collapse:collapse!important;line-height:10px;margin:0;mso-line-height-rule:exactly;padding:0;">&#xA0;</td></tr>
<!-- End new topic -->
<% end %>
</tbody>
</table>
<%= digest_custom_html("below_popular_topics") %>
<% end %>
</td>
<td class="side-spacer" style="width:5%;padding:0;">&nbsp;</td>
</tr>
</table>
<style>
@media only screen {
html {
min-height: 100%;
background: #f3f3f3
}
}
@media only screen and (max-width:900px) {
table.body img {
width: auto;
height: auto
}
table.body center {
min-width: 0!important;
}
table.body .side-spacer {
width: 2.5%!important;
}
table.body .column,
table.body .columns {
height: auto!important;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding-left: 16px!important;
padding-right: 16px!important
}
table.body .column .column,
table.body .column .columns,
table.body .columns .column,
table.body .columns .columns {
padding-left: 0!important;
padding-right: 0!important
}
}
</style>
<%= digest_custom_html("above_footer") %>
<div class='footer'>
@ -92,3 +407,11 @@
</div>
<%= digest_custom_html("below_footer") %>
<!-- prevent Gmail on iOS font size manipulation -->
<div style="display:none;white-space:nowrap;font:15px courier;line-height:0">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</body>
</html>

View File

@ -3,10 +3,16 @@
site_link: site_link,
last_seen_at: @last_seen_at) %>
<%- if @featured_topics.present? %>
### <%=t 'user_notifications.digest.top_topics' %>
<%= @new_topics_count -%> <%=t 'user_notifications.digest.new_topics' %>
<%= @unread_messages -%> <%=t 'user_notifications.digest.unread_messages' %>
<%= @unread_notifications -%> <%=t 'user_notifications.digest.unread_notifications' %>
<%- @featured_topics.each_with_index do |t,i| %>
--------------------------------------------------------------------------------
<%- if @popular_topics.present? %>
### <%=t 'user_notifications.digest.popular_topics' %>
<%- @popular_topics.each_with_index do |t,i| %>
<%= raw(@markdown_linker.create(t.title, t.relative_url)) %>
<%- if t.best_post.present? %>
@ -18,14 +24,26 @@
<%- end %>
<%- end %>
<%= digest_custom_text("above_popular_topics") %>
<%- if @new_topics.present? %>
**<%=t 'user_notifications.digest.other_new_topics' %>**
<%- @new_topics.each do |t| %>
<%- if @popular_posts.present? %>
### <%=t 'user_notifications.digest.popular_posts' %>
<%- @popular_posts.each_with_index do |post,i| %>
<%= post.user.username -%> <%=t 'user_notifications.digest.from_topic_label' -%> <%= raw(@markdown_linker.create(post.topic.title, post.topic.relative_url)) %>
<%= raw(post.excerpt(1000, strip_links: true, text_entities: true, markdown_images: true)) %>
--------------------------------------------------------------------------------
<%- end %>
<%- end %>
<%- if @other_new_for_you.present? %>
**<%=t 'user_notifications.digest.more_new' %>**
<%- @other_new_for_you.each do |t| %>
* <%= raw(@markdown_linker.create(t.title, t.relative_url)) %> - <%= t.posts_count %> - <%- if t.category %>[<%= t.category.name %>]<%- end %>
<%- end -%>
<%- end -%>
<%- end %>
<%= digest_custom_text("below_popular_topics") %>
@ -38,4 +56,4 @@
<%= raw(@markdown_linker.references) %>
<%= digest_custom_text("below_footer") %>
<%= digest_custom_text("below_footer") %>

View File

@ -1,7 +1,7 @@
<div id="top"></div>
<table style='width: 100%; border: 20px solid #eee;' cellspacing='0' cellpadding='0'>
<thead>
<td style='padding: 10px 10px; background-color: #<%= @header_color %>;'>
<td style='padding: 10px 10px; background-color: #<%= @header_bgcolor %>;'>
<a href='<%= Discourse.base_url %>' style='color: #<%= @anchor_color %>'>
<% if logo_url.blank? %>
<%= SiteSetting.title %>

View File

@ -1279,6 +1279,7 @@ en:
default_avatars: "URLs to avatars that will be used by default for new users until they change them."
automatically_download_gravatars: "Download Gravatars for users upon account creation or email change."
digest_topics: "The maximum number of topics to display in the email summary."
digest_posts: "The maximum number of popular posts to display in the email summary."
digest_min_excerpt_length: "Minimum post excerpt in the email summary, in characters."
delete_digest_email_after_days: "Suppress summary emails for users not seen on the site for more than (n) days."
digest_suppress_categories: "Suppress these categories from summary emails."
@ -2427,16 +2428,21 @@ en:
digest:
why: "A brief summary of %{site_link} since your last visit on %{last_seen_at}"
since_last_visit: "Since your last visit"
new_topics: "New Topics"
unread_messages: "Unread Messages"
unread_notifications: "Unread Notifications"
popular_topics: "Popular Topics"
follow_topic: "Follow this topic"
join_the_discussion: "Join the discussion"
popular_posts: "Popular Posts"
from_topic_label: "From"
more_new: "New in topics and categories you follow"
subject_template: "[%{site_name}] Summary"
new_activity: "New activity on your topics and posts:"
top_topics: "Popular posts"
other_new_topics: "Popular topics"
unsubscribe: "This summary is sent from %{site_link} when we haven't seen you in a while. To unsubscribe %{unsubscribe_link}."
click_here: "click here"
from: "%{site_name} summary"
read_more: "Read More"
more_topics: "There were %{new_topics_since_seen} other new topics."
more_topics_category: "More new topics:"
preheader: "A brief summary since your last visit on %{last_seen_at}"
custom:
html:
header: ''

View File

@ -584,7 +584,10 @@ email:
private_email_time_window_seconds: 20
email_posts_context: 5
digest_min_excerpt_length: 100
digest_topics: 20
digest_topics:
default: 5
min: 1
digest_posts: 3
delete_digest_email_after_days: 365
digest_suppress_categories:
type: category_list

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B