Ghost/ghost/admin/app/components/modals/edit-newsletter.hbs
Kevin Ansfield 502fcaba3c Added "Opt-in existing subscribers" option to newsletter creation
refs https://github.com/TryGhost/Team/issues/1528

- adds "opt-in existing" toggle to newsletter modal that's only shown when creating a newsletter
  - defaults to true
- updated newsletter save flow to show confirmation before creation
  - alters message to reflect auto-subscribe selection
  - count of existing subscribed members is not implemented as it's not yet supported by the API
- updated newsletter adapter and save flow to use auto opt-in selection
  - when option is checked the save URL is changed to `POST /members/?opt_in_existing=true`
- modified task button component to ignore a task return value of `canceled` so when it's received the buttons returns to the idle state instead of showing a saved or failed state
  - used by save routine when the "Back to edit" button is clicked in the create confirmation modal
2022-04-19 20:01:08 +01:00

46 lines
2.2 KiB
Handlebars

<div class="modal-content">
<div class="modal-body modal-fullsettings">
<div class="modal-fullsettings-body gh-newsletters-labs">
<div class="modal-fullsettings-sidebar">
<div class="flex items-center justify-between">
<h2 class="modal-fullsettings-heading">
{{if @data.newsletter.isNew "Create" "Edit"}} newsletter
</h2>
<div class="gh-btn-group">
<button type="button" class="gh-btn gh-btn-icon {{if (eq this.tab "settings") "gh-btn-group-selected"}}" {{on "click" (fn this.changeTab "settings")}}><span>Settings</span></button>
<button type="button" class="gh-btn gh-btn-icon {{if (eq this.tab "design") "gh-btn-group-selected"}}" {{on "click" (fn this.changeTab "design")}}><span>Design</span></button>
</div>
</div>
{{#if (eq this.tab "settings")}}
<Modals::EditNewsletter::Settings
@newsletter={{@data.newsletter}}
@optInExisting={{this.optInExisting}}
@setOptInExisting={{this.setOptInExisting}}
/>
{{else}}
<Modals::EditNewsletter::Design @newsletter={{@data.newsletter}} />
{{/if}}
</div>
<div class="modal-fullsettings-main">
<div class="modal-fullsettings-main-topbar">
<button class="gh-btn mr3" type="button" {{on "click" @close}}>
<span>Cancel</span>
</button>
<GhTaskButton
@buttonText="Save and close"
@successText="Saved"
@task={{this.saveTask}}
@idleClass="gh-btn-primary"
@class="gh-btn gh-btn-icon"
{{on-key "cmd+s" this.saveViaKeyboard priority=1}}
data-test-button="save-newsletter"
/>
</div>
<Modals::EditNewsletter::Preview @newsletter={{@data.newsletter}} />
</div>
</div>
</div>
</div>