Added "Nobody" option to members signup access

refs https://github.com/TryGhost/Team/issues/579

- adds "Nobody" option that will set `members_signup_access` setting to `'none'`
- when selected also sets `default_content_visibility` setting to `'public'`, expands it if collapsed and disables other options (that setting doesn't make sense when members is disabled, individual post access can still be set manually if needed)
This commit is contained in:
Kevin Ansfield 2021-04-19 11:34:20 +01:00
parent 4e82ea38ea
commit 889f90f494
3 changed files with 43 additions and 30 deletions

View File

@ -44,19 +44,17 @@ export default class MembersAccessController extends Controller {
@action
setDefaultContentVisibility(value) {
this.settings.set('defaultContentVisibility', value);
if (this.settings.get('membersSignupAccess') !== 'none') {
this.settings.set('defaultContentVisibility', value);
}
}
@action
setSignupAccess(value) {
switch (value) {
case 'all':
this.settings.set('membersAllowFreeSignup', true);
break;
case 'invite':
this.settings.set('membersAllowFreeSignup', false);
break;
this.settings.set('membersSignupAccess', value);
if (value === 'none') {
this.settings.set('defaultContentVisibility', 'public');
this.postAccessOpen = true;
}
}

View File

@ -49,6 +49,10 @@ input {
color: var(--red);
}
.disabled-overlay {
pointer-events: none;
opacity: 0.5;
}
/* Form Groups
/* ---------------------------------------------------------- */

View File

@ -31,7 +31,7 @@
{{#liquid-if this.signupAccessOpen}}
<div class="flex flex-column w-50">
<div
class="gh-radio {{if this.settings.membersAllowFreeSignup "active"}}"
class="gh-radio {{if (eq this.settings.membersSignupAccess "all") "active"}}"
{{on "click" (fn this.setSignupAccess "all")}}
>
<div class="gh-radio-button"></div>
@ -42,7 +42,7 @@
</div>
<div
class="gh-radio {{if (not this.settings.membersAllowFreeSignup) "active"}}"
class="gh-radio {{if (eq this.settings.membersSignupAccess "invite") "active"}}"
{{on "click" (fn this.setSignupAccess "invite")}}
>
<div class="gh-radio-button"></div>
@ -51,6 +51,17 @@
<small class="midgrey">People can sign in from your site but won't be able to sign up</small>
</div>
</div>
<div
class="gh-radio {{if (eq this.settings.membersSignupAccess "none") "active"}}"
{{on "click" (fn this.setSignupAccess "none")}}
>
<div class="gh-radio-button"></div>
<div class="gh-radio-content">
<div class="gh-radio-label">Nobody</div>
<small class="midgrey">No one will be able to subscribe or sign in</small>
</div>
</div>
</div>
{{/liquid-if}}
</div>
@ -79,26 +90,26 @@
<small class="midgrey">All site visitors to your site, no login required</small></div>
</div>
</div>
<div
class="gh-radio {{if (eq this.settings.defaultContentVisibility "members") "active"}}"
{{on "click" (fn this.setDefaultContentVisibility "members")}}
>
<div class="gh-radio-button"></div>
<div class="gh-radio-content">
<div class="gh-radio-label">Members only<br>
<small class="midgrey">All logged-in members</small></div>
<div class="{{if (eq this.settings.membersSignupAccess "none") "disabled-overlay"}}">
<div
class="gh-radio {{if (eq this.settings.defaultContentVisibility "members") "active"}}"
{{on "click" (fn this.setDefaultContentVisibility "members")}}
>
<div class="gh-radio-button"></div>
<div class="gh-radio-content">
<div class="gh-radio-label">Members only<br>
<small class="midgrey">All logged-in members</small></div>
</div>
</div>
</div>
<div
class="gh-radio {{if (eq this.settings.defaultContentVisibility "paid") "active"}}"
{{on "click" (fn this.setDefaultContentVisibility "paid")}}
>
<div class="gh-radio-button"></div>
<div class="gh-radio-content">
<div class="gh-radio-label">Paid-members only<br>
<small class="midgrey">Only logged-in members with an active Stripe subscription</small></div>
<div
class="gh-radio {{if (eq this.settings.defaultContentVisibility "paid") "active"}}"
{{on "click" (fn this.setDefaultContentVisibility "paid")}}
>
<div class="gh-radio-button"></div>
<div class="gh-radio-content">
<div class="gh-radio-label">Paid-members only<br>
<small class="midgrey">Only logged-in members with an active Stripe subscription</small></div>
</div>
</div>
</div>
</div>