From 79e7f82a36351404c11f5f12bfba3f13fac7b207 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 6 Feb 2015 16:54:11 +0000 Subject: [PATCH] only setup recurly once for subscription dashboard and apply async to make sure updates on pricing are applied --- .../public/coffee/main/subscription-dashboard.coffee | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/services/web/public/coffee/main/subscription-dashboard.coffee b/services/web/public/coffee/main/subscription-dashboard.coffee index dcedd15fba..6f3f538422 100644 --- a/services/web/public/coffee/main/subscription-dashboard.coffee +++ b/services/web/public/coffee/main/subscription-dashboard.coffee @@ -2,7 +2,10 @@ define [ "base" ], (App)-> SUBSCRIPTION_URL = "/user/subscription/update" - recurly.configure window.recurlyApiKey + + setupReturly = _.once -> + recurly?.configure window.recurlyApiKey + App.controller "CurrenyDropdownController", ($scope, MultiCurrencyPricing, $q)-> @@ -14,7 +17,7 @@ define [ App.controller "ChangePlanFormController", ($scope, $modal, MultiCurrencyPricing)-> - + setupReturly() taxRate = window.taxRate @@ -41,7 +44,9 @@ define [ pricing = recurly.Pricing() pricing.plan(planCode, { quantity: 1 }).done (price)-> totalPriceExTax = parseFloat(price.next.total) - $scope.prices[planCode] = $scope.currencySymbol + (totalPriceExTax + (totalPriceExTax * taxRate)) + $scope.$evalAsync () -> + $scope.prices[planCode] = $scope.currencySymbol + (totalPriceExTax + (totalPriceExTax * taxRate)) + price = ""