Просмотр исходного кода

Redirect to register if not registered on plans page

James Allen 12 лет назад
Родитель
Сommit
452098ca68

+ 6 - 20
services/web/app/coffee/Features/Subscription/SubscriptionController.coffee

@@ -14,11 +14,16 @@ module.exports = SubscriptionController =
 
 	plansPage: (req, res, next) ->
 		plans = SubscriptionViewModelBuilder.buildViewModel()
+		if !req.session.user?
+			baseUrl = "/register?redir="
+		else
+			baseUrl = ""
 		viewName = "subscriptions/plans"
 		logger.log viewName:viewName, "showing plans page"
 		res.render viewName,
 			title: "Plans and Pricing"
-
+			plans: plans
+			baseUrl: baseUrl
 
 	#get to show the recurly.js page
 	paymentPage: (req, res, next) ->
@@ -161,22 +166,3 @@ module.exports = SubscriptionController =
 				return next(error) if error?
 				req.body = body
 				next()
-
-
-gaExperimentCode = '''
-<!-- Google Analytics Content Experiment code -->
-<script>function utmx_section(){}function utmx(){}(function(){var
-k='51652689-2',d=document,l=d.location,c=d.cookie;
-if(l.search.indexOf('utm_expid='+k)>0)return;
-function f(n){if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.
-indexOf(';',i);return escape(c.substring(i+n.length+1,j<0?c.
-length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;d.write(
-'<sc'+'ript src="'+'http'+(l.protocol=='https:'?'s://ssl':
-'://www')+'.google-analytics.com/ga_exp.js?'+'utmxkey='+k+
-'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='+new Date().
-valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
-'" type="text/javascript" charset="utf-8"><\/sc'+'ript>')})();
-</script><script>utmx('url','A/B');</script>
-<!-- End of Google Analytics Content Experiment code -->
-
-'''

+ 8 - 8
services/web/app/views/subscriptions/plans.jade

@@ -11,7 +11,7 @@ block content
 
 				.row
 					.col-md-12
-						p.text-centered ShareLaTeX is the world's easiest to use LaTeX editor. You'll stay up to date with your collaborators, keep track of all changes to your work, and use our up to date and fast compiling environment from anywhere in the world.
+						p.text-centered ShareLaTeX is the world's easiest to use LaTeX editor. You'll stay up to date with your collaborators, keep track of all changes to your work, and use our LaTeX environment from anywhere in the world.
 
 				.row(ng-cloak)
 					.col-md-12
@@ -62,7 +62,7 @@ block content
 									li
 										br
 										a.btn.btn-primary(
-											ng-href="/user/subscription/new?planCode=collaborator{{ ui.view == 'annual' && '_annual' || ''}}"
+											ng-href="#{baseUrl}/user/subscription/new?planCode=collaborator{{ ui.view == 'annual' && '_annual' || ''}}"
 										) Sign up now!
 							.card
 								.card-header
@@ -81,7 +81,7 @@ block content
 									li
 										br
 										a.btn.btn-primary(
-											ng-href="/user/subscription/new?planCode=professional{{ ui.view == 'annual' && '_annual' || ''}}"
+											ng-href="#{baseUrl}/user/subscription/new?planCode=professional{{ ui.view == 'annual' && '_annual' || ''}}"
 										) Sign up now!
 
 						.card-group.text-centered(ng-if="ui.view == 'student'")
@@ -109,7 +109,7 @@ block content
 									li
 										br
 										a.btn.btn-primary(
-											ng-href="/user/subscription/new?planCode=student"
+											ng-href="#{baseUrl}/user/subscription/new?planCode=student"
 										) Sign up now!
 							.card
 								.card-header
@@ -125,7 +125,7 @@ block content
 									li
 										br
 										a.btn.btn-primary(
-											ng-href="/user/subscription/new?planCode=student_annual"
+											ng-href="#{baseUrl}/user/subscription/new?planCode=student_annual"
 										) Sign up now!
 
 				.row(ng-cloak)
@@ -175,7 +175,7 @@ block content
 									li.small All the advantages of the Professional account for each team member
 									li
 										br
-										a.btn.btn-primary(href="/user/subscription/new?planCode=group_5_members{{ ui.view == 'annual' && '_annual' || ''}}") Sign up now!
+										a.btn.btn-primary(href="#{baseUrl}/user/subscription/new?planCode=group_5_members{{ ui.view == 'annual' && '_annual' || ''}}") Sign up now!
 							.card.highlighted
 								.card-header
 									h2 Research Lab
@@ -191,7 +191,7 @@ block content
 									li.small All the advantages of the Professional account for each team member
 									li
 										br
-										a.btn.btn-primary(href="/user/subscription/new?planCode=group_10_members{{ ui.view == 'annual' && '_annual' || ''}}") Sign up now!
+										a.btn.btn-primary(href="#{baseUrl}/user/subscription/new?planCode=group_10_members{{ ui.view == 'annual' && '_annual' || ''}}") Sign up now!
 							.card
 								.card-header
 									h2 Department
@@ -207,4 +207,4 @@ block content
 									li.small All the advantages of the Professional account for each team member
 									li
 										br
-										a.btn.btn-primary(href="/user/subscription/new?planCode=group_20_members{{ ui.view == 'annual' && '_annual' || ''}}") Sign up now!
+										a.btn.btn-primary(href="#{baseUrl}/user/subscription/new?planCode=group_20_members{{ ui.view == 'annual' && '_annual' || ''}}") Sign up now!