Ghost/ghost/admin/app/components/settings/members-subscription-access.js
2021-05-25 14:00:22 +02:00

44 lines
1.3 KiB
JavaScript

import Component from '@glimmer/component';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
export default class SettingsMembersSubscriptionAccess extends Component {
@service settings;
get options() {
return [{
name: 'Anyone can sign up',
description: 'All visitors will be able to subscribe and sign in',
value: 'all',
icon: 'globe',
icon_color: 'green'
}, {
name: 'Only people I invite',
description: 'People can sign in from your site but won\'t be able to sign up',
value: 'invite',
icon: 'email-love-letter',
icon_color: 'blue'
}, {
name: 'Nobody',
description: 'No one will be able to subscribe or sign in',
value: 'none',
icon: 'no-members',
icon_color: 'midlightgrey-d2'
}];
}
get selectedOption() {
return this.options.find(o => o.value === this.settings.get('membersSignupAccess'));
}
@action
setSignupAccess(option) {
this.settings.set('membersSignupAccess', option.value);
this.args.onChange?.(option.value);
if (option.value === 'none') {
this.settings.set('defaultContentVisibility', 'public');
}
}
}