mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Updated setting model for new members_signup_access
setting
requires https://github.com/TryGhost/Ghost/pull/12886 - renamed `membersAllowFreeSignup` to `membersSignupAccess` and changed type to match new setting - added `membersAllowFreeSignup` computed property to map to the new setting to avoid having to migrate code elsewhere that will be removed once the new options are out of developer experiments
This commit is contained in:
parent
6986c4f424
commit
4e82ea38ea
3 changed files with 25 additions and 11 deletions
|
@ -8,7 +8,7 @@ export default class MembersAccessController extends Controller {
|
|||
@service settings;
|
||||
|
||||
@tracked showLeaveSettingsModal = false;
|
||||
@tracked subscriptionAccessOpen = false;
|
||||
@tracked signupAccessOpen = false;
|
||||
@tracked postAccessOpen = false;
|
||||
|
||||
leaveRoute(transition) {
|
||||
|
@ -33,8 +33,8 @@ export default class MembersAccessController extends Controller {
|
|||
}
|
||||
|
||||
@action
|
||||
toggleSubscriptionAccess() {
|
||||
this.subscriptionAccessOpen = !this.subscriptionAccessOpen;
|
||||
toggleSignupAccess() {
|
||||
this.signupAccessOpen = !this.signupAccessOpen;
|
||||
}
|
||||
|
||||
@action
|
||||
|
@ -48,9 +48,9 @@ export default class MembersAccessController extends Controller {
|
|||
}
|
||||
|
||||
@action
|
||||
setSubscriptionAccess(value) {
|
||||
setSignupAccess(value) {
|
||||
switch (value) {
|
||||
case 'anyone':
|
||||
case 'all':
|
||||
this.settings.set('membersAllowFreeSignup', true);
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* eslint-disable camelcase */
|
||||
import Model, {attr} from '@ember-data/model';
|
||||
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
||||
import {computed} from '@ember/object';
|
||||
|
||||
export default Model.extend(ValidationEngine, {
|
||||
validationType: 'setting',
|
||||
|
@ -52,7 +53,7 @@ export default Model.extend(ValidationEngine, {
|
|||
* Members settings
|
||||
*/
|
||||
defaultContentVisibility: attr('string'),
|
||||
membersAllowFreeSignup: attr('boolean'),
|
||||
membersSignupAccess: attr('string'),
|
||||
membersFromAddress: attr('string'),
|
||||
membersSupportAddress: attr('string'),
|
||||
membersReplyAddress: attr('string'),
|
||||
|
@ -74,5 +75,18 @@ export default Model.extend(ValidationEngine, {
|
|||
newsletterShowHeader: attr('boolean'),
|
||||
newsletterBodyFontCategory: attr('string'),
|
||||
newsletterShowBadge: attr('boolean'),
|
||||
newsletterFooterContent: attr('string')
|
||||
newsletterFooterContent: attr('string'),
|
||||
|
||||
// TODO: remove when Access screen with "Nobody" option is out of dev experiments
|
||||
membersAllowFreeSignup: computed('membersSignupAccess', {
|
||||
get() {
|
||||
const signupAccess = this.membersSignupAccess;
|
||||
return signupAccess === 'all' ? true : false;
|
||||
},
|
||||
set(key, allowFreeSignup) {
|
||||
const signupAccess = allowFreeSignup ? 'all' : 'invite';
|
||||
this.set('membersSignupAccess', signupAccess);
|
||||
return allowFreeSignup;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
<h4 class="gh-expandable-title">Subscription access</h4>
|
||||
<p class="gh-expandable-description">Who should be able to subscribe to your site?</p>
|
||||
</div>
|
||||
<button type="button" class="gh-btn" {{on "click" this.toggleSubscriptionAccess}} data-test-toggle="subscription-access"><span>{{if this.subscriptionAccessOpen "Close" "Expand"}}</span></button>
|
||||
<button type="button" class="gh-btn" {{on "click" this.toggleSignupAccess}} data-test-toggle="subscription-access"><span>{{if this.subscriptionAccessOpen "Close" "Expand"}}</span></button>
|
||||
</div>
|
||||
<div class="gh-expandable-content">
|
||||
{{#liquid-if this.subscriptionAccessOpen}}
|
||||
{{#liquid-if this.signupAccessOpen}}
|
||||
<div class="flex flex-column w-50">
|
||||
<div
|
||||
class="gh-radio {{if this.settings.membersAllowFreeSignup "active"}}"
|
||||
{{on "click" (fn this.setSubscriptionAccess "anyone")}}
|
||||
{{on "click" (fn this.setSignupAccess "all")}}
|
||||
>
|
||||
<div class="gh-radio-button"></div>
|
||||
<div class="gh-radio-content">
|
||||
|
@ -43,7 +43,7 @@
|
|||
|
||||
<div
|
||||
class="gh-radio {{if (not this.settings.membersAllowFreeSignup) "active"}}"
|
||||
{{on "click" (fn this.setSubscriptionAccess "invite")}}
|
||||
{{on "click" (fn this.setSignupAccess "invite")}}
|
||||
>
|
||||
<div class="gh-radio-button"></div>
|
||||
<div class="gh-radio-content">
|
||||
|
|
Loading…
Add table
Reference in a new issue