0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fixed modal errors in stripe connect and member product

refs 909bd60db3

- The modal actions for glimmer modal components need to define `actions.confirm` separately and add confirmAction to handle both enter and manual confirmation
This commit is contained in:
Rishabh 2021-06-18 16:24:18 +05:30
parent 922e4e6b32
commit bc25dbdefa
3 changed files with 22 additions and 5 deletions

View file

@ -56,7 +56,7 @@ export default class ModalMemberProduct extends ModalComponent {
} }
@action @action
confirm() { confirmAction() {
return this.addProduct.perform(); return this.addProduct.perform();
} }
@ -89,4 +89,10 @@ export default class ModalMemberProduct extends ModalComponent {
this.closeModal(); this.closeModal();
return response; return response;
} }
actions = {
confirm() {
this.confirmAction(...arguments);
}
}
} }

View file

@ -1,7 +1,7 @@
<header class="modal-header" data-test-modal="webhook-form" {{will-destroy this.reset}}> <header class="modal-header" data-test-modal="webhook-form" {{will-destroy this.reset}}>
<h1 data-test-text="title">Connect with Stripe</h1> <h1 data-test-text="title">Connect with Stripe</h1>
</header> </header>
<button class="close" href title="Close" {{action "closeModal"}} {{action (optional this.noop) on="mouseDown"}}> <button class="close" href title="Close" {{action "confirm"}} {{action (optional this.noop) on="mouseDown"}}>
{{svg-jar "close"}} {{svg-jar "close"}}
</button> </button>
@ -19,7 +19,7 @@
{{#if this.settings.stripeConnectAccountId}} {{#if this.settings.stripeConnectAccountId}}
<button <button
class="gh-btn gh-btn-black" class="gh-btn gh-btn-black"
{{action "closeModal"}} {{action "confirm"}}
{{action (optional this.noop) on="mouseDown"}} {{action (optional this.noop) on="mouseDown"}}
data-test-button="stripe-connect-ok" data-test-button="stripe-connect-ok"
> >

View file

@ -20,6 +20,18 @@ export default class ModalStripeConnect extends ModalBase {
this.settings.set('stripeConnectIntegrationToken', undefined); this.settings.set('stripeConnectIntegrationToken', undefined);
} }
@action
close(event) {
event?.preventDefault?.();
this.closeModal();
}
@action
confirmAction() {
this.confirm();
this.close();
}
@action @action
updateSuccessModifier() { updateSuccessModifier() {
if (this.settings.get('stripeConnectAccountId')) { if (this.settings.get('stripeConnectAccountId')) {
@ -36,9 +48,8 @@ export default class ModalStripeConnect extends ModalBase {
actions = { actions = {
confirm() { confirm() {
if (this.settings.get('stripeConnectAccountId')) { if (this.settings.get('stripeConnectAccountId')) {
return this.send('closeModal'); return this.confirmAction();
} }
// noop - enter key shouldn't do anything // noop - enter key shouldn't do anything
} }
} }