12345678910111213141516171819202122232425262728 |
- Template.notifications.helpers({
- notifications: function () {
- return Notifications.find({
- userId: Meteor.userId(),
- read: false
- });
- },
- notificationCount: function () {
- return Notifications.find({
- userId: Meteor.userId(),
- read: false
- }).count();
- }
- });
- Template.notificationItem.helpers({
- notificationPostPath: function () {
- return Router.routes.postPage.path({ _id: this.postId });
- }
- });
- Template.notificationItem.events({
- 'click a': function () {
- // Here, "this" is a Notification document..
- Notifications.update(this._id, { $set : { read: true }});
- }
- });
|