diff --git a/ghost/admin/app/components/modals/edit-newsletter.hbs b/ghost/admin/app/components/modals/edit-newsletter.hbs new file mode 100644 index 0000000000..2053db99b3 --- /dev/null +++ b/ghost/admin/app/components/modals/edit-newsletter.hbs @@ -0,0 +1,43 @@ +
\ No newline at end of file diff --git a/ghost/admin/app/components/modals/edit-newsletter.js b/ghost/admin/app/components/modals/edit-newsletter.js new file mode 100644 index 0000000000..0a058ad24e --- /dev/null +++ b/ghost/admin/app/components/modals/edit-newsletter.js @@ -0,0 +1,48 @@ +import Component from '@glimmer/component'; +import {action} from '@ember/object'; +import {task} from 'ember-concurrency'; +import {tracked} from '@glimmer/tracking'; + +export default class EditNewsletterModal extends Component { + static modalOptions = { + className: 'fullscreen-modal-full-overlay fullscreen-modal-portal-settings' + }; + + @tracked tab = 'settings'; + + willDestroy() { + super.willDestroy(...arguments); + this.args.data.newsletter.rollbackAttributes(); + } + + @action + changeTab(tab) { + this.tab = tab; + } + + @action + saveViaKeyboard(event, responder) { + responder.stopPropagation(); + event.preventDefault(); + + this.saveTask.perform(); + } + + @task + *saveTask() { + try { + const result = yield this.args.data.newsletter.save(); + + this.args.data.afterSave?.(result); + + return result; + } catch (e) { + if (e === undefined) { + // validation error + return false; + } + + throw e; + } + } +} diff --git a/ghost/admin/app/components/modals/edit-newsletter/design.hbs b/ghost/admin/app/components/modals/edit-newsletter/design.hbs new file mode 100644 index 0000000000..f6778bdf42 --- /dev/null +++ b/ghost/admin/app/components/modals/edit-newsletter/design.hbs @@ -0,0 +1,166 @@ ++ {{or @newsletter.senderName this.config.blogTitle}} <{{full-email-address (or @newsletter.senderEmail this.settings.membersFromAddress)}}> +
+To: Jamie Larson <jamie@example.com>
+