2020-05-19 05:02:56 -04:00
|
|
|
import App from '../../base'
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
export default App.controller('LeftHandMenuPromoController', function(
|
|
|
|
$scope,
|
|
|
|
UserAffiliationsDataService,
|
|
|
|
eventTracking
|
|
|
|
) {
|
|
|
|
$scope.hasProjects = window.data.projects.length > 0
|
|
|
|
$scope.userHasNoSubscription = window.userHasNoSubscription
|
2020-02-03 09:11:36 -05:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
$scope.upgradeSubscription = function() {
|
|
|
|
eventTracking.send('subscription-funnel', 'project-page', 'upgrade')
|
|
|
|
}
|
2020-02-03 09:11:36 -05:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
$scope.share = function() {
|
|
|
|
eventTracking.send('subscription-funnel', 'project-page', 'sharing')
|
|
|
|
}
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
const _userHasNoAffiliation = function() {
|
|
|
|
$scope.userEmails = []
|
|
|
|
$scope.userAffiliations = []
|
|
|
|
return UserAffiliationsDataService.getUserEmails().then(function(emails) {
|
|
|
|
$scope.userEmails = emails
|
|
|
|
$scope.userAffiliations = emails
|
|
|
|
.filter(email => email.affiliation)
|
|
|
|
.map(email => email.affiliation)
|
|
|
|
$scope.userOnPayingUniversity = $scope.userAffiliations.some(
|
|
|
|
affiliation => affiliation.licence && affiliation.licence !== 'free'
|
|
|
|
)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
_userHasNoAffiliation()
|
|
|
|
})
|