2019-10-01 16:00:53 +03:00
|
|
|
import Component from '@ember/component';
|
2019-10-02 12:13:59 +03:00
|
|
|
import {computed} from '@ember/object';
|
|
|
|
import {inject as service} from '@ember/service';
|
2019-10-01 16:00:53 +03:00
|
|
|
|
|
|
|
const VISIBILITIES = [
|
2019-10-04 13:57:58 +03:00
|
|
|
{label: 'Public', name: 'public'},
|
|
|
|
{label: 'Members only', name: 'members'},
|
|
|
|
{label: 'Paid-members only', name: 'paid'}
|
2019-10-01 16:00:53 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
export default Component.extend({
|
|
|
|
|
2019-10-02 12:13:59 +03:00
|
|
|
settings: service(),
|
|
|
|
|
2019-10-01 16:00:53 +03:00
|
|
|
// public attrs
|
|
|
|
post: null,
|
|
|
|
|
2019-10-02 12:13:59 +03:00
|
|
|
selectedVisibility: computed('post.visibility', function () {
|
|
|
|
return this.get('post.visibility') || this.settings.get('defaultContentVisibility');
|
|
|
|
}),
|
|
|
|
|
2019-10-01 16:00:53 +03:00
|
|
|
init() {
|
|
|
|
this._super(...arguments);
|
|
|
|
this.availableVisibilities = VISIBILITIES;
|
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
updateVisibility(newVisibility) {
|
|
|
|
this.post.set('visibility', newVisibility);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|