This commit is contained in:
Henry Oswald 2016-11-29 14:38:25 +00:00
parent aacdb1e96b
commit 6e9458e9e1
4 changed files with 33 additions and 3 deletions

View file

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

View file

@ -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: {

View file

@ -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

View file

@ -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