Show post count in digest emails. Sort by score
This commit is contained in:
parent
78b2c5acff
commit
781a8876d3
|
@ -44,6 +44,10 @@ class UserNotifications < ActionMailer::Base
|
|||
# Don't send email unless there is content in it
|
||||
if @featured_topics.present?
|
||||
@featured_topics, @new_topics = @featured_topics[0..4], @featured_topics[5..-1]
|
||||
|
||||
# Sort the new topics by score
|
||||
@new_topics.sort! {|a, b| b.score - a.score } if @new_topics.present?
|
||||
|
||||
@markdown_linker = MarkdownLinker.new(Discourse.base_url)
|
||||
|
||||
build_email user.email,
|
||||
|
|
|
@ -31,7 +31,13 @@
|
|||
|
||||
<%- @new_topics.each do |t| %>
|
||||
<ul>
|
||||
<li><%= link_to t.title, t.relative_url %> <%- if t.category %>[<%= t.category.name %>]<%- end %></li>
|
||||
<li>
|
||||
<%= link_to t.title, t.relative_url %>
|
||||
|
||||
<span class='post-count'><%= t('user_notifications.digest.posts', count: t.posts_count) %></span>
|
||||
|
||||
<%- if t.category %><span style='background-color: #<%= t.category.color %>; color: #<%= t.category.text_color %>; font-size: 12px; padding: 4px 6px; font-weight: bold'><%= t.category.name %></span><%- end %>
|
||||
</li>
|
||||
</ul>
|
||||
<%- end -%>
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
**<%=t 'user_notifications.digest.other_new_topics' %>**
|
||||
|
||||
<%- @new_topics.each do |t| %>
|
||||
* <%= raw(@markdown_linker.create(t.title, t.relative_url)) %> <%- if t.category %>[<%= t.category.name %>]<%- end %>
|
||||
* <%= raw(@markdown_linker.create(t.title, t.relative_url)) %> - <%= t('user_notifications.digest.posts', count: t.posts_count) %> - <%- if t.category %>[<%= t.category.name %>]<%- end %>
|
||||
<%- end -%>
|
||||
|
||||
<%- end -%>
|
||||
|
|
|
@ -79,7 +79,7 @@ en:
|
|||
|
||||
education:
|
||||
until_posts:
|
||||
one: "post"
|
||||
one: "1 post"
|
||||
other: "%{count} posts"
|
||||
|
||||
'new-topic': |
|
||||
|
@ -1117,6 +1117,10 @@ en:
|
|||
from: "%{site_name} digest"
|
||||
read_more: "Read More"
|
||||
|
||||
posts:
|
||||
one: "1 post"
|
||||
other: "%{count} posts"
|
||||
|
||||
forgot_password:
|
||||
subject_template: "[%{site_name}] Password reset"
|
||||
text_body_template: |
|
||||
|
|
|
@ -60,6 +60,7 @@ module Email
|
|||
style('div.digest-post h1', 'font-size: 20px;')
|
||||
style('span.footer-notice', 'color:#666; font-size:80%')
|
||||
|
||||
style('span.post-count', 'margin: 0 5px; color: #777;')
|
||||
style('pre', 'white-space: pre-wrap')
|
||||
style('code', 'background-color: f1f1ff; padding: 2px 5px;')
|
||||
style('pre code', 'display: block; background-color: f1f1ff; padding: 5px')
|
||||
|
|
Loading…
Reference in New Issue