From ec925a60b04890da728078359bbec5c96677a4b6 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Wed, 1 Jul 2020 18:39:03 +0100 Subject: [PATCH] Converted to glimmer component no issue - moved tag name and classes into template - updated backing class to native class syntax --- .../app/components/gh-posts-list-item.hbs | 114 +++++++++--------- .../app/components/gh-posts-list-item.js | 20 ++- 2 files changed, 65 insertions(+), 69 deletions(-) diff --git a/ghost/admin/app/components/gh-posts-list-item.hbs b/ghost/admin/app/components/gh-posts-list-item.hbs index 168a11b75f..ed3417c331 100644 --- a/ghost/admin/app/components/gh-posts-list-item.hbs +++ b/ghost/admin/app/components/gh-posts-list-item.hbs @@ -1,70 +1,72 @@ - - {{#if @post.isFeatured}} - {{svg-jar "star-filled" class="fill-blue w3 h3"}} - {{/if}} - +
  • + + {{#if @post.isFeatured}} + {{svg-jar "star-filled" class="fill-blue w3 h3"}} + {{/if}} + - -

    - {{@post.title}} -

    -

    -

    + {{@post.title}} +

    +

    + +

    +
    + + +
    {{#if @post.isScheduled}} - – Will be published and sent {{gh-format-post-time @post.publishedAtUTC scheduled=true}} + + Scheduled + {{/if}} - -

    - - -
    - {{#if @post.isScheduled}} - - Scheduled - - {{/if}} + {{#if @post.isDraft}} + + Draft + + {{/if}} - {{#if @post.isDraft}} - - Draft - - {{/if}} + {{#if @post.isPublished}} + + Published + + {{/if}} - {{#if @post.isPublished}} - - Published - - {{/if}} - - {{#if this.session.user.isOwnerOrAdmin}} - {{#if (or @post.email (and @post.isScheduled @post.sendEmailWhenPublished))}} - {{#if (eq @post.email.status "failed")}} - - {{svg-jar "send-email" class="stroke-red"}} - - {{else}} - {{#if @post.isScheduled}} - - {{svg-jar "send-email" class="stroke-green-d2"}} + {{#if this.session.user.isOwnerOrAdmin}} + {{#if (or @post.email (and @post.isScheduled @post.sendEmailWhenPublished))}} + {{#if (eq @post.email.status "failed")}} + + {{svg-jar "send-email" class="stroke-red"}} {{else}} - - {{svg-jar "send-email" class="stroke-midgrey"}} - + {{#if @post.isScheduled}} + + {{svg-jar "send-email" class="stroke-green-d2"}} + + {{else}} + + {{svg-jar "send-email" class="stroke-midgrey"}} + + {{/if}} {{/if}} {{/if}} {{/if}} - {{/if}} -
    -
    +
    +
    - - {{gh-format-post-time @post.updatedAtUTC draft=true}} - \ No newline at end of file + + {{gh-format-post-time @post.updatedAtUTC draft=true}} + +
  • \ No newline at end of file diff --git a/ghost/admin/app/components/gh-posts-list-item.js b/ghost/admin/app/components/gh-posts-list-item.js index 144ff06509..d48415db05 100644 --- a/ghost/admin/app/components/gh-posts-list-item.js +++ b/ghost/admin/app/components/gh-posts-list-item.js @@ -1,16 +1,10 @@ -import Component from '@ember/component'; -import {computed} from '@ember/object'; +import Component from '@glimmer/component'; import {inject as service} from '@ember/service'; -export default Component.extend({ - session: service(), +export default class GhPostsListItemComponent extends Component { + @service session; - tagName: 'li', - classNames: ['gh-list-row', 'gh-posts-list-item'], - - authorNames: computed('post.authors.[]', function () { - let authors = this.get('post.authors'); - - return authors.map(author => author.get('name') || author.get('email')).join(', '); - }) -}); + get authorNames() { + return this.args.post.authors.map(author => author.name || author.email).join(', '); + } +}