mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Removed unused members-payments route
no issue - stripe connect/disconnect functionality has moved to a modal as part of the new membership screen - removed `settings/members-payments` route and related route/controller/template files - updated link to stripe connect in product screen to show an alert as a reminder to update to use the new modal (products screens are not usable for now, they'll be worked on again later)
This commit is contained in:
parent
9000317acd
commit
29dc178261
6 changed files with 9 additions and 135 deletions
|
@ -1,54 +0,0 @@
|
|||
/* eslint-disable ghost/ember/alias-model-in-controller */
|
||||
import Controller from '@ember/controller';
|
||||
import {action} from '@ember/object';
|
||||
import {inject as service} from '@ember/service';
|
||||
import {task} from 'ember-concurrency-decorators';
|
||||
import {tracked} from '@glimmer/tracking';
|
||||
|
||||
export default class MembersPaymentsController extends Controller {
|
||||
@service settings;
|
||||
|
||||
@tracked showLeaveSettingsModal = false;
|
||||
|
||||
@action
|
||||
setDefaultContentVisibility(value) {
|
||||
this.settings.set('defaultContentVisibility', value);
|
||||
}
|
||||
|
||||
@action
|
||||
setStripeConnectIntegrationTokenSetting(stripeConnectIntegrationToken) {
|
||||
this.settings.set('stripeConnectIntegrationToken', stripeConnectIntegrationToken);
|
||||
}
|
||||
|
||||
@task({drop: true})
|
||||
*saveSettings() {
|
||||
return yield this.settings.save();
|
||||
}
|
||||
|
||||
leaveRoute(transition) {
|
||||
if (this.settings.get('hasDirtyAttributes')) {
|
||||
transition.abort();
|
||||
this.leaveSettingsTransition = transition;
|
||||
this.showLeaveSettingsModal = true;
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
async confirmLeave() {
|
||||
this.settings.rollbackAttributes();
|
||||
this.showLeaveSettingsModal = false;
|
||||
this.leaveSettingsTransition.retry();
|
||||
}
|
||||
|
||||
@action
|
||||
cancelLeave() {
|
||||
this.showLeaveSettingsModal = false;
|
||||
this.leaveSettingsTransition = null;
|
||||
}
|
||||
|
||||
reset() {
|
||||
// stripeConnectIntegrationToken is not a persisted value so we don't want
|
||||
// to keep it around across transitions
|
||||
this.settings.set('stripeConnectIntegrationToken', undefined);
|
||||
}
|
||||
}
|
|
@ -5,8 +5,9 @@ import {task} from 'ember-concurrency-decorators';
|
|||
import {tracked} from '@glimmer/tracking';
|
||||
|
||||
export default class ProductController extends Controller {
|
||||
@service settings;
|
||||
@service config;
|
||||
@service membersUtils;
|
||||
@service settings;
|
||||
|
||||
@tracked showLeaveSettingsModal = false;
|
||||
@tracked showPriceModal = false;
|
||||
|
@ -100,6 +101,11 @@ export default class ProductController extends Controller {
|
|||
this.send('savePrice', price);
|
||||
}
|
||||
|
||||
@action
|
||||
openStripeConnect() {
|
||||
alert('Update to use stripe-connect modal (see memberships screen)');
|
||||
}
|
||||
|
||||
@action
|
||||
async confirmLeave() {
|
||||
this.settings.rollbackAttributes();
|
||||
|
|
|
@ -50,7 +50,6 @@ Router.map(function () {
|
|||
this.route('settings.general', {path: '/settings/general'});
|
||||
this.route('settings.membership', {path: '/settings/members'});
|
||||
this.route('settings.members-email', {path: '/settings/members-email'});
|
||||
this.route('settings.members-payments', {path: '/settings/members-payments'});
|
||||
this.route('settings.code-injection', {path: '/settings/code-injection'});
|
||||
|
||||
this.route('settings.products', {path: '/settings/products'});
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default class MembersPaymentsRoute extends AuthenticatedRoute {
|
||||
@service session;
|
||||
@service settings;
|
||||
|
||||
beforeModel() {
|
||||
super.beforeModel(...arguments);
|
||||
|
||||
return this.session.get('user').then((user) => {
|
||||
if (!user.isOwner && user.isAdmin) {
|
||||
return this.transitionTo('settings');
|
||||
} else if (!user.isOwner) {
|
||||
return this.transitionTo('home');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
model() {
|
||||
return this.settings.reload();
|
||||
}
|
||||
|
||||
actions = {
|
||||
willTransition(transition) {
|
||||
return this.controller.leaveRoute(transition);
|
||||
}
|
||||
}
|
||||
|
||||
resetController(controller, isExiting) {
|
||||
if (isExiting) {
|
||||
controller.reset();
|
||||
}
|
||||
}
|
||||
|
||||
buildRouteInfoMetadata() {
|
||||
return {
|
||||
titleToken: 'Settings - Members'
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
<section class="gh-canvas">
|
||||
<GhCanvasHeader class="gh-canvas-header">
|
||||
<h2 class="gh-canvas-title" data-test-screen-title>
|
||||
<LinkTo @route="settings">Settings</LinkTo>
|
||||
<span>{{svg-jar "arrow-right"}}</span>
|
||||
Payments
|
||||
</h2>
|
||||
<section class="view-actions">
|
||||
<GhTaskButton @buttonText="Save settings"
|
||||
@task={{this.saveSettings}}
|
||||
@successText="Saved"
|
||||
@runningText="Saving"
|
||||
@class="gh-btn gh-btn-primary gh-btn-icon"
|
||||
data-test-button="save-members-settings"
|
||||
/>
|
||||
</section>
|
||||
</GhCanvasHeader>
|
||||
|
||||
<section class="view-container settings-debug">
|
||||
<div class="gh-setting-liquid-section">
|
||||
<GhMembersPaymentsSetting
|
||||
@setDefaultContentVisibility={{this.setDefaultContentVisibility}}
|
||||
@setStripeConnectIntegrationTokenSetting={{this.setStripeConnectIntegrationTokenSetting}}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{{#if this.showLeaveSettingsModal}}
|
||||
<GhFullscreenModal
|
||||
@modal="leave-settings"
|
||||
@confirm={{this.confirmLeave}}
|
||||
@close={{this.cancelLeave}}
|
||||
@modifier="action wide"
|
||||
/>
|
||||
{{/if}}
|
||||
</section>
|
|
@ -75,7 +75,7 @@
|
|||
<td colspan="4" class="gh-list-data">
|
||||
<div class="gh-price-list-noprices">
|
||||
<div class="mb2">There are no prices for this product</div>
|
||||
{{#if this.settings.stripeConnectAccountId}}
|
||||
{{#if this.membersUtils.isStripeEnabled}}
|
||||
{{#unless this.product.isNew}}
|
||||
<button type="button" class="gh-btn gh-btn-green" {{action "openNewPrice"}}
|
||||
disabled={{this.saveTask.isRunning}} >
|
||||
|
@ -83,7 +83,7 @@
|
|||
</button>
|
||||
{{/unless}}
|
||||
{{else}}
|
||||
You need to <LinkTo class="gh-setting-group" @route="settings.members-payments" data-test-nav="members-payments">connect to Stripe</LinkTo> to add prices
|
||||
You need to <button class="b gh-setting-group" {{on "click" this.openStripeConnect}}>connect to Stripe</button> to add prices
|
||||
{{/if}}
|
||||
</div>
|
||||
</td>
|
||||
|
|
Loading…
Add table
Reference in a new issue