mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: custom html and text can be added to summary emails
This commit is contained in:
parent
4f68fd970d
commit
2f68be2c5c
@ -70,4 +70,16 @@ module UserNotificationsHelper
|
|||||||
PrettyText.format_for_email(html, post).html_safe
|
PrettyText.format_for_email(html, post).html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def digest_custom_html(position_key)
|
||||||
|
digest_custom "user_notifications.digest.custom.html.#{position_key}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def digest_custom_text(position_key)
|
||||||
|
digest_custom "user_notifications.digest.custom.text.#{position_key}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def digest_custom(i18n_key)
|
||||||
|
PrettyText.format_for_email(I18n.t(i18n_key)).html_safe
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
<table style="border: 20px solid #eee;" cellspacing="0" cellpadding="0">
|
<table style="border: 20px solid #eee;" cellspacing="0" cellpadding="0">
|
||||||
<tr>
|
<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>
|
||||||
|
<%- else %>
|
||||||
<td style="padding: 10px 10px; background-color: #<%= @header_color %>;">
|
<td style="padding: 10px 10px; background-color: #<%= @header_color %>;">
|
||||||
<a href="<%= Discourse.base_url %>" style='color: #<%= @anchor_color %>'>
|
<a href="<%= Discourse.base_url %>" style='color: #<%= @anchor_color %>'>
|
||||||
<%- if logo_url.blank? %>
|
<%- if logo_url.blank? %>
|
||||||
@ -9,6 +14,7 @@
|
|||||||
<%- end %>
|
<%- end %>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<%- end %>
|
||||||
</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;">
|
||||||
@ -32,11 +38,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
|
|
||||||
|
<%= digest_custom_html("below_post_#{i+1}") %>
|
||||||
|
|
||||||
<%- if i < @featured_topics.size - 1 %><% end %>
|
<%- if i < @featured_topics.size - 1 %><% end %>
|
||||||
|
|
||||||
<%- end %>
|
<%- end %>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
|
|
||||||
|
<%= digest_custom_html("above_popular_topics") %>
|
||||||
|
|
||||||
<%- if @new_topics.present? %>
|
<%- if @new_topics.present? %>
|
||||||
<hr/>
|
<hr/>
|
||||||
<h3><%=t 'user_notifications.digest.other_new_topics' %></h3>
|
<h3><%=t 'user_notifications.digest.other_new_topics' %></h3>
|
||||||
@ -53,6 +63,8 @@
|
|||||||
|
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
|
||||||
|
<%= digest_custom_html("below_popular_topics") %>
|
||||||
|
|
||||||
<%- if @new_topics_since_seen > 0 %>
|
<%- if @new_topics_since_seen > 0 %>
|
||||||
<%- if @new_by_category.present? %>
|
<%- 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>
|
<p><%= t('user_notifications.digest.more_topics_category', last_seen_at: @last_seen_at, new_topics_since_seen: @new_topics_since_seen) %></p>
|
||||||
@ -71,8 +83,12 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<%= digest_custom_html("above_footer") %>
|
||||||
|
|
||||||
<div class='footer'>
|
<div class='footer'>
|
||||||
<%=raw(t 'user_notifications.digest.unsubscribe',
|
<%=raw(t 'user_notifications.digest.unsubscribe',
|
||||||
site_link: html_site_link(@anchor_color),
|
site_link: html_site_link(@anchor_color),
|
||||||
unsubscribe_link: link_to(t('user_notifications.digest.click_here'), email_unsubscribe_url(host: Discourse.base_url_no_prefix, key: @unsubscribe_key), {:style=>"color: ##{@anchor_color}"})) %>
|
unsubscribe_link: link_to(t('user_notifications.digest.click_here'), email_unsubscribe_url(host: Discourse.base_url_no_prefix, key: @unsubscribe_key), {:style=>"color: ##{@anchor_color}"})) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<%= digest_custom_html("below_footer") %>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<%- if @featured_topics.present? %>
|
<%- if @featured_topics.present? %>
|
||||||
### <%=t 'user_notifications.digest.top_topics' %>
|
### <%=t 'user_notifications.digest.top_topics' %>
|
||||||
|
|
||||||
<%- @featured_topics.each do |t| %>
|
<%- @featured_topics.each_with_index do |t,i| %>
|
||||||
<%= raw(@markdown_linker.create(t.title, t.relative_url)) %>
|
<%= raw(@markdown_linker.create(t.title, t.relative_url)) %>
|
||||||
|
|
||||||
<%- if t.best_post.present? %>
|
<%- if t.best_post.present? %>
|
||||||
@ -14,10 +14,10 @@
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
<%- end %>
|
<%- end %>
|
||||||
|
<%= digest_custom_text("below_post_#{i+1}") %>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
|
<%= digest_custom_text("above_popular_topics") %>
|
||||||
<%- if @new_topics.present? %>
|
<%- if @new_topics.present? %>
|
||||||
**<%=t 'user_notifications.digest.other_new_topics' %>**
|
**<%=t 'user_notifications.digest.other_new_topics' %>**
|
||||||
|
|
||||||
@ -27,12 +27,15 @@
|
|||||||
|
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
|
||||||
|
<%= digest_custom_text("below_popular_topics") %>
|
||||||
|
|
||||||
<%= raw(@markdown_linker.references) %>
|
<%= raw(@markdown_linker.references) %>
|
||||||
|
|
||||||
|
<%= digest_custom_text("above_footer") %>
|
||||||
<%=raw(t :'user_notifications.digest.unsubscribe',
|
<%=raw(t :'user_notifications.digest.unsubscribe',
|
||||||
site_link: site_link,
|
site_link: site_link,
|
||||||
unsubscribe_link: raw(@markdown_linker.create(t('user_notifications.digest.click_here'), email_unsubscribe_url(key: @unsubscribe_key, only_path: true)))) %>
|
unsubscribe_link: raw(@markdown_linker.create(t('user_notifications.digest.click_here'), email_unsubscribe_url(key: @unsubscribe_key, only_path: true)))) %>
|
||||||
|
|
||||||
<%= raw(@markdown_linker.references) %>
|
<%= raw(@markdown_linker.references) %>
|
||||||
|
|
||||||
|
<%= digest_custom_text("below_footer") %>
|
@ -2412,6 +2412,28 @@ en:
|
|||||||
read_more: "Read More"
|
read_more: "Read More"
|
||||||
more_topics: "There were %{new_topics_since_seen} other new topics."
|
more_topics: "There were %{new_topics_since_seen} other new topics."
|
||||||
more_topics_category: "More new topics:"
|
more_topics_category: "More new topics:"
|
||||||
|
custom:
|
||||||
|
html:
|
||||||
|
header: ''
|
||||||
|
below_post_1: ''
|
||||||
|
below_post_2: ''
|
||||||
|
below_post_3: ''
|
||||||
|
below_post_4: ''
|
||||||
|
below_post_5: ''
|
||||||
|
above_popular_topics: ''
|
||||||
|
below_popular_topics: ''
|
||||||
|
above_footer: ''
|
||||||
|
below_footer: ''
|
||||||
|
text:
|
||||||
|
below_post_1: ''
|
||||||
|
below_post_2: ''
|
||||||
|
below_post_3: ''
|
||||||
|
below_post_4: ''
|
||||||
|
below_post_5: ''
|
||||||
|
above_popular_topics: ''
|
||||||
|
below_popular_topics: ''
|
||||||
|
above_footer: ''
|
||||||
|
below_footer: ''
|
||||||
|
|
||||||
mailing_list:
|
mailing_list:
|
||||||
why: "All activity on %{site_link} for %{date}"
|
why: "All activity on %{site_link} for %{date}"
|
||||||
|
Loading…
Reference in New Issue
Block a user