diff --git a/services/web/app/views/subscriptions/new.jade b/services/web/app/views/subscriptions/new.jade index 3926847169..1e05ef1d66 100644 --- a/services/web/app/views/subscriptions/new.jade +++ b/services/web/app/views/subscriptions/new.jade @@ -46,7 +46,7 @@ block content h2.pull-right {{price}} span.pull-right every {{billingCycleType}} - input(type='text', data-recurly='coupon') + input(type='text', ng-blur="applyCoupon()", ng-model="data.coupon") diff --git a/services/web/public/coffee/main/new-subscription.coffee b/services/web/public/coffee/main/new-subscription.coffee index a1d106f723..7369c5ff72 100644 --- a/services/web/public/coffee/main/new-subscription.coffee +++ b/services/web/public/coffee/main/new-subscription.coffee @@ -8,13 +8,12 @@ define [ $scope.currencyCode = MultiCurrencyPricing.currencyCode $scope.plans = MultiCurrencyPricing.plans - $scope.changeCurrency = (newCurrency)-> - $scope.currencyCode = newCurrency - updatePlan() + $scope.switchToStudent = ()-> window.location = "/user/subscription/new?planCode=student¤cy=#{$scope.currencyCode}" + __api_key = recurlyCreds.apiKey configured = false $scope.error = false @@ -37,11 +36,14 @@ define [ $scope.planName = "no yet set" - updatePlan = -> - pricing.plan(window.plan_code, { quantity: 1 }).currency($scope.currencyCode).done() + pricing.plan(window.plan_code, { quantity: 1 }).currency($scope.currencyCode).done() - updatePlan() + $scope.applyCoupon = -> + pricing.coupon($scope.data.coupon).done() + $scope.changeCurrency = (newCurrency)-> + $scope.currencyCode = newCurrency + pricing.currency(newCurrency).done() pricing.on "change", => $scope.planName = pricing.items.plan.name