summaryrefslogtreecommitdiffstats
path: root/client/components
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2020-04-08 22:29:15 +0300
committerLauri Ojansivu <x@xet7.org>2020-04-08 22:29:15 +0300
commit115701fa653067f05ad53677d4398d25e89402b6 (patch)
tree7d7cfc1f610e1ec24a04e8d4497da8a06c47b1f1 /client/components
parent7856692946e33233b8c7b48d0a06371205aa6683 (diff)
parenta182dde11ff4f1ab8cd01a04e1e26affda5d8a3b (diff)
downloadwekan-115701fa653067f05ad53677d4398d25e89402b6.tar.gz
wekan-115701fa653067f05ad53677d4398d25e89402b6.tar.bz2
wekan-115701fa653067f05ad53677d4398d25e89402b6.zip
Merge branch 'jtbairdsr-master'
Diffstat (limited to 'client/components')
-rw-r--r--client/components/notifications/notificationsDrawer.jade4
-rw-r--r--client/components/notifications/notificationsDrawer.js15
-rw-r--r--client/components/notifications/notificationsDrawer.styl13
3 files changed, 31 insertions, 1 deletions
diff --git a/client/components/notifications/notificationsDrawer.jade b/client/components/notifications/notificationsDrawer.jade
index 01117009..fee6aef6 100644
--- a/client/components/notifications/notificationsDrawer.jade
+++ b/client/components/notifications/notificationsDrawer.jade
@@ -14,3 +14,7 @@ template(name='notificationsDrawer')
+notification(activityData=activity index=dbIndex read=read)
if($gt unreadNotifications 0)
a.all-read {{_ 'mark-all-as-read'}}
+ if ($and ($.Session.get 'showReadNotifications') ($gt readNotifications 0))
+ a.remove-read
+ i.fa.fa-trash
+ | {{_ 'remove-all-read'}}
diff --git a/client/components/notifications/notificationsDrawer.js b/client/components/notifications/notificationsDrawer.js
index 98d4750d..76abeea7 100644
--- a/client/components/notifications/notificationsDrawer.js
+++ b/client/components/notifications/notificationsDrawer.js
@@ -16,6 +16,13 @@ Template.notificationsDrawer.helpers({
transformedProfile() {
return Users.findOne(Meteor.userId());
},
+ readNotifications() {
+ const readNotifications = _.filter(
+ Meteor.user().profile.notifications,
+ v => !!v.read,
+ );
+ return readNotifications.length;
+ },
});
Template.notificationsDrawer.events({
@@ -35,4 +42,12 @@ Template.notificationsDrawer.events({
'click .toggle-read'() {
Session.set('showReadNotifications', !Session.get('showReadNotifications'));
},
+ 'click .remove-read'() {
+ const user = Meteor.user();
+ for (const notification of user.profile.notifications) {
+ if (notification.read) {
+ user.removeNotification(notification.activity);
+ }
+ }
+ },
});
diff --git a/client/components/notifications/notificationsDrawer.styl b/client/components/notifications/notificationsDrawer.styl
index a26b5e4a..b64f13f4 100644
--- a/client/components/notifications/notificationsDrawer.styl
+++ b/client/components/notifications/notificationsDrawer.styl
@@ -45,12 +45,23 @@ section#notifications-drawer
line-height: 24px
opacity 1
- .all-read
+ .all-read,
+ .remove-read
color belize
background-color: #fafafa
margin 8px 16px 12px
display inline-block
+ .remove-read
+ float right
+
+ &:hover
+ color #eb4646 !important
+
+ i.fa
+ color inherit
+
+
ul.notifications
display: block
padding: 0px 16px