2020-07-01 20:39:03 +03:00
|
|
|
import Component from '@glimmer/component';
|
2020-11-26 20:19:05 +03:00
|
|
|
import {action} from '@ember/object';
|
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';
|
2020-11-26 20:19:05 +03:00
|
|
|
import {tracked} from '@glimmer/tracking';
|
2016-06-30 21:14:25 +03:00
|
|
|
|
2020-07-01 20:39:03 +03:00
|
|
|
export default class GhPostsListItemComponent extends Component {
|
2020-12-02 14:47:34 +03:00
|
|
|
@service feature;
|
2020-07-01 20:39:03 +03:00
|
|
|
@service session;
|
2020-07-01 22:28:47 +03:00
|
|
|
@service settings;
|
2017-07-13 12:55:13 +03:00
|
|
|
|
2020-11-26 20:19:05 +03:00
|
|
|
@tracked isHovered = false;
|
|
|
|
|
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
|
|
|
|
2020-11-06 21:54:27 +03:00
|
|
|
get sendEmailWhenPublished() {
|
|
|
|
let {post} = this.args;
|
|
|
|
return post.emailRecipientFilter && post.emailRecipientFilter !== 'none';
|
|
|
|
}
|
|
|
|
|
2020-07-01 22:28:47 +03:00
|
|
|
get scheduledText() {
|
|
|
|
let {post} = this.args;
|
|
|
|
let text = [];
|
|
|
|
|
|
|
|
let formattedTime = formatPostTime(
|
|
|
|
post.publishedAtUTC,
|
|
|
|
{timezone: this.settings.get('timezone'), scheduled: true}
|
|
|
|
);
|
|
|
|
text.push(formattedTime);
|
|
|
|
|
|
|
|
return text.join(' ');
|
|
|
|
}
|
2020-11-26 20:19:05 +03:00
|
|
|
|
|
|
|
@action
|
|
|
|
mouseOver() {
|
|
|
|
this.isHovered = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
mouseLeave() {
|
|
|
|
this.isHovered = false;
|
|
|
|
}
|
2020-07-01 20:39:03 +03:00
|
|
|
}
|