1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/components/gh-psm-visibility-input.js
Naz Gargol 6bbe7bb3d4
Content visibility configuration in labs (#1346)
no issue

- Changed members description to less verbose
- Added content visibility radio options to members configuration screen
- Moved setting of default visibility to server-side
- Default visibility setting when PSM is opened before making the first request to the server
2019-10-02 11:13:59 +02:00

32 lines
813 B
JavaScript

import Component from '@ember/component';
import {computed} from '@ember/object';
import {inject as service} from '@ember/service';
const VISIBILITIES = [
{label: 'Everyone', name: 'public'},
{label: 'Free and paying members', name: 'members'},
{label: 'Only paying members', name: 'paid'}
];
export default Component.extend({
settings: service(),
// public attrs
post: null,
selectedVisibility: computed('post.visibility', function () {
return this.get('post.visibility') || this.settings.get('defaultContentVisibility');
}),
init() {
this._super(...arguments);
this.availableVisibilities = VISIBILITIES;
},
actions: {
updateVisibility(newVisibility) {
this.post.set('visibility', newVisibility);
}
}
});