2020-07-01 20:39:03 +03:00
|
|
|
import Component from '@glimmer/component';
|
2020-07-01 22:28:47 +03:00
|
|
|
import {formatPostTime} from 'ghost-admin/helpers/gh-format-post-time';
|
2017-10-30 12:38:01 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2016-06-30 21:14:25 +03:00
|
|
|
|
2020-07-01 20:39:03 +03:00
|
|
|
export default class GhPostsListItemComponent extends Component {
|
|
|
|
@service session;
|
2020-07-01 22:28:47 +03:00
|
|
|
@service settings;
|
2017-07-13 12:55:13 +03:00
|
|
|
|
2020-07-01 20:39:03 +03:00
|
|
|
get authorNames() {
|
|
|
|
return this.args.post.authors.map(author => author.name || author.email).join(', ');
|
|
|
|
}
|
2020-07-01 22:28:47 +03:00
|
|
|
|
|
|
|
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(' ');
|
|
|
|
}
|
2020-07-01 20:39:03 +03:00
|
|
|
}
|