Ghost/ghost/admin/app/components/modal-email-design-settings.js
Peter Zimon 94581a87f8 Added newsletter customisation options (#1756)
no-issue

This adds three initial customisation options for newsletters:
  1. Show/Hide site title and logo
  2. Set font to serif/sans serif
  3. Display a publish with Ghost badge

This is the first step in allowing customisation of the look and feel of newsletters.

Co-authored-by: Rish <zrishabhgarg@gmail.com>
Co-authored-by: Peter Zimon <zimo@ghost.org>
2020-11-12 14:45:22 +00:00

48 lines
1.1 KiB
JavaScript

import ModalComponent from 'ghost-admin/components/modal-base';
import {inject as service} from '@ember/service';
import {task} from 'ember-concurrency';
export default ModalComponent.extend({
settings: service(),
showHeader: true,
showSansSerif: false,
showBadge: true,
footerText: '',
init() {
this._super(...arguments);
},
actions: {
toggleShowHeader(showHeader) {
this.settings.set('newsletterShowHeader', showHeader);
},
setTypography(typography) {
if (typography === 'serif') {
this.settings.set('newsletterBodyFontCategory', 'serif');
} else {
this.settings.set('newsletterBodyFontCategory', 'sans_serif');
}
},
toggleBadge(showBadge) {
this.settings.set('newsletterShowBadge', showBadge);
},
confirm() {
return this.saveTask.perform();
},
leaveSettings() {
this.closeModal();
}
},
saveTask: task(function* () {
yield this.settings.save();
this.closeModal();
}).drop()
});