mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-03-14 17:10:54 -04:00
Add a way to show a custom message at the top of all notification emails. Customize it at /admin/site_contents/notification_email_top
This commit is contained in:
parent
d31996eaca
commit
00390ee739
4 changed files with 13 additions and 1 deletions
app
config/locales
|
@ -192,10 +192,12 @@ class UserNotifications < ActionMailer::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
top = SiteContent.content_for(:notification_email_top)
|
||||||
|
|
||||||
html = UserNotificationRenderer.new(Rails.configuration.paths["app/views"]).render(
|
html = UserNotificationRenderer.new(Rails.configuration.paths["app/views"]).render(
|
||||||
template: 'email/notification',
|
template: 'email/notification',
|
||||||
format: :html,
|
format: :html,
|
||||||
locals: { context_posts: context_posts, post: post }
|
locals: { context_posts: context_posts, post: post, top: top ? PrettyText.cook(top).html_safe : nil }
|
||||||
)
|
)
|
||||||
|
|
||||||
template = "user_notifications.user_#{notification_type}"
|
template = "user_notifications.user_#{notification_type}"
|
||||||
|
|
|
@ -24,6 +24,7 @@ class SiteContent < ActiveRecord::Base
|
||||||
add_content_type :top, allow_blank: true, format: :html
|
add_content_type :top, allow_blank: true, format: :html
|
||||||
add_content_type :bottom, allow_blank: true, format: :html
|
add_content_type :bottom, allow_blank: true, format: :html
|
||||||
add_content_type :head, allow_blank: true, format: :html
|
add_content_type :head, allow_blank: true, format: :html
|
||||||
|
add_content_type :notification_email_top, allow_blank: true, format: :markdown
|
||||||
|
|
||||||
def site_content_type
|
def site_content_type
|
||||||
@site_content_type ||= SiteContent.content_types.find {|t| t.content_type == content_type.to_sym}
|
@site_content_type ||= SiteContent.content_types.find {|t| t.content_type == content_type.to_sym}
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
<div id='main'>
|
<div id='main'>
|
||||||
|
|
||||||
|
<% if top.present? %>
|
||||||
|
<div><%= top %></div>
|
||||||
|
<hr>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= render :partial => 'email/post', :locals => {:post => post} %>
|
<%= render :partial => 'email/post', :locals => {:post => post} %>
|
||||||
|
|
||||||
<% if context_posts.present? %>
|
<% if context_posts.present? %>
|
||||||
|
|
|
@ -578,6 +578,9 @@ en:
|
||||||
tos_signup_form_message:
|
tos_signup_form_message:
|
||||||
title: "Signup Form: Terms of Service Message"
|
title: "Signup Form: Terms of Service Message"
|
||||||
description: "The message that will appear beside a checkbox on the signup form if the tos_accept_required site setting is enabled."
|
description: "The message that will appear beside a checkbox on the signup form if the tos_accept_required site setting is enabled."
|
||||||
|
notification_email_top:
|
||||||
|
title: "Notification Email Top"
|
||||||
|
description: "A message that will be displayed at the top of all notification emails."
|
||||||
|
|
||||||
site_settings:
|
site_settings:
|
||||||
default_locale: "The default language of this Discourse instance (ISO 639-1 Code)"
|
default_locale: "The default language of this Discourse instance (ISO 639-1 Code)"
|
||||||
|
|
Loading…
Reference in a new issue