0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Added publish menu to post preview modal

refs https://github.com/TryGhost/Team/issues/459

- pass required properties+actions through editor->post preview modal->publish menu
- replace publish button placeholder with `<GhPublishMenu>`
- close modal when saving if not a silent save
This commit is contained in:
Kevin Ansfield 2021-02-01 17:59:18 +00:00 committed by Daniel Lockyer
parent f9779cf5e3
commit be01fa6920
4 changed files with 23 additions and 11 deletions

View file

@ -9,29 +9,33 @@
<div class="gh-contentfilter gh-btn-group gh-post-preview-btn-group" style="display:flex;flex-grow:1;justify-content:center">
<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 this.model.isPost}}
{{#if @model.post.isPost}}
<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}}
<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 "social-share"}}</span></button>
</div>
<button class="fr ml9 gh-btn gh-btn-blue gh-button-icon" type="button" title="Publish" {{on "click" this.close}}>
<span>Publish</span>
</button>
<GhPublishmenu
@post={{@model.post}}
@postStatus={{@model.post.status}}
@saveTask={{@model.saveTask}}
@setSaveType={{@model.setEditorSaveType}}
@memberCount={{@model.memberCount}} />
</header>
{{#if (eq this.tab "browser")}}
<ModalPostPreview::Browser @post={{@model}} />
<ModalPostPreview::Browser @post={{@model.post}} />
{{/if}}
{{#if (and (eq this.tab "mobile") this.model.isPost)}}
<ModalPostPreview::Mobile @post={{@model}} />
{{#if (and (eq this.tab "mobile") @model.post.isPost)}}
<ModalPostPreview::Mobile @post={{@model.post}} />
{{/if}}
{{#if (and (eq this.tab "email") this.model.isPost)}}
<ModalPostPreview::Email @post={{@model}} />
{{#if (and (eq this.tab "email") @model.post.isPost)}}
<ModalPostPreview::Email @post={{@model.post}} />
{{/if}}
{{#if (eq this.tab "social")}}
<ModalPostPreview::Social @post={{@model}} />
<ModalPostPreview::Social @post={{@model.post}} />
{{/if}}
</div>

View file

@ -429,6 +429,7 @@ export default Controller.extend({
post.set('statusScratch', null);
if (!options.silent) {
this.set('showPostPreviewModal', false);
this._showSaveNotification(prevStatus, post.get('status'), isNew ? true : false);
}
@ -749,6 +750,7 @@ export default Controller.extend({
this.set('shouldFocusEditor', false);
this.set('leaveEditorTransition', null);
this.set('showLeaveEditorModal', false);
this.set('showPostPreviewModal', false);
this.set('infoMessage', null);
this.set('wordCount', null);

View file

@ -53,6 +53,7 @@
font-size: 1.4rem;
font-weight: normal;
will-change: transform, opacity;
z-index: 99999; /* needs to sit on top of preview modal */
}
.gh-publishmenu-dropdown.ember-basic-dropdown--transitioning-in {

View file

@ -121,7 +121,12 @@
{{#if this.showPostPreviewModal}}
<GhFullscreenModal @modal="post-preview"
@model={{this.post}}
@model={{hash
post=this.post
saveTask=this.save
setEditorSaveType=(action "setSaveType")
memberCount=this.memberCount
}}
@close={{action "togglePostPreviewModal"}}
@modifier="full-overlay email-preview" />
{{/if}}