Merge pull request #915 from sharelatex/hb-affiliation-cta

Replace profile completion CTA with affiliations CTA
This commit is contained in:
Hugh O'Brien 2018-09-19 11:32:55 +01:00 committed by GitHub
commit 78ad6e7e5c
2 changed files with 18 additions and 13 deletions

View file

@ -115,19 +115,14 @@
span(ng-controller="LeftHandMenuPromoController", ng-cloak)
.row-spaced#userProfileInformation(ng-if="hasProjects")
div(ng-controller="UserProfileController")
hr(ng-show="percentComplete < 100")
.text-centered.user-profile(ng-show="percentComplete < 100")
.progress
.progress-bar.progress-bar-info(ng-style="{'width' : (percentComplete+'%')}")
p.small #{translate("profile_complete_percentage", {percentval:"{{percentComplete}}"})}
div(ng-show="userEmails.length > 0 && userAffiliations.length == 0", ng-cloak)
hr
.text-centered.user-profile
p Are you affiliated with an institution?
button#completeUserProfileInformation.btn.btn-info(
ng-hide="formVisable",
ng-click="openUserProfileModal()"
) #{translate("complete")}
a.btn.btn-info(
href="/user/settings"
) Add Affiliation
.row-spaced(ng-if="hasProjects && userHasNoSubscription", ng-cloak).text-centered
hr

View file

@ -2,8 +2,18 @@ define [
"base"
], (App) ->
App.controller 'LeftHandMenuPromoController', ($scope) ->
App.controller 'LeftHandMenuPromoController', ($scope, UserAffiliationsDataService) ->
$scope.hasProjects = window.data.projects.length > 0
$scope.userHasNoSubscription = window.userHasNoSubscription
_userHasNoAffiliation = () ->
$scope.userEmails = []
$scope.userAffiliations = []
UserAffiliationsDataService.getUserEmails().then (emails) ->
$scope.userEmails = emails
for email in emails
if email.affiliation
$scope.userAffiliations.push email.affiliation
_userHasNoAffiliation()