mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-01 02:41:39 -05:00
Handled new modal settings for basic customization
no issue - Uses `show_beacon` setting to show/hide the default beacon - Uses `show_signup_name` setting to show/hide the signup name - Uses `allowed_plans` to show/hide the plans
This commit is contained in:
parent
905bc30a90
commit
6c8c77de5d
2 changed files with 18 additions and 5 deletions
|
@ -245,7 +245,8 @@ export default class App extends React.Component {
|
|||
}
|
||||
|
||||
renderTriggerButton() {
|
||||
if (!this.customTriggerButtons || this.customTriggerButtons.length === 0) {
|
||||
const {site} = this.state;
|
||||
if (site.show_beacon === undefined || site.show_beacon) {
|
||||
return (
|
||||
<TriggerButton
|
||||
isPopupOpen={this.state.showPopup}
|
||||
|
|
|
@ -66,7 +66,7 @@ class SignupPage extends React.Component {
|
|||
}
|
||||
|
||||
renderPlans() {
|
||||
const {plans, allowSelfSignup, isStripeConfigured} = this.context.site;
|
||||
const {plans, allowSelfSignup, isStripeConfigured, allowed_plans: allowedPlans} = this.context.site;
|
||||
|
||||
const plansData = [];
|
||||
const stripePlans = [
|
||||
|
@ -74,12 +74,16 @@ class SignupPage extends React.Component {
|
|||
{type: 'year', price: plans.yearly, currency: plans.currency_symbol, name: 'Yearly'}
|
||||
];
|
||||
|
||||
if (isStripeConfigured && allowSelfSignup) {
|
||||
if (allowSelfSignup && (allowedPlans === undefined || allowedPlans.includes('free'))) {
|
||||
plansData.push({type: 'free', price: 'Decide later', name: 'Free'});
|
||||
}
|
||||
|
||||
if (isStripeConfigured) {
|
||||
stripePlans.forEach(plan => plansData.push(plan));
|
||||
stripePlans.forEach((plan) => {
|
||||
if (allowedPlans === undefined || allowedPlans.includes(plan.name.toLowerCase())) {
|
||||
plansData.push(plan);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -127,10 +131,18 @@ class SignupPage extends React.Component {
|
|||
);
|
||||
}
|
||||
|
||||
renderNameField() {
|
||||
const {site} = this.context;
|
||||
if (site.show_signup_name === undefined || site.show_signup_name) {
|
||||
return this.renderInputField('name');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
renderForm() {
|
||||
return (
|
||||
<div style={{display: 'flex', flexDirection: 'column', marginBottom: '12px', padding: '0 18px'}}>
|
||||
{this.renderInputField('name')}
|
||||
{this.renderNameField()}
|
||||
{this.renderInputField('email')}
|
||||
{this.renderPlans()}
|
||||
{this.renderSubmitButton()}
|
||||
|
|
Loading…
Add table
Reference in a new issue