0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Moved post history trigger to post settings menu

No ref
This commit is contained in:
Sanne de Vries 2023-04-18 10:57:41 +01:00
parent b7f091f732
commit 29e45f2658
7 changed files with 261 additions and 223 deletions

View file

@ -10,169 +10,176 @@
</div>
<div class="settings-menu-content">
<form aria-label="Post settings">
<div class="form-group">
<label for="url">{{capitalize this.post.displayName}} URL</label>
{{!-- new posts don't have a preview link --}}
{{#unless this.post.isNew}}
{{#if (or this.post.isPublished this.post.isSent)}}
<a class="post-view-link" target="_blank" href="{{this.post.url}}" rel="noopener noreferrer">
View {{this.post.displayName}} {{svg-jar "external"}}
</a>
{{else if this.post.isScheduled}}
<a class="post-view-link" target="_blank" href="{{this.post.previewUrl}}" rel="noopener noreferrer">
Preview {{svg-jar "external"}}
</a>
{{/if}}
{{/unless}}
<section class="gh-post-settings">
<div class="form-group">
<label for="url">{{capitalize this.post.displayName}} URL</label>
{{!-- new posts don't have a preview link --}}
{{#unless this.post.isNew}}
{{#if (or this.post.isPublished this.post.isSent)}}
<a class="post-view-link" target="_blank" href="{{this.post.url}}" rel="noopener noreferrer">
View {{this.post.displayName}} {{svg-jar "external"}}
</a>
{{else if this.post.isScheduled}}
<a class="post-view-link" target="_blank" href="{{this.post.previewUrl}}" rel="noopener noreferrer">
Preview {{svg-jar "external"}}
</a>
{{/if}}
{{/unless}}
<div class="gh-input-icon gh-icon-link">
{{svg-jar "link"}}
<GhTextInput
@class="post-setting-slug"
@id="url"
@name="post-setting-slug"
@value={{readonly this.slugValue}}
@input={{action (mut this.slugValue) value="target.value"}}
@focus-out={{action "updateSlug" this.slugValue}}
@stopEnterKeyDownPropagation={{true}} />
</div>
{{#if this.post.isSent}}
<GhUrlPreview @prefix="email" @slug={{this.uuidValue}} @tagName="p" @classNames="description" />
{{else}}
<GhUrlPreview @slug={{this.slugValue}} @tagName="p" @classNames="description" />
{{/if}}
</div>
<div class="gh-input-icon gh-icon-link">
{{svg-jar "link"}}
<GhTextInput
@class="post-setting-slug"
@id="url"
@name="post-setting-slug"
@value={{readonly this.slugValue}}
@input={{action (mut this.slugValue) value="target.value"}}
@focus-out={{action "updateSlug" this.slugValue}}
@stopEnterKeyDownPropagation={{true}} />
</div>
{{#if this.post.isSent}}
<GhUrlPreview @prefix="email" @slug={{this.uuidValue}} @tagName="p" @classNames="description" />
{{else}}
<GhUrlPreview @slug={{this.slugValue}} @tagName="p" @classNames="description" />
{{/if}}
</div>
<div class="form-group">
{{#if (or this.post.isDraft this.post.isPublished this.post.pastScheduledTime this.post.isSent)}}
<label>Publish date</label>
{{else}}
<label>Scheduled date</label>
{{/if}}
<GhDateTimePicker
@date={{this.post.publishedAtBlogDate}}
@time={{this.post.publishedAtBlogTime}}
@setDate={{action "setPublishedAtBlogDate"}}
@setTime={{action "setPublishedAtBlogTime"}}
@errors={{this.post.errors}}
@dateErrorProperty="publishedAtBlogDate"
@timeErrorProperty="publishedAtBlogTime"
@maxDate="now"
@disabled={{this.post.isScheduled}}
@isActive={{not this.isViewingSubview}}
/>
{{#unless (or this.post.isDraft this.post.isPublished this.post.pastScheduledTime this.post.isSent)}}
<p>Use the publish menu to re-schedule</p>
{{/unless}}
</div>
{{#unless this.session.user.isContributor}}
<div class="form-group">
<label for="tag-input">Tags</label>
<GhPsmTagsInput @post={{this.post}} @triggerId="tag-input" />
</div>
{{/unless}}
{{#if this.showVisibilityInput}}
<GhFormGroup @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="visibility">
<label for="visibility-input">{{capitalize @post.displayName}} access</label>
<GhPsmVisibilityInput @post={{this.post}} @triggerId="visibility-input" />
</GhFormGroup>
{{#if (eq this.post.visibility "tiers")}}
<GhFormGroup @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="tiers" class="nt3" data-test-visibility-segment-select>
<GhPostSettingsMenu::VisibilitySegmentSelect
@tiers={{this.post.tiers}}
@onChange={{action "setVisibility"}}
@renderInPlace={{true}}
@hideOptionsWhenAllSelected={{true}}
<div class="form-group">
{{#if (or this.post.isDraft this.post.isPublished this.post.pastScheduledTime this.post.isSent)}}
<label>Publish date</label>
{{else}}
<label>Scheduled date</label>
{{/if}}
<GhDateTimePicker
@date={{this.post.publishedAtBlogDate}}
@time={{this.post.publishedAtBlogTime}}
@setDate={{action "setPublishedAtBlogDate"}}
@setTime={{action "setPublishedAtBlogTime"}}
@errors={{this.post.errors}}
@dateErrorProperty="publishedAtBlogDate"
@timeErrorProperty="publishedAtBlogTime"
@maxDate="now"
@disabled={{this.post.isScheduled}}
@isActive={{not this.isViewingSubview}}
/>
<GhErrorMessage @errors={{this.post.errors}} @property="tiers" data-test-error="tiers" />
{{#unless (or this.post.isDraft this.post.isPublished this.post.pastScheduledTime this.post.isSent)}}
<p>Use the publish menu to re-schedule</p>
{{/unless}}
</div>
{{#unless this.session.user.isContributor}}
<div class="form-group">
<label for="tag-input">Tags</label>
<GhPsmTagsInput @post={{this.post}} @triggerId="tag-input" />
</div>
{{/unless}}
{{#if this.showVisibilityInput}}
<GhFormGroup @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="visibility">
<label for="visibility-input">{{capitalize @post.displayName}} access</label>
<GhPsmVisibilityInput @post={{this.post}} @triggerId="visibility-input" />
</GhFormGroup>
{{#if (eq this.post.visibility "tiers")}}
<GhFormGroup @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="tiers" class="nt3" data-test-visibility-segment-select>
<GhPostSettingsMenu::VisibilitySegmentSelect
@tiers={{this.post.tiers}}
@onChange={{action "setVisibility"}}
@renderInPlace={{true}}
@hideOptionsWhenAllSelected={{true}}
/>
<GhErrorMessage @errors={{this.post.errors}} @property="tiers" data-test-error="tiers" />
</GhFormGroup>
{{/if}}
{{/if}}
<GhFormGroup @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="customExcerpt">
<label for="custom-excerpt">Excerpt</label>
<GhTextarea
@class="post-setting-custom-excerpt"
@id="custom-excerpt"
@name="post-setting-custom-excerpt"
@value={{readonly this.customExcerptScratch}}
@input={{action (mut this.customExcerptScratch) value="target.value"}}
@focus-out={{action "setCustomExcerpt" this.customExcerptScratch}}
@stopEnterKeyDownPropagation="true"
data-test-field="custom-excerpt"
/>
<GhErrorMessage @errors={{this.post.errors}} @property="customExcerpt" data-test-error="custom-excerpt" />
</GhFormGroup>
{{/if}}
{{/if}}
{{#unless this.session.user.isAuthorOrContributor}}
<GhFormGroup class="for-select" @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="authors" data-test-input="authors">
<label for="author-list">Authors</label>
<GhPsmAuthorsInput @selectedAuthors={{this.post.authors}} @updateAuthors={{action "changeAuthors"}} @triggerId="author-list" />
<GhErrorMessage @errors={{this.post.errors}} @property="authors" data-test-error="authors" />
</GhFormGroup>
{{/unless}}
<GhFormGroup @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="customExcerpt">
<label for="custom-excerpt">Excerpt</label>
<GhTextarea
@class="post-setting-custom-excerpt"
@id="custom-excerpt"
@name="post-setting-custom-excerpt"
@value={{readonly this.customExcerptScratch}}
@input={{action (mut this.customExcerptScratch) value="target.value"}}
@focus-out={{action "setCustomExcerpt" this.customExcerptScratch}}
@stopEnterKeyDownPropagation="true"
data-test-field="custom-excerpt"
/>
<GhErrorMessage @errors={{this.post.errors}} @property="customExcerpt" data-test-error="custom-excerpt" />
</GhFormGroup>
<GhPsmTemplateSelect
@post={{this.post}}
@onTemplateSelect={{action (mut this.post.customTemplate)}} />
{{#unless this.session.user.isAuthorOrContributor}}
<GhFormGroup class="for-select" @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="authors" data-test-input="authors">
<label for="author-list">Authors</label>
<GhPsmAuthorsInput @selectedAuthors={{this.post.authors}} @updateAuthors={{action "changeAuthors"}} @triggerId="author-list" />
<GhErrorMessage @errors={{this.post.errors}} @property="authors" data-test-error="authors" />
</GhFormGroup>
{{/unless}}
<div class="settings-menu-post-actions">
{{#unless this.session.user.isAuthorOrContributor}}
<div class="form-group for-checkbox">
<label class="checkbox" for="featured" {{action "toggleFeatured" bubbles="false"}}>
<input
type="checkbox"
checked={{this.post.featured}}
class="gh-input post-settings-featured"
onclick={{action (mut this.post.featured) value="target.checked"}}
data-test-checkbox="featured"
>
<span class="input-toggle-component"></span>
<p>Feature this {{this.post.displayName}}</p>
</label>
</div>
{{/unless}}
<ul class="nav-list nav-list-block">
<li class="nav-list-item">
<button type="button" {{action "showSubview" "meta-data"}} data-test-button="meta-data">
<b>Meta data</b>
<span>Extra content for search engines</span>
</button>
{{svg-jar "arrow-right"}}
</li>
<li class="nav-list-item">
<button type="button" {{action "showSubview" "twitter-data"}} data-test-button="twitter-data">
<b>Twitter card</b>
<span>Customize structured data for Twitter</span>
</button>
{{svg-jar "arrow-right"}}
</li>
<li class="nav-list-item">
<button type="button" {{action "showSubview" "facebook-data"}} data-test-button="facebook-data">
<b>Facebook card</b>
<span>Customize Open Graph data</span>
</button>
{{svg-jar "arrow-right"}}
</li>
<li class="nav-list-item">
<button type="button" {{action "showSubview" "codeinjection"}} data-test-button="codeinjection">
<b>Code injection</b>
<span>Add styles/scripts to the header &amp; footer</span>
</button>
{{svg-jar "arrow-right"}}
</li>
</ul>
{{#unless this.session.user.isAuthorOrContributor}}
<div class="form-group for-checkbox">
<label class="checkbox" for="featured" {{action "toggleFeatured" bubbles="false"}}>
<input
type="checkbox"
checked={{this.post.featured}}
class="gh-input post-settings-featured"
onclick={{action (mut this.post.featured) value="target.checked"}}
data-test-checkbox="featured"
>
<span class="input-toggle-component"></span>
<p>Feature this {{this.post.displayName}}</p>
</label>
</div>
{{/unless}}
<GhPsmTemplateSelect
@post={{this.post}}
@onTemplateSelect={{action (mut this.post.customTemplate)}} />
{{#unless this.post.isNew}}
<button type="button" class="gh-btn gh-btn-hover-red gh-btn-icon settings-menu-delete-button" {{action "deletePostInternal"}}>
<span>{{svg-jar "trash"}} Delete {{this.post.displayName}}</span>
</button>
{{/unless}}
{{#unless this.post.isNew}}
<button type="button" class="settings-menu-delete-button" {{action "deletePostInternal"}}>
<span>{{svg-jar "trash"}} Delete {{this.post.displayName}}</span>
</button>
{{/unless}}
</div>
</section>
<ul class="nav-list">
<li class="nav-list-item">
<button type="button" {{action "showSubview" "codeinjection"}} data-test-button="codeinjection">
<span>{{svg-jar "brackets"}} Code injection</span>
</button>
{{svg-jar "arrow-right" class="arrow-right"}}
</li>
{{#if (feature 'postHistory')}}
<li class="nav-list-item">
<button type="button" {{on "click" this.openPostHistory}} data-test-toggle="post-history">
<span>{{svg-jar "history" class="history"}} Post history</span>
</button>
{{svg-jar "arrow-right" class="arrow-right"}}
</li>
{{/if}}
<li class="nav-list-item">
<button type="button" {{action "showSubview" "meta-data"}} data-test-button="meta-data">
<span>{{svg-jar "google-icon"}} Meta data</span>
</button>
{{svg-jar "arrow-right" class="arrow-right"}}
</li>
<li class="nav-list-item">
<button type="button" {{action "showSubview" "twitter-data"}} data-test-button="twitter-data">
<span>{{svg-jar "twitter-logo"}} Twitter card</span>
</button>
{{svg-jar "arrow-right" class="arrow-right"}}
</li>
<li class="nav-list-item">
<button type="button" {{action "showSubview" "facebook-data"}} data-test-button="facebook-data">
<span>{{svg-jar "social-facebook"}} Facebook card</span>
</button>
{{svg-jar "arrow-right" class="arrow-right"}}
</li>
</ul>
</form>
</div>{{! .settings-menu-content }}
</div>{{! .post-settings-menu }}
@ -429,5 +436,14 @@
</div>
</div>
{{/if}}
{{#if (feature 'postHistory')}}
{{#if this.showPostHistory}}
<GhFullscreenModal
@modal="post-history"
@close={{this.closePostHistory}}
@modifier="total-overlay post-history" />
{{/if}}
{{/if}}
</div>
</div>

View file

@ -7,6 +7,7 @@ import {alias, or} from '@ember/object/computed';
import {inject} from 'ghost-admin/decorators/inject';
import {inject as service} from '@ember/service';
import {tagName} from '@ember-decorators/component';
import {tracked} from '@glimmer/tracking';
@classic
@tagName('')
@ -23,6 +24,8 @@ export default class GhPostSettingsMenu extends Component {
@inject config;
@tracked showPostHistory = false;
post = null;
isViewingSubview = false;
@ -189,6 +192,16 @@ export default class GhPostSettingsMenu extends Component {
});
}
@action
openPostHistory() {
this.showPostHistory = true;
}
@action
closePostHistory() {
this.showPostHistory = false;
}
/**
* triggered by user manually changing slug
*/

View file

@ -23,7 +23,6 @@ import {isArray as isEmberArray} from '@ember/array';
import {isHostLimitError, isServerUnreachableError, isVersionMismatchError} from 'ghost-admin/services/ajax';
import {isInvalidError} from 'ember-ajax/errors';
import {inject as service} from '@ember/service';
import {tracked} from '@glimmer/tracking';
const DEFAULT_TITLE = '(Untitled)';
@ -116,7 +115,6 @@ export default class LexicalEditorController extends Controller {
shouldFocusTitle = false;
showSettingsMenu = false;
@tracked showPostHistory = false;
/**
* Flag used to determine if we should return to the analytics page or to the posts/pages overview
@ -399,16 +397,6 @@ export default class LexicalEditorController extends Controller {
});
}
@action
openPostHistory() {
this.showPostHistory = true;
}
@action
closePostHistory() {
this.showPostHistory = false;
}
/* Public tasks ----------------------------------------------------------*/
// separate task for autosave so that it doesn't override a manual save

View file

@ -46,7 +46,7 @@
.settings-menu-container {
z-index: 999;
height: 100vh;
min-width: 380px;
min-width: 420px;
overflow-x: visible;
overflow-y: auto;
border-left: 1px solid var(--whitegrey-d1);
@ -82,7 +82,7 @@
right: 0;
bottom: 0;
width: 100%;
max-width: 380px;
max-width: 420px;
overflow: auto;
background-color: var(--white);
opacity: 1;
@ -193,7 +193,11 @@
}
.settings-menu-content {
padding: 92px 24px 33px;
padding: 92px 0 0;
}
.gh-post-settings {
padding: 0 24px;
}
@media (max-width: 1024px) {
@ -262,7 +266,7 @@
}
.settings-menu-content .nav-list {
margin-top: 3rem;
margin: 0;
}
.settings-menu-content .word-count {
@ -277,11 +281,40 @@
white-space: nowrap;
}
.settings-menu-post-actions {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 3.2rem;
padding: .4rem 0;
}
.settings-menu-content .for-checkbox .input-toggle-component {
margin-right: .8rem;
}
.settings-menu-content .for-checkbox {
margin: 0;
width: initial;
}
.settings-menu-content .for-checkbox label {
margin: 0;
padding: 0;
}
.settings-menu-content .for-checkbox label p {
margin: 0;
color: var(--black);
font-size: 1.3rem;
font-weight: 500;
}
.settings-menu-delete-button {
background: transparent;
box-shadow: none;
color: var(--red);
border: none;
color: var(--red);
}
.settings-menu-delete-button:hover {
@ -291,14 +324,18 @@
}
.settings-menu-delete-button span {
display: flex;
align-items: center;
font-size: inherit;
padding: 6px 0;
padding: 0;
font-size: 1.3rem;
font-weight: 500;
}
.settings-menu-delete-button svg {
width: 1.6rem;
height: 1.6rem;
margin-right: .8rem;
margin: 0 .8rem 2px 0;
}
.post-setting-custom-excerpt {

View file

@ -3,13 +3,6 @@
.nav-list {
padding: 0;
max-width: 500px;
background: var(--main-color-content-greybg);
border-radius: var(--border-radius);
}
.nav-list.nav-list-block {
max-width: none;
}
.nav-list-item {
@ -17,30 +10,21 @@
display: block;
margin: 0;
color: var(--darkgrey);
border-bottom: 1px solid var(--whitegrey-d1);
}
.nav-list-item:hover {
background: var(--whitegrey);
background: var(--whitegrey-l1);
cursor: pointer;
}
.nav-list-item:first-of-type {
border-top-left-radius: var(--border-radius);
border-top-right-radius: var(--border-radius);
}
.nav-list-item:last-of-type {
border-bottom-right-radius: var(--border-radius);
border-bottom-left-radius: var(--border-radius);
}
.nav-list-item:not(:last-of-type) {
border-bottom: 1px solid var(--white);
border-top: 1px solid var(--whitegrey-d1);
}
.nav-list-item button {
width: 100%;
padding: 9px 40px 10px 12px;
padding: 2rem 2.4rem;
text-align: left;
}
@ -48,30 +32,38 @@
color: var(--darkgrey);
}
.nav-list-item b {
display: block;
.nav-list-item span {
display: flex;
align-items: center;
font-size: 1.4rem;
line-height: 1.375;
font-weight: 600;
}
.nav-list-item span {
display: block;
color: var(--midgrey);
font-size: 1.2rem;
line-height: 1.375;
letter-spacing: 0.2px;
}
.nav-list-item svg {
position: absolute;
top: 50%;
right: 10px;
margin-top: -0.9rem;
li.nav-list-item svg {
margin: 0 1rem 0 0;
height: 1.4rem;
width: 1.4rem;
}
.nav-list-item svg path {
li.nav-list-item svg path:not(li.nav-list-item .history path) {
stroke-width: 1.8;
}
li.nav-list-item .history {
width: 1.6rem;
height: 1.6rem;
}
li.nav-list-item .arrow-right {
position: absolute;
top: 50%;
right: 24px;
margin: -0.9rem 0 0;
height: 1.4rem;
width: 1.4rem;
}
li.nav-list-item .arrow-right path {
fill: var(--midgrey);
}

View file

@ -43,11 +43,6 @@
@openUpdateFlow={{publishManagement.openUpdateFlow}}
/>
</span>
{{#if (feature 'postHistory')}}
<button type="button" {{on "click" this.openPostHistory}} data-test-toggle="post-history" class="gh-btn-text">
{{svg-jar "history"}}
</button>
{{/if}}
</div>
{{/if}}
</div>
@ -130,15 +125,6 @@
@close={{this.toggleReAuthenticateModal}}
@modifier="action wide" />
{{/if}}
{{#if (feature 'postHistory')}}
{{#if this.showPostHistory}}
<GhFullscreenModal
@modal="post-history"
@close={{this.closePostHistory}}
@modifier="total-overlay post-history" />
{{/if}}
{{/if}}
{{/if}}
{{outlet}}

View file

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 186.69 190.5">
<path fill="#4285f4" d="M95.25 77.932v36.888h51.262c-2.251 11.863-9.006 21.908-19.137 28.662l30.913 23.986c18.011-16.625 28.402-41.044 28.402-70.052 0-6.754-.606-13.249-1.732-19.483z"/>
<path fill="#34a853" d="m41.869 113.38-6.972 5.337-24.679 19.223c15.673 31.086 47.796 52.561 85.03 52.561 25.717 0 47.278-8.486 63.038-23.033l-30.913-23.986c-8.486 5.715-19.31 9.179-32.125 9.179-24.765 0-45.806-16.712-53.34-39.226z"/>
<path fill="#fbbc05" d="M10.218 52.561C3.724 65.376.001 79.837.001 95.25s3.723 29.874 10.217 42.689c0 .086 31.693-24.592 31.693-24.592-1.905-5.715-3.031-11.776-3.031-18.098s1.126-12.383 3.031-18.098z"/>
<path fill="#ea4335" d="M95.25 37.927c14.028 0 26.497 4.849 36.455 14.201l27.276-27.276C142.442 9.439 120.968 0 95.25 0 58.016 0 25.891 21.388 10.218 52.561L41.91 77.153c7.533-22.514 28.575-39.226 53.34-39.226z"/>
</svg>

After

Width:  |  Height:  |  Size: 920 B