Vulcan/packages/telescope-notifications/lib/client/templates/notification_item.js
2014-09-20 09:57:09 +09:00

30 lines
No EOL
619 B
JavaScript

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