From f061aee818c51d88359e9b1d4059c5e85be85891 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Wed, 23 Oct 2019 15:41:58 -0400 Subject: [PATCH] FEATURE: support SCSS in custom email style In the CSS tab of Admin > Customize > Email Style, SCSS can now be used. --- .../components/email-styles-editor.js.es6 | 5 ++++ .../components/email-styles-editor.hbs | 2 +- app/models/email_style.rb | 8 +++++ app/services/email_style_updater.rb | 29 ++++++++++++++----- config/site_settings.yml | 3 ++ lib/email/styles.rb | 2 +- spec/integration/email_style_spec.rb | 2 ++ spec/services/email_style_updater_spec.rb | 22 +++++++++++--- 8 files changed, 59 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/admin/components/email-styles-editor.js.es6 b/app/assets/javascripts/admin/components/email-styles-editor.js.es6 index 75811ec41c1..c0b6c732e98 100644 --- a/app/assets/javascripts/admin/components/email-styles-editor.js.es6 +++ b/app/assets/javascripts/admin/components/email-styles-editor.js.es6 @@ -4,6 +4,11 @@ import computed from "ember-addons/ember-computed-decorators"; export default Component.extend({ editorId: Ember.computed.reads("fieldName"), + @computed("fieldName") + currentEditorMode(fieldName) { + return fieldName === "css" ? "scss" : fieldName; + }, + @computed("fieldName", "styles.html", "styles.css") resetDisabled(fieldName) { return ( diff --git a/app/assets/javascripts/admin/templates/components/email-styles-editor.hbs b/app/assets/javascripts/admin/templates/components/email-styles-editor.hbs index 883149644d2..e03feb7cb7b 100644 --- a/app/assets/javascripts/admin/templates/components/email-styles-editor.hbs +++ b/app/assets/javascripts/admin/templates/components/email-styles-editor.hbs @@ -9,7 +9,7 @@ -{{ace-editor content=editorContents mode=fieldName editorId=editorId}} +{{ace-editor content=editorContents mode=currentEditorMode editorId=editorId}}