mirror of https://github.com/wekan/wekan
The Open Source kanban (built with Meteor). Keep variable/table/field names camelCase. For translations, only add Pull Request changes to wekan/i18n/en.i18n.json , other translations are done at https://transifex.com/wekan/wekan only.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
790 B
33 lines
790 B
|
6 years ago
|
// 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 = Users.findOne(Meteor.userId()).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'),
|
||
|
|
);
|
||
|
|
}
|