mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
9e84441e75
refs https://github.com/TryGhost/Team/issues/947 - Added a "distribution" dropdown component to the post publish menu allowing to select from one of three available types of distribution: publish, poblush&send, and send
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import {action} from '@ember/object';
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
export default class GhDistributionActionSelect extends Component {
|
|
@tracked
|
|
distributionValue;
|
|
|
|
constructor(...args) {
|
|
super(...args);
|
|
|
|
let distributionValue = this.args.post.emailOnly
|
|
? 'send'
|
|
: (this.args.post.emailRecipientFilter !== 'none')
|
|
? 'publish_send'
|
|
: 'publish';
|
|
this.distributionValue = this.availablePublishActions.findBy('value', distributionValue);
|
|
}
|
|
|
|
get availablePublishActions() {
|
|
return [{
|
|
value: 'publish_send',
|
|
name: 'publish & send'
|
|
}, {
|
|
value: 'publish',
|
|
name: 'publish'
|
|
}, {
|
|
value: 'send',
|
|
name: 'send'
|
|
}];
|
|
}
|
|
|
|
@action
|
|
setPublishAction(newAction) {
|
|
this.distributionValue = newAction;
|
|
|
|
if (newAction.value === 'publish_send') {
|
|
this.args.post.emailOnly = false;
|
|
this.args.post.emailRecipientFilter = null;
|
|
} else if (newAction.value === 'publish') {
|
|
this.args.post.emailOnly = false;
|
|
this.args.post.emailRecipientFilter = 'none';
|
|
} else if (newAction.value === 'send') {
|
|
this.args.post.emailOnly = true;
|
|
this.args.post.emailRecipientFilter = null;
|
|
}
|
|
|
|
this.args.post.save();
|
|
}
|
|
}
|