Redirect to register if not registered on plans page

This commit is contained in:
James Allen 2014-07-07 14:05:07 +01:00
parent 5f48105b04
commit 452098ca68
2 changed files with 14 additions and 28 deletions

View file

@ -14,11 +14,16 @@ module.exports = SubscriptionController =
plansPage: (req, res, next) -> plansPage: (req, res, next) ->
plans = SubscriptionViewModelBuilder.buildViewModel() plans = SubscriptionViewModelBuilder.buildViewModel()
if !req.session.user?
baseUrl = "/register?redir="
else
baseUrl = ""
viewName = "subscriptions/plans" viewName = "subscriptions/plans"
logger.log viewName:viewName, "showing plans page" logger.log viewName:viewName, "showing plans page"
res.render viewName, res.render viewName,
title: "Plans and Pricing" title: "Plans and Pricing"
plans: plans
baseUrl: baseUrl
#get to show the recurly.js page #get to show the recurly.js page
paymentPage: (req, res, next) -> paymentPage: (req, res, next) ->
@ -161,22 +166,3 @@ module.exports = SubscriptionController =
return next(error) if error? return next(error) if error?
req.body = body req.body = body
next() 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 -->
'''

View file

@ -11,7 +11,7 @@ block content
.row .row
.col-md-12 .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) .row(ng-cloak)
.col-md-12 .col-md-12
@ -62,7 +62,7 @@ block content
li li
br br
a.btn.btn-primary( 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! ) Sign up now!
.card .card
.card-header .card-header
@ -81,7 +81,7 @@ block content
li li
br br
a.btn.btn-primary( 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! ) Sign up now!
.card-group.text-centered(ng-if="ui.view == 'student'") .card-group.text-centered(ng-if="ui.view == 'student'")
@ -109,7 +109,7 @@ block content
li li
br br
a.btn.btn-primary( a.btn.btn-primary(
ng-href="/user/subscription/new?planCode=student" ng-href="#{baseUrl}/user/subscription/new?planCode=student"
) Sign up now! ) Sign up now!
.card .card
.card-header .card-header
@ -125,7 +125,7 @@ block content
li li
br br
a.btn.btn-primary( a.btn.btn-primary(
ng-href="/user/subscription/new?planCode=student_annual" ng-href="#{baseUrl}/user/subscription/new?planCode=student_annual"
) Sign up now! ) Sign up now!
.row(ng-cloak) .row(ng-cloak)
@ -175,7 +175,7 @@ block content
li.small All the advantages of the Professional account for each team member li.small All the advantages of the Professional account for each team member
li li
br 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.highlighted
.card-header .card-header
h2 Research Lab h2 Research Lab
@ -191,7 +191,7 @@ block content
li.small All the advantages of the Professional account for each team member li.small All the advantages of the Professional account for each team member
li li
br 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
.card-header .card-header
h2 Department h2 Department
@ -207,4 +207,4 @@ block content
li.small All the advantages of the Professional account for each team member li.small All the advantages of the Professional account for each team member
li li
br 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!