Add `header_instructions` overridable translation for email headers.

This commit is contained in:
Robin Ward 2015-12-07 16:52:10 -05:00
parent a3ba564b03
commit b781b6aea3
3 changed files with 25 additions and 0 deletions
app/views/email
config/locales
lib/email

View File

@ -1,5 +1,7 @@
<div id='main' class=<%= classes %>>
<div class='header-instructions'>%{header_instructions}</div>
<%= render partial: 'email/post', locals: { post: post } %>
<% if context_posts.present? %>

View File

@ -1894,6 +1894,7 @@ en:
title: "Unsubscribe"
description: "Not interested in getting these emails? No problem! Click below to unsubscribe instantly:"
header_instructions: ''
reply_by_email: "To respond, reply to this email or [visit the topic](%{base_url}%{url}) in your browser."
visit_link_to_respond: "To respond, [visit the topic](%{base_url}%{url}) in your browser."
@ -1934,6 +1935,8 @@ en:
user_replied:
subject_template: "[%{site_name}] %{topic_title}"
text_body_template: |
%{header_instructions}
%{message}
%{context}
@ -1944,6 +1947,8 @@ en:
user_quoted:
subject_template: "[%{site_name}] %{topic_title}"
text_body_template: |
%{header_instructions}
%{message}
%{context}
@ -1954,6 +1959,8 @@ en:
user_mentioned:
subject_template: "[%{site_name}] %{topic_title}"
text_body_template: |
%{header_instructions}
%{message}
%{context}
@ -1964,6 +1971,8 @@ en:
user_group_mentioned:
subject_template: "[%{site_name}] %{topic_title}"
text_body_template: |
%{header_instructions}
%{message}
%{context}
@ -1974,6 +1983,8 @@ en:
user_posted:
subject_template: "[%{site_name}] %{topic_title}"
text_body_template: |
%{header_instructions}
%{message}
%{context}
@ -1984,6 +1995,8 @@ en:
user_posted_pm:
subject_template: "[%{site_name}] [PM] %{topic_title}"
text_body_template: |
%{header_instructions}
%{message}
%{context}

View File

@ -28,6 +28,8 @@ module Email
}.merge!(@opts)
if @template_args[:url].present?
@template_args[:header_instructions] = I18n.t('user_notifications.header_instructions')
if @opts[:include_respond_instructions] == false
@template_args[:respond_instructions] = ''
else
@ -65,6 +67,14 @@ module Email
html_override.gsub!("%{unsubscribe_link}", "")
end
header_instructions = @template_args[:header_instructions]
if header_instructions.present?
header_instructions = PrettyText.cook(header_instructions).html_safe
html_override.gsub!("%{header_instructions}", header_instructions)
else
html_override.gsub!("%{header_instructions}", "")
end
if response_instructions = @template_args[:respond_instructions]
respond_instructions = PrettyText.cook(response_instructions).html_safe
html_override.gsub!("%{respond_instructions}", respond_instructions)