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

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