Răsfoiți Sursa

added custom user dashboard page

Henry Oswald 12 ani în urmă
părinte
comite
b90003b11e

+ 8 - 0
services/web/app/coffee/Features/Subscription/SubscriptionController.coffee

@@ -89,6 +89,14 @@ module.exports = SubscriptionController =
 							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) ->
 		SecurityManager.getCurrentUser req, (error, user) ->
 			return next(error) if error?

+ 3 - 0
services/web/app/coffee/Features/Subscription/SubscriptionRouter.coffee

@@ -10,6 +10,9 @@ module.exports =
 		app.get  '/user/subscription/plans',      SubscriptionController.plansPage
 
 		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/billing-details/edit', AuthenticationController.requireLogin(), SubscriptionController.editBillingDetailsPage

+ 15 - 0
services/web/app/views/subscriptions/custom_account.jade

@@ -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")}

+ 10 - 0
services/web/test/UnitTests/coffee/Subscription/SubscriptionControllerTests.coffee

@@ -193,6 +193,16 @@ describe "SubscriptionController sanboxed", ->
 			it "should redirect to /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", ->