Kaynağa Gözat

Merge pull request #2796 from overleaf/cmg-covid-top-notification

Top notification for Coronavirus upgrade offer

GitOrigin-RevId: bdad53ebbcbec93034df5c652fe82d309f73f22d
Chrystal Maria Griffiths 6 yıl önce
ebeveyn
işleme
f0bdd34823

+ 20 - 0
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")}

+ 13 - 0
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