left-hand-menu-promo-controller.js 845 B

1234567891011121314151617181920212223242526
  1. import App from '../../base'
  2. export default App.controller(
  3. 'LeftHandMenuPromoController',
  4. function ($scope, UserAffiliationsDataService, eventTracking) {
  5. $scope.hasProjects = window.data.projects.length > 0
  6. $scope.userHasNoSubscription = window.userHasNoSubscription
  7. $scope.upgradeSubscription = function () {
  8. eventTracking.send('subscription-funnel', 'project-page', 'upgrade')
  9. }
  10. $scope.share = function () {
  11. eventTracking.send('subscription-funnel', 'project-page', 'sharing')
  12. }
  13. const _userHasNoAffiliation = function () {
  14. $scope.withAffiliations = window.data.userAffiliations.length > 0
  15. $scope.userOnPayingUniversity = window.data.userAffiliations.some(
  16. affiliation => affiliation.licence && affiliation.licence !== 'free'
  17. )
  18. }
  19. _userHasNoAffiliation()
  20. }
  21. )