Ghost/ghost/admin/app/routes/billing.js
Aileen Nowak 7d616b0010 Move billing iFrame to render in main content area (#1838)
no issue

The billing iFrame needs to be rendered within the `main` content area rather than as fullscreen.

This needs most probably more tidying up, but is working for now without breaking the functionality.

* Move billing iFrame to render in main content area
* Fixed routing error when transistion url not defined
* Removed close modal button and esc key binding
2021-02-12 10:13:23 +00:00

49 lines
1.1 KiB
JavaScript

import Route from '@ember/routing/route';
import {inject as service} from '@ember/service';
export default Route.extend({
billing: service(),
queryParams: {
action: {refreshModel: true}
},
beforeModel(transition) {
this.billing.set('previousTransition', transition);
},
model(params) {
if (params.action) {
this.billing.set('action', params.action);
}
this.billing.setBillingWindowOpen(true);
},
actions: {
willTransition(transition) {
let isBillingTransition = false;
if (transition) {
let destinationUrl = (typeof transition.to === 'string')
? transition.to
: (transition.intent
? transition.intent.url
: '');
if (destinationUrl?.includes('/billing')) {
isBillingTransition = true;
}
}
this.billing.setBillingWindowOpen(isBillingTransition);
}
},
buildRouteInfoMetadata() {
return {
titleToken: 'Billing'
};
}
});