Vulcan/packages/telescope-notifications/lib/client/templates/notification_item.js
2014-10-02 16:42:31 -04:00

30 lines
605 B
JavaScript

Template[getTemplate('notificationItem')].helpers({
niceTime: function(){
return moment(this.timestamp).fromNow();
},
properties: function(){
return this.data;
},
notificationHTML: function(){
return this.message();
}
});
Template[getTemplate('notificationItem')].events({
'click .action-link': function(event, instance){
var notificationId=instance.data._id;
Herald.collection.update(
{_id: notificationId},
{
$set:{
read: true
}
},
function(error, result){
if(error){
console.log(error);
}
}
);
}
});