Просмотр исходного кода

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

Replace profile completion CTA with affiliations CTA
Hugh O'Brien 8 лет назад
Родитель
Сommit
78ad6e7e5c

+ 7 - 12
services/web/app/views/project/list/side-bar.pug

@@ -115,19 +115,14 @@
 	span(ng-controller="LeftHandMenuPromoController",  ng-cloak)
 	span(ng-controller="LeftHandMenuPromoController",  ng-cloak)
 
 
 		.row-spaced#userProfileInformation(ng-if="hasProjects")
 		.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
 		.row-spaced(ng-if="hasProjects && userHasNoSubscription", ng-cloak).text-centered
 			hr
 			hr

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

@@ -2,8 +2,18 @@ define [
 	"base"
 	"base"
 ], (App) ->
 ], (App) ->
 
 
-	App.controller 'LeftHandMenuPromoController', ($scope) ->
+	App.controller 'LeftHandMenuPromoController', ($scope, UserAffiliationsDataService) ->
 
 
 		$scope.hasProjects = window.data.projects.length > 0
 		$scope.hasProjects = window.data.projects.length > 0
 		$scope.userHasNoSubscription = window.userHasNoSubscription
 		$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()