mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 22:02:11 +03:00
e5c26aac89
closes https://github.com/TryGhost/Team/issues/1479 - updated post adapter to append `?newsletter_id=xyz` when passed a `newsletterId` adapterOption - updated editor save task to pass `options.newsletterId` through as `adapterOptions.newsletterId` - set up `post.newsletter` relationship ready for handling embedded newsletter association from the API - explicitly deleted when serializing back to the API as it doesn't yet ignore the attribute - updated `<GhPublishmenu>` for newsletter support - fetches newsletters on first render so they are available in the dropdown - sets "default" (first in the ordered list) newsletter as the initially selected newsletter - adds newsletter dropdown to draft publish menu - passes `newsletterId` option to editor save task when it's set This is a minimal implementation for testing. Not included: - correct free/paid member counts based on selected newsletter - correct member count in confirmation modal - indication of selected newsletter for scheduled post
77 lines
3.7 KiB
Handlebars
77 lines
3.7 KiB
Handlebars
{{#if (eq this.displayState "sent")}}
|
|
<div class="gh-btn gh-btn-text sent">Sent</div>
|
|
{{else}}
|
|
<GhBasicDropdown @verticalPosition="below" @horizontalPosition="right" @onOpen={{action "open"}} @onClose={{action "close"}} as |dd|>
|
|
<dd.Trigger class="gh-btn gh-btn-editor {{if (or (eq this.displayState "published") (eq this.displayState "scheduled") (eq this.uiContext "preview")) "green"}} gh-publishmenu-trigger">
|
|
<span data-test-publishmenu-trigger>{{this.triggerText}} {{svg-jar "arrow-down"}}</span>
|
|
</dd.Trigger>
|
|
|
|
<dd.Content class="gh-publishmenu-dropdown">
|
|
{{#if (eq this.displayState "published")}}
|
|
<GhPublishmenuPublished
|
|
@post={{this.post}}
|
|
@saveType={{this.saveType}}
|
|
@setSaveType={{action "setSaveType"}}
|
|
data-test-publishmenu-published="true" />
|
|
|
|
{{else if (eq this.displayState "scheduled")}}
|
|
<GhPublishmenuScheduled
|
|
@post={{this.post}}
|
|
@saveType={{this.saveType}}
|
|
@emailOnly={{this.emailOnly}}
|
|
@isClosing={{this.isClosing}}
|
|
@canSendEmail={{this.canSendEmail}}
|
|
@recipientsFilter={{this.sendEmailWhenPublished}}
|
|
@setSaveType={{action "setSaveType"}}
|
|
@setTypedDateError={{action (mut this.typedDateError)}}
|
|
@isSendingEmailLimited={{this.isSendingEmailLimited}}
|
|
@sendingEmailLimitError={{this.sendingEmailLimitError}}
|
|
data-test-publishmenu-scheduled="true" />
|
|
|
|
{{else}}
|
|
<GhPublishmenuDraft
|
|
@post={{this.post}}
|
|
@saveType={{this.saveType}}
|
|
@setSaveType={{action "setSaveType"}}
|
|
@setTypedDateError={{action (mut this.typedDateError)}}
|
|
@canSendEmail={{this.canSendEmail}}
|
|
@emailOnly={{this.emailOnly}}
|
|
@recipientsFilter={{this.sendEmailWhenPublished}}
|
|
@setSendEmailWhenPublished={{action "setSendEmailWhenPublished"}}
|
|
@isSendingEmailLimited={{this.isSendingEmailLimited}}
|
|
@sendingEmailLimitError={{this.sendingEmailLimitError}}
|
|
@distributionAction={{this.distributionAction}}
|
|
@setDistributionAction={{action "setDistributionAction"}}
|
|
@availableNewsletters={{this.availableNewsletters}}
|
|
@selectedNewsletter={{this.selectedNewsletter}}
|
|
@selectNewsletter={{this.selectNewsletter}}
|
|
data-test-publishmenu-draft="true" />
|
|
{{/if}}
|
|
|
|
{{!--
|
|
save button needs to be outside of menu components so it doesn't lose state
|
|
or cancel the task when the post status updates and switches components
|
|
--}}
|
|
<footer class="gh-publishmenu-footer">
|
|
<button class="gh-btn gh-btn-outline" data-test-publishmenu-cancel type="button" {{on "click" (action dd.actions.close)}}>
|
|
<span>Cancel</span>
|
|
</button>
|
|
<GhTaskButton
|
|
@buttonText={{this.buttonText}}
|
|
@task={{this.save}}
|
|
@taskArgs={{hash dropdown=dd}}
|
|
@successText={{this.successText}}
|
|
@runningText={{this.runningText}}
|
|
@class="gh-btn gh-btn-black gh-publishmenu-button gh-btn-icon"
|
|
data-test-publishmenu-save="true"
|
|
/>
|
|
</footer>
|
|
</dd.Content>
|
|
</GhBasicDropdown>
|
|
{{/if}}
|
|
|
|
{{!--
|
|
Workaround to have an always-shown element to attach key handlers to.
|
|
TODO: Move onto main element once converted to a glimmer component
|
|
--}}
|
|
<div class="hidden" {{on-key "cmd+shift+p" (action "publishFromShortcut")}}></div> |