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}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#unless post.emailOnly}}
|
||||||
|
<GhPostBookmark @post={{post}} />
|
||||||
|
{{/unless}}
|
||||||
|
|
||||||
<div class="gh-publish-cta">
|
<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>
|
<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}}
|
{{#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 }}
|
{{#unless @hideAuthor }}
|
||||||
<p>
|
<p>
|
||||||
<span class="gh-content-entry-meta">
|
<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}}
|
{{#if @post.primaryTag}}
|
||||||
in <span class="midgrey-l2 fw5">{{@post.primaryTag.name}}</span>
|
in <span class="midgrey-l2 fw5">{{@post.primaryTag.name}}</span>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
{{#unless @hideAuthor }}
|
{{#unless @hideAuthor }}
|
||||||
<p>
|
<p>
|
||||||
<span class="gh-content-entry-meta">
|
<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}}
|
{{#if @post.primaryTag}}
|
||||||
in <span class="midgrey-l2 fw5">{{@post.primaryTag.name}}</span>
|
in <span class="midgrey-l2 fw5">{{@post.primaryTag.name}}</span>
|
||||||
|
|
|
@ -11,10 +11,6 @@ export default class GhPostsListItemComponent extends Component {
|
||||||
|
|
||||||
@tracked isHovered = false;
|
@tracked isHovered = false;
|
||||||
|
|
||||||
get authorNames() {
|
|
||||||
return this.args.post.authors.map(author => author.name || author.email).join(', ');
|
|
||||||
}
|
|
||||||
|
|
||||||
get sendEmailWhenPublished() {
|
get sendEmailWhenPublished() {
|
||||||
let {post} = this.args;
|
let {post} = this.args;
|
||||||
return post.emailRecipientFilter && post.emailRecipientFilter !== 'none';
|
return post.emailRecipientFilter && post.emailRecipientFilter !== 'none';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Helper from '@ember/component/helper';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import {inject as service} from '@ember/service';
|
import {inject as service} from '@ember/service';
|
||||||
|
|
||||||
export default class MomentSiteTz extends Helper {
|
export default class IsMomentToday extends Helper {
|
||||||
@service settings;
|
@service settings;
|
||||||
|
|
||||||
compute([date]) {
|
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 {
|
export default class DesignsandboxRoute extends Route {
|
||||||
@service config;
|
@service config;
|
||||||
|
@service store;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
super.beforeModel(...arguments);
|
super.beforeModel(...arguments);
|
||||||
|
@ -10,4 +11,8 @@ export default class DesignsandboxRoute extends Route {
|
||||||
return this.transitionTo('home');
|
return this.transitionTo('home');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model() {
|
||||||
|
return this.store.queryRecord('post', {limit: 1, order: 'published_at DESC'});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
</GhCanvasHeader>
|
</GhCanvasHeader>
|
||||||
|
|
||||||
<section class="view-container gh-ds">
|
<section class="view-container gh-ds">
|
||||||
|
<h2>Post bookmark</h2>
|
||||||
|
<GhPostBookmark @post={{this.model}} />
|
||||||
|
|
||||||
<h2 class="">Buttons</h2>
|
<h2 class="">Buttons</h2>
|
||||||
<ul class="nostyle">
|
<ul class="nostyle">
|
||||||
<li><button class="gh-btn gh-btn-primary" type="button"><span>Primary button</span></button></li>
|
<li><button class="gh-btn gh-btn-primary" type="button"><span>Primary button</span></button></li>
|
||||||
|
|
Loading…
Add table
Reference in a new issue