Ghost/ghost/admin/app/components/editor/publish-buttons.hbs
Kevin Ansfield e1dfe3edb0 🎨 Improved save/update button copy in editor (#2413)
no issue

- renamed "Update" to "Unpublish" or "Unschedule" to match the available actions
- renamed "Save" to "Update" and made it always visible but disabled when there are no unsaved changes
- switched <Editor::PublishManagement> to a provider component and extracted `<Editor::PublishButtons>`
  - allows for the management flow to wrap other UI elements and have the yielded actions passed down so the publish/update flow can be opened from more than just the publish/unschedule/unpublish buttons
- added link to "Sent" in editor status that opens the update flow for email-only posts

Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2022-06-01 13:48:33 +01:00

72 lines
2.6 KiB
Handlebars

{{#if @publishManagement.publishOptions.user.isContributor}}
{{#if @publishManagement.post.isDraft}}
<button
type="button"
class="gh-btn gh-btn-editor gh-editor-preview-trigger"
{{on "click" @publishManagement.openPreview}}
{{on-key "cmd+p" @publishManagement.togglePreview}}
data-test-button="contributor-preview"
>
<span>Preview</span>
</button>
{{/if}}
<GhTaskButton
@buttonText="Save"
@task={{@publishManagement.saveTask}}
@runningText="Saving"
@class="gh-btn gh-btn-icon gh-btn-editor gh-editor-save-trigger contributor-save-button"
data-test-button="contributor-save" />
{{else}}
{{#if @publishManagement.post.isDraft}}
<button
type="button"
class="gh-btn gh-btn-editor gh-editor-preview-trigger"
{{on "click" @publishManagement.openPreview}}
{{on-key "cmd+p" @publishManagement.togglePreview}}
data-test-button="publish-preview"
>
<span>Preview</span>
</button>
<button
type="button"
class="gh-btn gh-btn-editor darkgrey gh-publish-trigger"
{{on "click" @publishManagement.openPublishFlow}}
{{on-key "cmd+shift+p"}}
disabled={{@publishManagement.publishOptions.isLoading}}
data-test-button="publish-flow"
>
<span>Publish</span>
</button>
{{else}}
<GhTaskButton
@task={{@publishManagement.saveTask}}
@buttonText="Update"
@runningText="Updating..."
@successText="Updated"
@class="gh-btn gh-btn-editor gh-editor-save-trigger gh-publish-trigger"
@idleClass="green"
@runningClass="midlightgrey"
@successClass="midlightgrey"
@failureClass="red"
@showIcon={{false}}
@disabled={{not @publishManagement.hasUnsavedChanges}}
@autoReset={{true}}
data-test-button="publish-save"
/>
{{#if (not (and @publishManagement.post.isSent (not @publishManagement.post.isPublished)))}}
<button
type="button"
class="gh-btn gh-btn-editor darkgrey gh-publish-trigger"
{{on "click" @publishManagement.openUpdateFlow}}
data-test-button="update-flow"
>
<span>
{{if @publishManagement.post.isScheduled "Unschedule" "Unpublish"}}
</span>
</button>
{{/if}}
{{/if}}
{{/if}}