From 0919f081a74b14340639bb94438e845432236157 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 12 Sep 2022 10:49:37 +0200 Subject: [PATCH] Merge pull request #9540 from overleaf/tm-back-to-school-2022-banners Add back to school 2022 banners to project dash and plans GitOrigin-RevId: 40893bad0b6a90bb25f671949b7b8837ead54053 --- .../app/views/project/list/notifications.pug | 25 +++++++++++++++++++ .../subscriptions/plans-marketing-v2.pug | 16 ++++++++++++ .../views/subscriptions/plans-marketing.pug | 16 ++++++++++++ .../project-list/notifications-controller.js | 13 ++++++++++ 4 files changed, 70 insertions(+) diff --git a/services/web/app/views/project/list/notifications.pug b/services/web/app/views/project/list/notifications.pug index a8672d9c36..5df21ea435 100644 --- a/services/web/app/views/project/list/notifications.pug +++ b/services/web/app/views/project/list/notifications.pug @@ -251,3 +251,28 @@ include ../../_mixins/reconfirm_affiliation ng-if="userEmail.samlIdentifier && userEmail.samlIdentifier.providerId === reconfirmedViaSAML" ) +reconfirmedAffiliationNotification() + + - var hasPaidAffiliation = userAffiliations.some(affiliation => affiliation.licence && affiliation.licence !== 'free') + if settings.enableSubscriptions && !hasSubscription && !hasPaidAffiliation + ul.list-unstyled( + ng-controller="DismissableNotificationsController", + ng-cloak + ) + li.notification-entry( + ng-if="shouldShowNotification && projects.length > 0" + ) + .alert.alert-info + .notification-body + span We're celebrating the new school year! For a limited time, receive 15% off the first year of any new annual subscription. + .notification-action + a.pull-right.btn.btn-sm.btn-info( + href="https://www.overleaf.com/events/limited-time-promo-sept2022" + event-tracking="promo-click" + event-tracking-mb="true" + event-tracking-trigger="click" + event-segmentation='{"name": "bts2022", "location": "dashboard-banner"}' + ) Upgrade + .notification-close + button(ng-click="dismiss()").close.pull-right + span(aria-hidden="true") × + span.sr-only #{translate("close")} diff --git a/services/web/app/views/subscriptions/plans-marketing-v2.pug b/services/web/app/views/subscriptions/plans-marketing-v2.pug index 33001e4964..4866278315 100644 --- a/services/web/app/views/subscriptions/plans-marketing-v2.pug +++ b/services/web/app/views/subscriptions/plans-marketing-v2.pug @@ -14,6 +14,22 @@ block append meta block content main.content.content-alt#main-content + .container + .user-notifications + ul.list-unstyled(ng-cloak) + li.notification-entry + .alert.alert-info + .notification-body + span We're celebrating the new school year! For a limited time, receive 15% off the first year of any new annual subscription. + .notification-action + a.btn.btn-sm.btn-info( + href="https://www.overleaf.com/events/limited-time-promo-sept2022" + event-tracking="promo-click" + event-tracking-mb="true" + event-tracking-trigger="click" + event-segmentation='{"name": "bts2022", "location": "plans-v2-banner"}' + ) Upgrade + .content-page .plans .container(ng-cloak) diff --git a/services/web/app/views/subscriptions/plans-marketing.pug b/services/web/app/views/subscriptions/plans-marketing.pug index 1163223386..9e4b5125e1 100644 --- a/services/web/app/views/subscriptions/plans-marketing.pug +++ b/services/web/app/views/subscriptions/plans-marketing.pug @@ -14,6 +14,22 @@ block append meta block content main.content.content-alt#main-content + .container + .user-notifications + ul.list-unstyled(ng-cloak) + li.notification-entry + .alert.alert-info + .notification-body + span We're celebrating the new school year! For a limited time, receive 15% off the first year of any new annual subscription. + .notification-action + a.btn.btn-sm.btn-info( + href="https://www.overleaf.com/events/limited-time-promo-sept2022" + event-tracking="promo-click" + event-tracking-mb="true" + event-tracking-trigger="click" + event-segmentation='{"name": "bts2022", "location": "plans-banner"}' + ) Upgrade + .content-page .plans .container(ng-cloak) diff --git a/services/web/frontend/js/main/project-list/notifications-controller.js b/services/web/frontend/js/main/project-list/notifications-controller.js index 9a34fff5ee..113b091d1a 100644 --- a/services/web/frontend/js/main/project-list/notifications-controller.js +++ b/services/web/frontend/js/main/project-list/notifications-controller.js @@ -23,6 +23,19 @@ App.controller('NotificationsController', function ($scope, $http) { } }) +App.controller( + 'DismissableNotificationsController', + function ($scope, localStorage) { + $scope.shouldShowNotification = + localStorage('dismissed-back-to-school-2022') !== true + + $scope.dismiss = () => { + localStorage('dismissed-back-to-school-2022', true) + $scope.shouldShowNotification = false + } + } +) + App.controller('ProjectInviteNotificationController', function ($scope, $http) { // Shortcuts for translation keys $scope.projectName = $scope.notification.messageOpts.projectName