This feature can be enabled by choosing a destination for the `shared drafts category` site setting. * Staff members can create shared drafts, choosing a destination category for the topic when it is published. * Shared Drafts can be viewed in their category, or above the topic list for the destination category where it will end up. * When the shared draft is ready, it can be published to the appropriate category by clicking a button on the topic view. * When published, Drafts change their timestamps to the current time, and any edits to the original post are removed.
30 lines
757 B
JavaScript
30 lines
757 B
JavaScript
import computed from 'ember-addons/ember-computed-decorators';
|
|
|
|
export default Ember.Component.extend({
|
|
tagName: '',
|
|
publishing: false,
|
|
|
|
@computed('topic.destination_category_id')
|
|
validCategory(destCatId) {
|
|
return destCatId &&
|
|
destCatId !== this.site.shared_drafts_category_id;
|
|
},
|
|
|
|
actions: {
|
|
publish() {
|
|
|
|
bootbox.confirm(I18n.t('shared_drafts.confirm_publish'), result => {
|
|
if (result) {
|
|
this.set('publishing', true);
|
|
let destId = this.get('topic.destination_category_id');
|
|
this.get('topic').publish().then(() => {
|
|
this.set('topic.category_id', destId);
|
|
}).finally(() => {
|
|
this.set('publishing', false);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|