Ghost/ghost/admin/app/components/editor-labs/modals/preview.hbs
Kevin Ansfield 3b088cbd77 Removed usage of old publish menu for contributors
no issue

- updated `<PublishManagement>` and sub-components to handle contributors by replacing publish button with save button in main view and in preview
- removed feature flag gating and usage of `<GhPublishmenu>` in editor template
- updated tests that indirectly used the old publish menu so they work with the new design/behaviour
- skipped editor tests that used the old publish menu
2022-05-16 14:18:04 +01:00

71 lines
3.5 KiB
Handlebars

<div class="flex flex-column h-100">
<header class="modal-header gh-post-preview-header" data-test-modal="preview-email">
<div class="left">
<button class="gh-btn-editor gh-editor-back-button" title="Close" type="button" {{on "click" @close}}>
<span>{{svg-jar "arrow-left"}} Editor</span>
</button>
</div>
<div class="gh-post-preview-btn-group">
<div class="gh-contentfilter gh-btn-group">
<button type="button" class="gh-btn {{if (eq this.tab "browser") "gh-btn-group-selected"}} gh-post-preview-mode" {{on "click" (fn this.changeTab "browser")}}><span>{{svg-jar "desktop"}}</span></button>
<button type="button" class="gh-btn {{if (eq this.tab "mobile") "gh-btn-group-selected"}} gh-post-preview-mode" {{on "click" (fn this.changeTab "mobile")}}><span>{{svg-jar "mobile-phone"}}</span></button>
{{#if (and (not-eq this.settings.membersSignupAccess "none") (not-eq this.settings.editorDefaultEmailRecipients "disabled"))}}
{{#if (and @data.publishOptions.post.isPost (not @data.publishOptions.user.isContributor))}}
<button type="button" class="gh-btn {{if (eq this.tab "email") "gh-btn-group-selected"}} gh-post-preview-mode" {{on "click" (fn this.changeTab "email")}}><span>{{svg-jar "email-unread"}}</span></button>
{{/if}}
{{/if}}
<button type="button" class="gh-btn {{if (eq this.tab "social") "gh-btn-group-selected"}} gh-post-preview-mode" {{on "click" (fn this.changeTab "social")}}><span>{{svg-jar "twitter"}}</span></button>
</div>
</div>
<div class="right">
<button
type="button"
class="gh-btn gh-btn-editor gh-editor-preview-trigger active"
{{on "click" @close}}
>
<span>Preview</span>
</button>
{{#if @data.publishOptions.user.isContributor}}
<GhTaskButton
@buttonText="Save"
@task={{@data.saveTask}}
@runningText="Saving"
@class="gh-btn gh-btn-icon gh-btn-editor contributor-save-button"
data-test-preview-contributor-save />
{{else}}
<button
type="button"
class="gh-btn gh-btn-editor darkgrey gh-publish-trigger"
{{on "click" @data.togglePreviewPublish}}
>
<span>Publish</span>
</button>
{{/if}}
<div class="settings-menu-toggle-spacer"></div>
</div>
</header>
{{#if this.saveFirstTask.isRunning}}
<GhLoadingSpinner />
{{else}}
{{#if (eq this.tab "browser")}}
<EditorLabs::Modals::Preview::Browser @post={{@data.publishOptions.post}} />
{{/if}}
{{#if (and (eq this.tab "mobile"))}}
<EditorLabs::Modals::Preview::Mobile @post={{@data.publishOptions.post}} />
{{/if}}
{{#unless @data.publishOptions.user.isContributor}}
{{#if (and (eq this.tab "email") @data.publishOptions.post.isPost)}}
<EditorLabs::Modals::Preview::Email @post={{@data.publishOptions.post}} @newsletter={{@data.publishOptions.newsletter}} />
{{/if}}
{{/unless}}
{{#if (eq this.tab "social")}}
<EditorLabs::Modals::Preview::Social @post={{@data.publishOptions.post}} />
{{/if}}
{{/if}}
</div>