From e322709f950f106b1f070dea492938c66c276cf0 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Mon, 21 Jun 2021 13:40:54 +0100 Subject: [PATCH] Updated newsletter design settings modal for new settings (#2013) refs https://github.com/TryGhost/Team/issues/793 requires https://github.com/TryGhost/Ghost/pull/13074 - replaced main email design settings modal component with labs component and removed conditional - removed `labs-newsletter-settings` class and cleaned up CSS --- .../modal-email-design-settings-labs.js | 93 ------- .../modal-email-design-settings.hbs | 237 ++++++++++++------ .../components/modal-email-design-settings.js | 90 ++++--- ghost/admin/app/styles/components/modals.css | 76 ++---- ghost/admin/app/styles/layouts/members.css | 33 ++- .../app/templates/settings/members-email.hbs | 12 +- 6 files changed, 245 insertions(+), 296 deletions(-) delete mode 100644 ghost/admin/app/components/modal-email-design-settings-labs.js diff --git a/ghost/admin/app/components/modal-email-design-settings-labs.js b/ghost/admin/app/components/modal-email-design-settings-labs.js deleted file mode 100644 index 4d59597c54..0000000000 --- a/ghost/admin/app/components/modal-email-design-settings-labs.js +++ /dev/null @@ -1,93 +0,0 @@ -import ModalComponent from 'ghost-admin/components/modal-base'; -import moment from 'moment'; -// TODO: expose this via a helper -import {IMAGE_EXTENSIONS} from 'ghost-admin/components/gh-image-uploader'; -import {action} from '@ember/object'; -import {htmlSafe} from '@ember/template'; -import {inject as service} from '@ember/service'; -import {task} from 'ember-concurrency-decorators'; -import {tracked} from '@glimmer/tracking'; - -export default class ModalEmailDesignSettings extends ModalComponent { - @service config; - @service ghostPaths; - @service session; - @service settings; - - @tracked headerImage = this.settings.get('newsletterHeaderImage'); - @tracked showHeaderIcon = this.settings.get('newsletterShowHeaderIcon'); - @tracked showHeaderTitle = this.settings.get('newsletterShowHeaderTitle'); - @tracked titleFontCategory = this.settings.get('newsletterTitleFontCategory'); - @tracked titleAlignment = this.settings.get('newsletterTitleAlignment'); - @tracked showFeatureImage = this.settings.get('newsletterShowFeatureImage'); - @tracked bodyFontCategory = this.settings.get('newsletterBodyFontCategory'); - @tracked footerContent = this.settings.get('newsletterFooterContent'); - @tracked showBadge = this.settings.get('newsletterShowBadge'); - - currentDate = moment().format('D MMM YYYY'); - copyrightYear = new Date().getFullYear(); - imageExtensions = IMAGE_EXTENSIONS; - - get showHeader() { - return (this.showHeaderIcon && this.settings.get('icon')) || this.showHeaderTitle; - } - - get featureImageUrl() { - // keep path separate so asset rewriting correctly picks it up - let imagePath = '/img/user-cover.png'; - let fullPath = this.ghostPaths.assetRoot.replace(/\/$/, '') + imagePath; - return fullPath; - } - - get featureImageStyle() { - return htmlSafe(`background-image: url(${this.featureImageUrl})`); - } - - @action - toggleSetting(setting, event) { - this[setting] = event.target.checked; - } - - @action - changeSetting(setting, value) { - this[setting] = value; - } - - @action - imageUploaded(setting, images) { - if (images[0]) { - this[setting] = images[0].url; - } - } - - @action - handleInputFocus() { - this._removeShortcuts(); - } - - @action - handleInputBlur() { - this._setupShortcuts(); - } - - @action - confirm() { - this.saveSettings.perform(); - } - - @task({drop: true}) - *saveSettings() { - this.settings.set('newsletterHeaderImage', this.headerImage); - this.settings.set('newsletterShowHeaderIcon', this.showHeaderIcon); - this.settings.set('newsletterShowHeaderTitle', this.showHeaderTitle); - this.settings.set('newsletterTitleFontCategory', this.titleFontCategory); - this.settings.set('newsletterTitleAlignment', this.titleAlignment); - this.settings.set('newsletterShowFeatureImage', this.showFeatureImage); - this.settings.set('newsletterBodyFontCategory', this.bodyFontCategory); - this.settings.set('newsletterFooterContent', this.footerContent); - this.settings.set('newsletterShowBadge', this.showBadge); - - yield this.settings.save(); - this.closeModal(); - } -} diff --git a/ghost/admin/app/components/modal-email-design-settings.hbs b/ghost/admin/app/components/modal-email-design-settings.hbs index 99d65d2f7d..5b7e1b2cd9 100644 --- a/ghost/admin/app/components/modal-email-design-settings.hbs +++ b/ghost/admin/app/components/modal-email-design-settings.hbs @@ -1,23 +1,135 @@