Skip to content

Commit

Permalink
abstract canceled modal for subs
Browse files Browse the repository at this point in the history
  • Loading branch information
paglias committed Apr 29, 2019
1 parent 366c441 commit 40b2591
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 4 additions & 1 deletion website/client/components/group-plans/billing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ export default {
appState = JSON.parse(appState);
if (appState.groupPlanCanceled) {
removeLocalSetting(CONSTANTS.savedAppStateValues.SAVED_APP_STATE);
this.$root.$emit('habitica:group-plan-canceled', this.dateTerminated);
this.$root.$emit('habitica:subscription-canceled', {
dateTerminated: this.dateTerminated,
isGroup: true,
});
}
}
},
Expand Down
15 changes: 8 additions & 7 deletions website/client/components/group-plans/canceledModal.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template lang="pug">
b-modal#group-plan-canceled-modal(
b-modal#subscription-canceled-modal(
size='sm',
:hideFooter="true",
:modalClass="['modal-hidden-footer']"
Expand All @@ -9,10 +9,10 @@
.svg-icon.check(v-html="icons.check", v-once)
.row
.col-12.modal-body-col
h2(v-once) {{ $t('canceledGroupPlan') }}
h2 {{ $t(isGroup ? 'canceledGroupPlan' : 'subCanceledTitle') }}
.details-block
span
| {{ $t('groupPlanCanceled') }}
| {{ $t(isGroup ? 'groupPlanCanceled' : 'subCanceled') }}
br
strong {{ dateTerminated }}
span.auto-renew.small-text(v-once) {{ $t('paymentCanceledDisputes') }}
Expand Down Expand Up @@ -131,17 +131,18 @@ export default {
...mapState({user: 'user.data'}),
},
mounted () {
this.$root.$on('habitica:group-plan-canceled', (dateTerminated) => {
this.$root.$on('habitica:subscription-canceled', ({dateTerminated, isGroup}) => {
this.dateTerminated = dateTerminated;
this.$root.$emit('bv::show::modal', 'group-plan-canceled-modal');
this.isGroup = isGroup;
this.$root.$emit('bv::show::modal', 'subscription-canceled-modal');
});
},
destroyed () {
this.$root.$off('habitica:group-plan-canceled');
this.$root.$off('habitica:subscription-canceled');
},
methods: {
close () {
this.$root.$emit('bv::hide::modal', 'group-plan-canceled-modal');
this.$root.$emit('bv::hide::modal', 'subscription-canceled-modal');
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion website/common/locales/en/subscriber.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
"invalidCoupon": "Invalid coupon code.",
"couponUsed": "Coupon code already used.",
"couponCodeRequired": "The coupon code is required.",
"paypalCanceled": "Your subscription has been canceled",
"subCanceledTitle": "Subscription Canceled",
"earnGemsMonthly": "Earn up to **<%= cap %> Gems** per month",
"receiveMysticHourglass": "Receive a Mystic Hourglass!",
"receiveMysticHourglasses": "Receive **<%= amount %> Mystic Hourglasses**!",
Expand Down

0 comments on commit 40b2591

Please sign in to comment.