Ghost/ghost/admin/app/templates/components/gh-publishmenu.hbs
Aileen Nowak cee320bb58 🐛 Reset publish date in PSM when leaving menu (#708)
closes TryGhost/Ghost#8360
- when changing the publish time of an already scheduled post in the publish menu and leaving the menu with clicking outside of the menu, the time wouldn't reset properly and be shown in the PSM. With the usage of an `isClosing` property which is passed to the underlying `gh-publishmenu-scheduling` component, we prevent the changed time from being saved and reset it properly instead.
2017-05-23 14:30:00 +01:00

41 lines
1.5 KiB
Handlebars

{{#basic-dropdown verticalPosition="below" onOpen=(action "open") onClose=(action "close") as |dd|}}
{{#dd.trigger class="gh-btn gh-btn-outline gh-publishmenu-trigger"}}
<span data-test-publishmenu-trigger>{{triggerText}} {{inline-svg "arrow-down"}}</span>
{{/dd.trigger}}
{{#dd.content class="gh-publishmenu-dropdown"}}
{{#if (eq postState "published")}}
{{gh-publishmenu-published
saveType=saveType
setSaveType=(action "setSaveType")}}
{{else if (eq postState "scheduled")}}
{{gh-publishmenu-scheduled
post=post
saveType=saveType
isClosing=isClosing
setSaveType=(action "setSaveType")}}
{{else}}
{{gh-publishmenu-draft
post=post
saveType=saveType
setSaveType=(action "setSaveType")}}
{{/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 gh-btn-link" {{action dd.actions.close}} data-test-publishmenu-cancel>
<span>Cancel</span>
</button>
{{gh-task-button buttonText
task=save
class="gh-btn gh-btn-blue gh-publishmenu-button gh-btn-icon"
data-test-publishmenu-save=true}}
</footer>
{{/dd.content}}
{{/basic-dropdown}}