Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
🎨 Added "Featured posts" filter and badge to stories list (#907)
Browse files Browse the repository at this point in the history
closes TryGhost/Ghost#9234
- add `featured` badge to stories/pages that have the featured flag
- add "Featured posts" to the post type filter dropdown
- simplified badge logic in `{{gh-posts-list-item}}`
  • Loading branch information
kevinansfield committed Nov 10, 2017
1 parent ea34d49 commit 539f9ca
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions app/components/gh-posts-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default Component.extend({

isFeatured: alias('post.featured'),
isPage: alias('post.page'),
isDraft: equal('post.status', 'draft'),
isPublished: equal('post.status', 'published'),
isScheduled: equal('post.status', 'scheduled'),

Expand Down
3 changes: 3 additions & 0 deletions app/controllers/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export default Controller.extend({
}, {
name: 'Scheduled posts',
value: 'scheduled'
}, {
name: 'Featured posts',
value: 'featured'
}, {
name: 'Pages',
value: 'page'
Expand Down
4 changes: 4 additions & 0 deletions app/routes/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export default AuthenticatedRoute.extend(InfinityRoute, {
let queryParams = this._typeParams(params.type);
let filterParams = {tag: params.tag};

if (params.type === 'featured') {
filterParams.featured = true;
}

if (user.get('isAuthor')) {
// authors can only view their own posts
filterParams.author = user.get('slug');
Expand Down
26 changes: 17 additions & 9 deletions app/templates/components/gh-posts-list-item.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@
<p>{{subText}}</p>

<section class="gh-content-entry-meta">
{{#if isPublished}}
{{#if post.page}}
<span class="gh-content-status-draft gh-badge gh-badge-black">Page</span>
{{else}}
<span class="gh-content-status-published">Published</span>
{{/if}}
{{else if isScheduled}}
{{#if isPage}}
<span class="gh-content-status-draft gh-badge gh-badge-black">Page</span>
{{/if}}

{{#if isScheduled}}
<span class="gh-content-status-draft gh-badge">Scheduled</span>
{{else}}
{{/if}}

{{#if isDraft}}
<span class="gh-content-status-draft gh-badge gh-badge-red">Draft</span>
{{/if}}

{{#if isFeatured}}
<span class="gh-content-status-featured gh-badge gh-badge-blue">Featured</span>
{{/if}}

{{#if (and isPublished (not post.page))}}
<span class="gh-content-status-published">Published</span>
{{/if}}

by <span class="gh-content-entry-author">{{authorName}}</span> &mdash;

{{#if isPublished}}
Expand All @@ -23,4 +31,4 @@
{{else}}
Last edited {{gh-format-post-time post.updatedAtUTC draft=true}}
{{/if}}
</section>
</section>

0 comments on commit 539f9ca

Please sign in to comment.