Browse Source

added ability to change currency on payment page

Henry Oswald 12 years ago
parent
commit
52c54e7300

+ 19 - 1
services/web/app/views/subscriptions/new.jade

@@ -1,4 +1,9 @@
 extends ../layout
+block scripts
+	script(type='text/javascript').
+		window.recomendedCurrency = '#{currency}'
+		window.plan_code = '#{plan_code}'
+
 
 block content
 	- locals.supressDefaultJs = true
@@ -8,11 +13,24 @@ block content
 	.content.content-alt
 		.container
 			.row
-				.col-md-6.col-md-offset-3
+				.col-md-6.col-md-offset-1
 					.card
 						.page-header
 							h1.text-centered #{translate("new_subscription")}
 						#subscribeForm #{translate("loading_billing_form")}...
+				.col-md-5(ng-controller="NewSubscriptionController")
+					span.dropdown.col-md-1.changePlanButton()
+						a.btn.btn-primary.dropdown-toggle(
+							href="#",
+							data-toggle="dropdown"
+						)
+							| {{currencyCode}} ({{plans[currencyCode]['symbol']}})
+						ul.dropdown-menu(role="menu")
+							li(ng-repeat="(currency, value) in plans", dropdown-toggle)
+								a(
+									ng-click="changeCurrency(currency)",
+								) {{currency}} ({{value['symbol']}})
+
 
 	script(type="text/javascript").
 		ga('send', 'event', 'pageview', 'payment_form', "#{plan_code}")

+ 1 - 0
services/web/public/coffee/main.coffee

@@ -11,6 +11,7 @@ define [
 	"main/system-messages"
 	"main/translations"
 	"main/subscription-dashboard"
+	"main/new-subscription"
 	"main/annual-upgrade"
 	"analytics/AbTestingManager"
 	"directives/asyncForm"

+ 12 - 0
services/web/public/coffee/main/new-subscription.coffee

@@ -0,0 +1,12 @@
+define [
+	"base"
+], (App)->
+
+	App.controller "NewSubscriptionController", ($scope, MultiCurrencyPricing)->
+
+	
+		$scope.currencyCode = MultiCurrencyPricing.currencyCode
+		$scope.plans = MultiCurrencyPricing.plans
+
+		$scope.changeCurrency = (newCurrency)->
+			window.location = "/user/subscription/new?planCode=#{window.plan_code}&currency=#{newCurrency}"