added custom user dashboard page

This commit is contained in:
Henry Oswald 2014-10-10 15:44:53 +01:00
parent 3ba3a91043
commit b90003b11e
4 changed files with 36 additions and 0 deletions

View file

@ -89,6 +89,14 @@ module.exports = SubscriptionController =
subscriptionTabActive: true subscriptionTabActive: true
userCustomSubscriptionPage: (req, res, next)->
SecurityManager.getCurrentUser req, (error, user) ->
LimitationsManager.userHasSubscriptionOrIsGroupMember user, (err, hasSubOrIsGroupMember, subscription)->
res.render "subscriptions/custom_account",
title: "your_subscription"
subscription: subscription
editBillingDetailsPage: (req, res, next) -> editBillingDetailsPage: (req, res, next) ->
SecurityManager.getCurrentUser req, (error, user) -> SecurityManager.getCurrentUser req, (error, user) ->
return next(error) if error? return next(error) if error?

View file

@ -11,6 +11,9 @@ module.exports =
app.get '/user/subscription', AuthenticationController.requireLogin(), SubscriptionController.userSubscriptionPage app.get '/user/subscription', AuthenticationController.requireLogin(), SubscriptionController.userSubscriptionPage
app.get '/user/subscription/custom_account', AuthenticationController.requireLogin(), SubscriptionController.userCustomSubscriptionPage
app.get '/user/subscription/new', AuthenticationController.requireLogin(), SubscriptionController.paymentPage app.get '/user/subscription/new', AuthenticationController.requireLogin(), SubscriptionController.paymentPage
app.get '/user/subscription/billing-details/edit', AuthenticationController.requireLogin(), SubscriptionController.editBillingDetailsPage app.get '/user/subscription/billing-details/edit', AuthenticationController.requireLogin(), SubscriptionController.editBillingDetailsPage

View file

@ -0,0 +1,15 @@
extends ../layout
block content
.content.content-alt
.container
.row
.col-md-8.col-md-offset-2
.card
.page-header
h1 #{translate("your_subscription")}
div To make changes to your subscription please contact team@sharelatex.com
div  
div
-if(subscription.groupPlan)
a(href="/subscription/group").btn.btn-success !{translate("manage_group")}

View file

@ -193,6 +193,16 @@ describe "SubscriptionController sanboxed", ->
it "should redirect to /user/subscription/custom_account", -> it "should redirect to /user/subscription/custom_account", ->
@res.redirectedTo.should.equal("/user/subscription/custom_account") @res.redirectedTo.should.equal("/user/subscription/custom_account")
describe "userCustomSubscriptionPage", ->
beforeEach (done) ->
@res.callback = done
@LimitationsManager.userHasSubscriptionOrIsGroupMember.callsArgWith(1, null, true)
@SubscriptionController.userCustomSubscriptionPage @req, @res
it "should render the page", (done)->
@res.rendered.should.equal true
@res.renderedTemplate.should.equal "subscriptions/custom_account"
done()
describe "createSubscription", -> describe "createSubscription", ->