From 86374c90de9535bcc306ff1eda17794c1b08070b Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Sat, 28 Nov 2015 11:16:13 +0530 Subject: [PATCH] FIX: if the email template has multiple subjects, link to customize text page --- .../admin-customize-email-templates-edit.js.es6 | 9 +++++++++ .../admin/templates/customize-email-templates-edit.hbs | 9 ++++++--- app/serializers/admin_email_template_serializer.rb | 6 +++++- config/locales/client.en.yml | 1 + 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js.es6 index 5e787b6bb..1c8eb6b08 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js.es6 @@ -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'); diff --git a/app/assets/javascripts/admin/templates/customize-email-templates-edit.hbs b/app/assets/javascripts/admin/templates/customize-email-templates-edit.hbs index 78b0d34fe..c23e3caef 100644 --- a/app/assets/javascripts/admin/templates/customize-email-templates-edit.hbs +++ b/app/assets/javascripts/admin/templates/customize-email-templates-edit.hbs @@ -1,8 +1,11 @@
- + {{/if}} +
{{d-editor value=buffered.body}} diff --git a/app/serializers/admin_email_template_serializer.rb b/app/serializers/admin_email_template_serializer.rb index 9ac8838b3..05779d3e2 100644 --- a/app/serializers/admin_email_template_serializer.rb +++ b/app/serializers/admin_email_template_serializer.rb @@ -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 diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index ad9788265..b5fb157b4 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -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"