Henry Oswald 10 лет назад
Родитель
Сommit
6e9458e9e1

+ 19 - 0
services/web/app/coffee/infrastructure/ExpressLocals.coffee

@@ -189,6 +189,25 @@ module.exports = (app, webRouter, apiRouter)->
 			return AuthenticationController.isUserLoggedIn(req)
 		res.locals.getSessionUser = ->
 			return AuthenticationController.getSessionUser(req)
+
+		res.locals.caseStudyToShow = ->
+			Settings.caseStudysToShow = [
+				{
+					url:"http://www.sharelatex.com/i/university/indiana",
+					domains: ["sharelatex.com", 'chicargo.edu'],
+					title: "Indiana University Case Study",
+					logo:"/img/crests/logo/iu.png"
+				}
+
+			]
+
+			caseStudy = _.filter Settings.caseStudysToShow, (caseStudy)->
+				matches = _.filter caseStudy.domains, (domain)->
+					email = AuthenticationController.getSessionUser(req)?.email
+					return email.indexOf(domain) != -1
+				return matches.length > 0
+
+			return caseStudy?[0] or {}
 		next()
 
 	webRouter.use (req, res, next) ->

+ 2 - 1
services/web/app/views/project/list.jade

@@ -10,7 +10,8 @@ block content
 		window.data = {
 			projects: !{JSON.stringify(projects).replace(/\//g, '\\/')},
 			tags: !{JSON.stringify(tags).replace(/\//g, '\\/')},
-			notifications: !{JSON.stringify(notifications).replace(/\//g, '\\/')}
+			notifications: !{JSON.stringify(notifications).replace(/\//g, '\\/')},
+			caseStudy: !{JSON.stringify(caseStudyToShow())}
 		};
 		window.algolia = {
 			institutions: {

+ 8 - 1
services/web/app/views/project/list/side-bar.jade

@@ -94,7 +94,7 @@
 - if (showUserDetailsArea)
 	span(ng-controller="LeftHandMenuPromoController",  ng-cloak)
 
-		.row-spaced#userProfileInformation(ng-if="hasProjects")
+		.row-spaced#userProfileInformation(ng-if="hasProjects && !showCaseStudy")
 			div(ng-controller="UserProfileController")
 				hr(ng-show="percentComplete < 100")
 				.text-centered.user-profile(ng-show="percentComplete < 100")
@@ -108,6 +108,13 @@
 						ng-click="openUserProfileModal()"
 					) #{translate("complete")}
 
+		.row-spaced(ng-if="hasProjects && showCaseStudy", ng-cloak).text-centered
+			hr
+			a(href="{{caseStudy.url}}")
+				p.small read about:
+				p
+					img(src="{{caseStudy.logo}}")
+				a(href="{{caseStudy.url}}") {{caseStudy.title}}
 
 		.row-spaced(ng-if="hasProjects && userHasNoSubscription", ng-cloak).text-centered
 			hr

+ 4 - 1
services/web/public/coffee/main/project-list/left-hand-menu-promo-controller.coffee

@@ -6,4 +6,7 @@ define [
 
 		$scope.hasProjects = window.data.projects.length > 0
 		$scope.userHasNoSubscription = window.userHasNoSubscription
-		$scope.randomView = _.shuffle(["default", "dropbox", "github"])[0]
+
+		$scope.showCaseStudy = window.data.caseStudy?.url?
+		$scope.caseStudy = window.data.caseStudy
+