From 539f9cabb42dd89eb6acf70660919b42307d4b31 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Fri, 10 Nov 2017 17:36:27 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Added=20"Featured=20posts"=20fil?= =?UTF-8?q?ter=20and=20badge=20to=20stories=20list=20(#907)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes https://github.com/TryGhost/Ghost/issues/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}}` --- app/components/gh-posts-list-item.js | 1 + app/controllers/posts.js | 3 +++ app/routes/posts.js | 4 +++ .../components/gh-posts-list-item.hbs | 26 ++++++++++++------- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/app/components/gh-posts-list-item.js b/app/components/gh-posts-list-item.js index e2acc662a3..9d52c4a7a5 100644 --- a/app/components/gh-posts-list-item.js +++ b/app/components/gh-posts-list-item.js @@ -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'), diff --git a/app/controllers/posts.js b/app/controllers/posts.js index 4f83b9b158..8566b076ad 100644 --- a/app/controllers/posts.js +++ b/app/controllers/posts.js @@ -29,6 +29,9 @@ export default Controller.extend({ }, { name: 'Scheduled posts', value: 'scheduled' + }, { + name: 'Featured posts', + value: 'featured' }, { name: 'Pages', value: 'page' diff --git a/app/routes/posts.js b/app/routes/posts.js index 2e4c1d1e5c..2d98602d40 100644 --- a/app/routes/posts.js +++ b/app/routes/posts.js @@ -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'); diff --git a/app/templates/components/gh-posts-list-item.hbs b/app/templates/components/gh-posts-list-item.hbs index c4cf3b643a..b5ab186574 100644 --- a/app/templates/components/gh-posts-list-item.hbs +++ b/app/templates/components/gh-posts-list-item.hbs @@ -2,18 +2,26 @@

{{subText}}

- {{#if isPublished}} - {{#if post.page}} - Page - {{else}} - Published - {{/if}} - {{else if isScheduled}} + {{#if isPage}} + Page + {{/if}} + + {{#if isScheduled}} Scheduled - {{else}} + {{/if}} + + {{#if isDraft}} Draft {{/if}} + {{#if isFeatured}} + Featured + {{/if}} + + {{#if (and isPublished (not post.page))}} + Published + {{/if}} + by — {{#if isPublished}} @@ -23,4 +31,4 @@ {{else}} Last edited {{gh-format-post-time post.updatedAtUTC draft=true}} {{/if}} -
\ No newline at end of file +