2021-05-14 17:01:50 +03:00
|
|
|
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;
|
|
|
|
|
2021-05-14 17:44:10 +03:00
|
|
|
get options() {
|
|
|
|
return [{
|
|
|
|
name: 'Anyone can sign up',
|
|
|
|
description: 'All visitors will be able to subscribe and sign in',
|
2021-05-17 11:42:44 +03:00
|
|
|
value: 'all',
|
|
|
|
icon: 'globe',
|
|
|
|
icon_color: 'green'
|
2021-05-14 17:44:10 +03:00
|
|
|
}, {
|
|
|
|
name: 'Only people I invite',
|
|
|
|
description: 'People can sign in from your site but won\'t be able to sign up',
|
2021-05-17 11:42:44 +03:00
|
|
|
value: 'invite',
|
2021-05-17 20:36:36 +03:00
|
|
|
icon: 'email-love-letter',
|
2021-05-18 16:10:42 +03:00
|
|
|
icon_color: 'blue'
|
2021-05-14 17:44:10 +03:00
|
|
|
}, {
|
|
|
|
name: 'Nobody',
|
2022-02-11 11:29:11 +03:00
|
|
|
description: 'Disable all member features, including newsletters',
|
2021-05-17 11:42:44 +03:00
|
|
|
value: 'none',
|
2021-05-18 16:10:42 +03:00
|
|
|
icon: 'no-members',
|
2021-05-25 15:00:14 +03:00
|
|
|
icon_color: 'midlightgrey-d2'
|
2021-05-14 17:44:10 +03:00
|
|
|
}];
|
|
|
|
}
|
2021-05-14 17:01:50 +03:00
|
|
|
|
2021-05-14 17:44:10 +03:00
|
|
|
get selectedOption() {
|
2022-10-07 16:23:21 +03:00
|
|
|
return this.options.find(o => o.value === this.settings.membersSignupAccess);
|
2021-05-14 17:01:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
2021-05-14 17:44:10 +03:00
|
|
|
setSignupAccess(option) {
|
2022-10-07 16:23:21 +03:00
|
|
|
this.settings.membersSignupAccess = option.value;
|
2021-05-18 15:59:47 +03:00
|
|
|
this.args.onChange?.(option.value);
|
2021-05-14 17:44:10 +03:00
|
|
|
|
|
|
|
if (option.value === 'none') {
|
2022-10-07 16:23:21 +03:00
|
|
|
this.settings.defaultContentVisibility = 'public';
|
2021-05-14 17:44:10 +03:00
|
|
|
}
|
2021-05-14 17:01:50 +03:00
|
|
|
}
|
|
|
|
}
|