mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Added <GhPostBookmark> and displayed on publish flow complete step
refs https://github.com/TryGhost/Team/issues/1598 - added `<GhPostBookmark>` card for displaying a bookmark card style representation of a post - updated designsandbox route to include it for easier styling without needing to constantly go through the publish flow to see changes whilst styling - updated publish flow complete step to render a bookmark card if a post/page was published - added `{{post-author-names}}` helper so the author name concatenation logic can be re-used across the posts list and bookmark component
This commit is contained in:
parent
bf098cc730
commit
59e7b720a2
8 changed files with 40 additions and 8 deletions
|
@ -34,6 +34,10 @@
|
|||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{#unless post.emailOnly}}
|
||||
<GhPostBookmark @post={{post}} />
|
||||
{{/unless}}
|
||||
|
||||
<div class="gh-publish-cta">
|
||||
<button type="button" class="gh-btn gh-btn-black gh-btn-large" {{on "click" @close}}><span>Back to {{post.displayName}}</span></button>
|
||||
{{#unless post.emailOnly}}
|
||||
|
|
19
ghost/admin/app/components/gh-post-bookmark.hbs
Normal file
19
ghost/admin/app/components/gh-post-bookmark.hbs
Normal file
|
@ -0,0 +1,19 @@
|
|||
<div class="gh-post-bookmark flex flex-row">
|
||||
{{#if @post.featureImage}}
|
||||
<div class="gh-post-bookmark-image">
|
||||
<img src={{@post.featureImage}} alt="" role="presentation" />
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="flex flex-column">
|
||||
<div class="gh-post-bookmark-title">{{@post.title}}</div>
|
||||
<div class="gh-post-bookmark-text">{{@post.excerpt}}</div>
|
||||
<div class="gh-post-bookmark-details flex flex-row">
|
||||
{{#if @post.primaryAuthor.profileImage}}
|
||||
<div class="gh-post-bookmark-author-image">
|
||||
<img src={{@post.primaryAuthor.profileImage}} alt="" role="presentation" />
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="gh-post-bookmark-authors">{{post-author-names @post}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -13,7 +13,7 @@
|
|||
{{#unless @hideAuthor }}
|
||||
<p>
|
||||
<span class="gh-content-entry-meta">
|
||||
By <span class="midgrey-l2 fw5">{{this.authorNames}}</span>
|
||||
By <span class="midgrey-l2 fw5">{{post-author-names @post}}</span>
|
||||
|
||||
{{#if @post.primaryTag}}
|
||||
in <span class="midgrey-l2 fw5">{{@post.primaryTag.name}}</span>
|
||||
|
@ -33,7 +33,7 @@
|
|||
{{#unless @hideAuthor }}
|
||||
<p>
|
||||
<span class="gh-content-entry-meta">
|
||||
By <span class="midgrey-l2 fw5">{{this.authorNames}}</span>
|
||||
By <span class="midgrey-l2 fw5">{{post-author-names @post}}</span>
|
||||
|
||||
{{#if @post.primaryTag}}
|
||||
in <span class="midgrey-l2 fw5">{{@post.primaryTag.name}}</span>
|
||||
|
|
|
@ -11,10 +11,6 @@ export default class GhPostsListItemComponent extends Component {
|
|||
|
||||
@tracked isHovered = false;
|
||||
|
||||
get authorNames() {
|
||||
return this.args.post.authors.map(author => author.name || author.email).join(', ');
|
||||
}
|
||||
|
||||
get sendEmailWhenPublished() {
|
||||
let {post} = this.args;
|
||||
return post.emailRecipientFilter && post.emailRecipientFilter !== 'none';
|
||||
|
|
|
@ -2,7 +2,7 @@ import Helper from '@ember/component/helper';
|
|||
import moment from 'moment';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default class MomentSiteTz extends Helper {
|
||||
export default class IsMomentToday extends Helper {
|
||||
@service settings;
|
||||
|
||||
compute([date]) {
|
||||
|
|
5
ghost/admin/app/helpers/post-author-names.js
Normal file
5
ghost/admin/app/helpers/post-author-names.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
import {helper} from '@ember/component/helper';
|
||||
|
||||
export default helper(function postAuthorNames([post]/*, hash*/) {
|
||||
return (post?.authors || []).map(author => author.name || author.email).join(', ');
|
||||
});
|
|
@ -3,6 +3,7 @@ import {inject as service} from '@ember/service';
|
|||
|
||||
export default class DesignsandboxRoute extends Route {
|
||||
@service config;
|
||||
@service store;
|
||||
|
||||
beforeModel() {
|
||||
super.beforeModel(...arguments);
|
||||
|
@ -10,4 +11,8 @@ export default class DesignsandboxRoute extends Route {
|
|||
return this.transitionTo('home');
|
||||
}
|
||||
}
|
||||
|
||||
model() {
|
||||
return this.store.queryRecord('post', {limit: 1, order: 'published_at DESC'});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
</GhCanvasHeader>
|
||||
|
||||
<section class="view-container gh-ds">
|
||||
<h2>Post bookmark</h2>
|
||||
<GhPostBookmark @post={{this.model}} />
|
||||
|
||||
<h2 class="">Buttons</h2>
|
||||
<ul class="nostyle">
|
||||
<li><button class="gh-btn gh-btn-primary" type="button"><span>Primary button</span></button></li>
|
||||
|
|
Loading…
Add table
Reference in a new issue