From d5cf8f6886c4c30982f42cef9fc10dbc2635f06a Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 9 Dec 2015 13:58:26 +0000 Subject: [PATCH] simplified cancelation logic --- services/web/app/views/subscriptions/dashboard.jade | 6 +++--- .../public/coffee/main/subscription-dashboard.coffee | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/services/web/app/views/subscriptions/dashboard.jade b/services/web/app/views/subscriptions/dashboard.jade index 7e9741b5fe..a6abb75649 100644 --- a/services/web/app/views/subscriptions/dashboard.jade +++ b/services/web/app/views/subscriptions/dashboard.jade @@ -111,7 +111,7 @@ block content span(ng-if="sixpackOpt == 'downgrade-options'") - div(ng-show="isMonthlyCollab && stillInFreeTrial", style="text-align: center") + div(ng-show="showExtendFreeTrial", style="text-align: center") p !{translate("have_more_days_to_try", {days:14})} button(type="submit", ng-click="exendTrial()", ng-disabled='inflight').btn.btn-success #{translate("ill_take_it")} p @@ -120,7 +120,7 @@ block content a(href, ng-click="cancelSubscription()", ng-disabled='inflight') #{translate("no_thanks_cancel_now")} - div(ng-show="isMonthlyCollab && !stillInFreeTrial", style="text-align: center") + div(ng-show="showDowngradeToStudent", style="text-align: center") span(ng-controller="ChangePlanFormController") p !{translate("interested_in_cheaper_plan",{price:'{{studentPrice}}'})} @@ -130,7 +130,7 @@ block content p a(href, ng-click="cancelSubscription()", ng-disabled='inflight') #{translate("no_thanks_cancel_now")} - div(ng-show="!isMonthlyCollab && !stillInFreeTrial") + div(ng-show="showBasicCancel") p #{translate("sure_you_want_to_cancel")} a(href="/project").btn.btn-info #{translate("i_want_to_stay")} |   diff --git a/services/web/public/coffee/main/subscription-dashboard.coffee b/services/web/public/coffee/main/subscription-dashboard.coffee index c9e61cb9e8..2071d6fec7 100644 --- a/services/web/public/coffee/main/subscription-dashboard.coffee +++ b/services/web/public/coffee/main/subscription-dashboard.coffee @@ -85,8 +85,15 @@ define [ freeTrialExpiresUnderSevenDays = freeTrialEndDate < sevenDaysTime $scope.view = 'overview' - $scope.isMonthlyCollab = subscription?.planCode?.indexOf("collaborator") != -1 and subscription?.planCode?.indexOf("ann") == -1 - $scope.stillInFreeTrial = freeTrialInFuture and freeTrialExpiresUnderSevenDays + isMonthlyCollab = subscription?.planCode?.indexOf("collaborator") != -1 and subscription?.planCode?.indexOf("ann") == -1 + stillInFreeTrial = freeTrialInFuture and freeTrialExpiresUnderSevenDays + + if isMonthlyCollab and stillInFreeTrial + $scope.showExtendFreeTrial = true + else if isMonthlyCollab and !stillInFreeTrial + $scope.showDowngradeToStudent = true + else + $scope.showBasicCancel = true setupReturly()