Ghost/ghost/admin/app/components/gh-posts-list-item.js

31 lines
894 B
JavaScript
Raw Normal View History

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(' ');
}
}