From f0bdd348236c3f389fade617f74bf6e2937a79ff Mon Sep 17 00:00:00 2001 From: Chrystal Maria Griffiths Date: Fri, 1 May 2020 16:33:17 +0100 Subject: [PATCH] Merge pull request #2796 from overleaf/cmg-covid-top-notification Top notification for Coronavirus upgrade offer GitOrigin-RevId: bdad53ebbcbec93034df5c652fe82d309f73f22d --- .../app/views/project/list/notifications.pug | 20 +++++++++++++++++++ .../project-list/notifications-controller.js | 13 ++++++++++++ 2 files changed, 33 insertions(+) diff --git a/services/web/app/views/project/list/notifications.pug b/services/web/app/views/project/list/notifications.pug index 45bafc5f34..724b5c80cc 100644 --- a/services/web/app/views/project/list/notifications.pug +++ b/services/web/app/views/project/list/notifications.pug @@ -181,3 +181,23 @@ include ../../_mixins/saml i.fa.fa-spinner.fa-spin(aria-hidden="true") | | #{translate('resending_confirmation_email')}… + - 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 In response to ongoing developments around #COVID19, we're providing free temporary upgrades to our Professional Account. + span    + a(href="https://overleaf.com/blog/helping-you-collaborate-on-overleaf-during-the-coronavirus-pandemic") More info. + .notification-action + a.pull-right.btn.btn-sm.btn-info(href="https://forms.gle/zWrVdF3GdoWovjd66") Upgrade + .notification-close + button(ng-click="dismiss()").close.pull-right + span(aria-hidden="true") × + span.sr-only #{translate("close")} 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 83e3ac8d07..bf9f3efd49 100644 --- a/services/web/frontend/js/main/project-list/notifications-controller.js +++ b/services/web/frontend/js/main/project-list/notifications-controller.js @@ -18,6 +18,19 @@ define(['../../base'], function(App) { }).then(() => (notification.hide = true)) }) + App.controller('DismissableNotificationsController', function( + $scope, + localStorage + ) { + $scope.shouldShowNotification = + localStorage('dismissed-covid-19-notification') !== true + + $scope.dismiss = () => { + localStorage('dismissed-covid-19-notification', true) + $scope.shouldShowNotification = false + } + }) + App.controller('ProjectInviteNotificationController', function( $scope, $http