mirror of
https://github.com/wekan/wekan.git
synced 2025-06-28 09:27:54 -04:00
34 lines
847 B
JavaScript
34 lines
847 B
JavaScript
import { ReactiveCache } from '/imports/reactiveCache';
|
|
|
|
// this hides the notifications drawer if anyone clicks off of the panel
|
|
Template.body.events({
|
|
click(event) {
|
|
if (
|
|
!$(event.target).is('#notifications *') &&
|
|
Session.get('showNotificationsDrawer')
|
|
) {
|
|
toggleNotificationsDrawer();
|
|
}
|
|
},
|
|
});
|
|
|
|
Template.notifications.helpers({
|
|
unreadNotifications() {
|
|
const notifications = ReactiveCache.getCurrentUser().notifications();
|
|
const unreadNotifications = _.filter(notifications, v => !v.read);
|
|
return unreadNotifications.length;
|
|
},
|
|
});
|
|
|
|
Template.notifications.events({
|
|
'click .notifications-drawer-toggle'() {
|
|
toggleNotificationsDrawer();
|
|
},
|
|
});
|
|
|
|
export function toggleNotificationsDrawer() {
|
|
Session.set(
|
|
'showNotificationsDrawer',
|
|
!Session.get('showNotificationsDrawer'),
|
|
);
|
|
}
|