mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Wired up welcome_page_url to Tier modal
refs https://github.com/TryGhost/Team/issues/1168 This allows users to set the welcome page url on a tier by tier basis rather than globally for all paid tiers or all free tiers.
This commit is contained in:
parent
dc8b5542d4
commit
41c138640a
3 changed files with 42 additions and 4 deletions
|
@ -137,10 +137,16 @@
|
|||
<h4 class="gh-main-section-header small bn">Advanced</h4>
|
||||
<div class="gh-main-section-content grey gh-product-priceform-block">
|
||||
<GhFormGroup>
|
||||
<label for="" class="fw6">Welcome page</label>
|
||||
<GhTextInput
|
||||
@class="gh-input" />
|
||||
<p>Redirect to this URL after signup for premium membership</p>
|
||||
<label for="welcomePage" class="fw6">Welcome page</label>
|
||||
<GhUrlInput
|
||||
@id="welcomePage"
|
||||
@value={{readonly this.model.product.welcomePageURL}}
|
||||
@baseUrl={{readonly this.siteUrl}}
|
||||
@setResult={{this.setWelcomePageURL}}
|
||||
@validateUrl={{this.validateWelcomePageURL}}
|
||||
@placeholder={{readonly this.siteUrl}}
|
||||
/>
|
||||
<p>Redirect to this URL after signup for premium membership</p>
|
||||
</GhFormGroup>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -21,6 +21,7 @@ const CURRENCIES = currencies.map((currency) => {
|
|||
@classic
|
||||
export default class ModalProductPrice extends ModalBase {
|
||||
@service settings;
|
||||
@service config;
|
||||
@tracked model;
|
||||
@tracked product;
|
||||
@tracked periodVal;
|
||||
|
@ -31,6 +32,7 @@ export default class ModalProductPrice extends ModalBase {
|
|||
@tracked stripePlanError = '';
|
||||
@tracked benefits = emberA([]);
|
||||
@tracked newBenefit = null;
|
||||
@tracked welcomePageURL
|
||||
|
||||
confirm() {}
|
||||
|
||||
|
@ -76,6 +78,31 @@ export default class ModalProductPrice extends ModalBase {
|
|||
});
|
||||
}
|
||||
|
||||
@action
|
||||
validateWelcomePageURL() {
|
||||
const siteUrl = this.siteUrl;
|
||||
|
||||
if (this.welcomePageURL === undefined) {
|
||||
// Not initialised
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.welcomePageURL.href.startsWith(siteUrl)) {
|
||||
const path = this.welcomePageURL.href.replace(siteUrl, '');
|
||||
this.model.product.welcomePageURL = path;
|
||||
} else {
|
||||
this.model.product.welcomePageURL = this.welcomePageURL.href;
|
||||
}
|
||||
}
|
||||
|
||||
get siteUrl() {
|
||||
return this.config.get('blogUrl');
|
||||
}
|
||||
|
||||
get welcomePageURL() {
|
||||
return this.model.product.welcomePageURL;
|
||||
}
|
||||
|
||||
get title() {
|
||||
if (this.isExistingProduct) {
|
||||
if (this.isFreeProduct) {
|
||||
|
@ -101,6 +128,10 @@ export default class ModalProductPrice extends ModalBase {
|
|||
const newCurrency = event.value;
|
||||
this.currency = newCurrency;
|
||||
}
|
||||
@action
|
||||
setWelcomePageURL(url) {
|
||||
this.welcomePageURL = url;
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.newBenefit = ProductBenefitItem.create({isNew: true, name: ''});
|
||||
|
|
|
@ -8,6 +8,7 @@ export default Model.extend(ValidationEngine, {
|
|||
description: attr('string'),
|
||||
active: attr('boolean'),
|
||||
slug: attr('string'),
|
||||
welcomePageURL: attr('string'),
|
||||
type: attr('string', {defaultValue: 'paid'}),
|
||||
monthlyPrice: attr('stripe-price'),
|
||||
yearlyPrice: attr('stripe-price'),
|
||||
|
|
Loading…
Add table
Reference in a new issue