FIX: if the email template has multiple subjects, link to customize text page

This commit is contained in:
Arpit Jalan 2015-11-28 11:16:13 +05:30
parent 222fd00724
commit 86374c90de
4 changed files with 21 additions and 4 deletions

View file

@ -4,6 +4,15 @@ import { bufferedProperty } from 'discourse/mixins/buffered-content';
export default Ember.Controller.extend(bufferedProperty('emailTemplate'), {
saved: false,
hasMultipleSubjects: function() {
const buffered = this.get('buffered');
if (buffered.getProperties('subject')['subject']) {
return false;
} else {
return buffered.getProperties('id')['id'];
}
}.property("buffered"),
actions: {
saveChanges() {
const buffered = this.get('buffered');

View file

@ -1,8 +1,11 @@
<div class='email-template'>
<label>
{{i18n "admin.customize.email_templates.subject"}}
<label>{{i18n "admin.customize.email_templates.subject"}}</label>
{{#if hasMultipleSubjects}}
<h3>{{#link-to 'adminSiteText' (query-params q=hasMultipleSubjects)}}{{i18n "admin.customize.email_templates.multiple_subjects"}}{{/link-to}}</h3>
{{else}}
{{input value=buffered.subject}}
</label>
{{/if}}
<br>
<label>{{i18n "admin.customize.email_templates.body"}}</label>
{{d-editor value=buffered.body}}

View file

@ -10,7 +10,11 @@ class AdminEmailTemplateSerializer < ApplicationSerializer
end
def subject
@subject ||= I18n.t("#{object}.subject_template")
if I18n.exists?("#{object}.subject_template.other")
@subject = nil
else
@subject ||= I18n.t("#{object}.subject_template")
end
end
def body

View file

@ -2093,6 +2093,7 @@ en:
email_templates:
title: "Email Templates"
subject: "Subject"
multiple_subjects: "This email template has multiple subjects."
body: "Body"
none_selected: "Select an email template to begin editing."
revert: "Revert Changes"