1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

Improved scheduled status text in posts list

closes https://github.com/TryGhost/Ghost/issues/11965

- fixes scheduled posts always showing "and sent"
- updates status text to match that shown in the editor for scheduled posts
This commit is contained in:
Kevin Ansfield 2020-07-01 20:28:47 +01:00
parent 0494869f86
commit a0370eeea5
2 changed files with 24 additions and 4 deletions

View file

@ -18,7 +18,7 @@
{{/if}}
{{#if @post.isScheduled}}
<span class="gh-schedule-time">Will be published and sent {{gh-format-post-time @post.publishedAtUTC scheduled=true}}</span>
<span class="gh-schedule-time">Will be published {{this.scheduledText}}</span>
{{/if}}
</span>
</p>
@ -39,7 +39,7 @@
{{/if}}
{{#if @post.isPublished}}
<span class="gh-content-status-published nowrap" title="Post has been sent by email">
<span class="gh-content-status-published nowrap">
Published
</span>
{{/if}}
@ -52,11 +52,11 @@
</span>
{{else}}
{{#if @post.isScheduled}}
<span data-tooltip="To be sent by email" class="gh-content-status-emailed scheduled">
<span title="To be send by email" data-tooltip="To be sent by email" class="gh-content-status-emailed scheduled">
{{svg-jar "send-email" class="stroke-green-d2"}}
</span>
{{else}}
<span data-tooltip="Sent by email" class="gh-content-status-emailed">
<span title="Sent by email" data-tooltip="Sent by email" class="gh-content-status-emailed">
{{svg-jar "send-email" class="stroke-midgrey"}}
</span>
{{/if}}

View file

@ -1,10 +1,30 @@
import Component from '@glimmer/component';
import {formatPostTime} from 'ghost-admin/helpers/gh-format-post-time';
import {inject as service} from '@ember/service';
export default class GhPostsListItemComponent extends Component {
@service session;
@service settings;
get authorNames() {
return this.args.post.authors.map(author => author.name || author.email).join(', ');
}
get scheduledText() {
let {post} = this.args;
let text = [];
if (post.sendEmailWhenPublished) {
let paid = post.visibility === 'paid';
text.push(`and sent to ${paid ? 'paid' : 'all'} members`);
}
let formattedTime = formatPostTime(
post.publishedAtUTC,
{timezone: this.settings.get('timezone'), scheduled: true}
);
text.push(formattedTime);
return text.join(' ');
}
}