Ghost/ghost/admin/app/components/editor/modals/publish-flow/options.hbs
Kevin Ansfield ed235b374d Increased publish flow acceptance tests
refs https://github.com/TryGhost/Team/issues/1586

- updated `?newsletter_id=id` handling in posts API mock to match the real `?newsletter=slug` behaviour
- added additional publish flow acceptance tests for single/multiple newsletter behaviour, scheduling, and sending
2022-05-31 22:59:20 +01:00

144 lines
6.4 KiB
Handlebars

<div class="gh-publish-title" data-test-publish-flow="options">
<div class="green">Ready, set, publish.</div>
<div>Share it with the world.</div>
</div>
<div class="gh-publish-settings">
<div class="gh-publish-setting" data-test-setting="publish-type">
{{#if @publishOptions.emailUnavailable}}
<div class="gh-publish-setting-title" data-test-setting-title>
{{svg-jar "send-email"}}
<div class="gh-publish-setting-trigger">Publish on site</div>
</div>
{{else}}
<button type="button" class="gh-publish-setting-title" {{on "click" (fn this.toggleSection "publishType")}} data-test-setting-title>
{{svg-jar "send-email"}}
<div class="gh-publish-setting-trigger">
<span>{{@publishOptions.selectedPublishTypeOption.display}}</span>
</div>
<span class="{{if (eq this.openSection "publishType") "expanded"}}">
{{svg-jar "arrow-down" class="icon-expand"}}
</span>
</button>
{{/if}}
{{#liquid-if (eq this.openSection "publishType")}}
<div class="gh-publish-setting-form">
<Editor::PublishOptions::PublishType
@publishOptions={{@publishOptions}}
/>
</div>
{{/liquid-if}}
</div>
{{#unless @publishOptions.emailUnavailable}}
<div class="gh-publish-setting" data-test-setting="email-recipients">
{{#if (not-eq @publishOptions.publishType "publish")}}
<button
type="button"
class="gh-publish-setting-title"
{{on "click" (fn this.toggleSection "emailRecipients")}}
data-test-setting-title
>
{{svg-jar "member"}}
<div class="gh-publish-setting-trigger">
{{#if @publishOptions.recipientFilter}}
{{#let (members-count-fetcher query=(hash filter=@publishOptions.fullRecipientFilter)) as |countFetcher|}}
{{#if (or (gt countFetcher.count 1) (is-empty countFetcher.count))}}
{{if (eq @recipientType "all") "All"}}
{{/if}}
{{format-number countFetcher.count}}
{{!-- @recipientType = all/free/paid/all/specific --}}
{{#if (not-eq @recipientType "all")}}
{{if (is-empty countFetcher.count) (capitalize @recipientType) @recipientType}}
{{/if}}
{{gh-pluralize countFetcher.count "subscriber" without-count=true}}
{{#unless @publishOptions.onlyDefaultNewsletter}}
of <span class="gh-selected-newsletter">{{@publishOptions.newsletter.name}}</span>
{{/unless}}
{{/let}}
{{else}}
Not sent as newsletter
{{/if}}
</div>
<span class="{{if (eq this.openSection "emailRecipients") "expanded"}}">
{{svg-jar "arrow-down" class="icon-expand"}}
</span>
</button>
{{else}}
<button
type="button"
class="gh-publish-setting-title disabled"
data-test-setting-title
>
{{svg-jar "member"}}
<div class="gh-publish-setting-trigger">
Not sent as newsletter
</div>
<span>
{{svg-jar "arrow-down" class="icon-expand"}}
</span>
</button>
{{/if}}
{{#liquid-if (eq this.openSection "emailRecipients")}}
<div class="gh-publish-setting-form">
<Editor::PublishOptions::EmailRecipients
@publishOptions={{@publishOptions}}
/>
</div>
{{/liquid-if}}
</div>
{{/unless}}
{{#if (and @publishOptions.post.email (not @publishOptions.emailDisabledInSettings))}}
<div class="gh-publish-setting" data-test-setting="email-recipients">
<div class="gh-publish-setting-title disabled" data-test-setting-title>
{{svg-jar "member"}}
<div class="gh-publish-setting-trigger">
Already sent to
{{@publishOptions.post.email.emailCount}}
{{if (not-eq @recipientType "all") @recipientType}} {{!-- free/paid/specific --}}
{{gh-pluralize @publishOptions.post.email.emailCount "subscriber" without-count=true}}
{{#unless @publishOptions.onlyDefaultNewsletter}}
of {{@publishOptions.post.newsletter.name}}
{{/unless}}
</div>
</div>
</div>
{{/if}}
<div class="gh-publish-setting last" data-test-setting="publish-at">
<button type="button" class="gh-publish-setting-title" {{on "click" (fn this.toggleSection "publishAt")}} data-test-setting-title>
{{svg-jar "clock"}}
<div class="gh-publish-setting-trigger">
<span>
{{#if @publishOptions.isScheduled}}
{{capitalize (gh-format-post-time @publishOptions.scheduledAtUTC draft=true)}}
{{else}}
Right now
{{/if}}
</span>
</div>
<span class="{{if (eq this.openSection "publishAt") "expanded"}}">
{{svg-jar "arrow-down" class="icon-expand"}}
</span>
</button>
{{#liquid-if (eq this.openSection "publishAt")}}
<div class="gh-publish-setting-form last">
<Editor::PublishOptions::PublishAt
@publishOptions={{@publishOptions}}
/>
</div>
{{/liquid-if}}
</div>
</div>
<div class="gh-publish-cta">
<button type="button" class="gh-btn gh-btn-black gh-btn-large" {{on "click" @confirm}} data-test-button="continue">
<span>Continue, final review &rarr;</span>
</button>
</div>