2014-07-05 11:24:28 +09:00
|
|
|
Template[getTemplate('notification_item')].helpers({
|
2012-10-08 11:23:12 +09:00
|
|
|
nice_time: function(){
|
|
|
|
return moment(this.timestamp).fromNow();
|
|
|
|
},
|
|
|
|
properties: function(){
|
|
|
|
return this.properties;
|
|
|
|
},
|
2013-01-19 18:24:18 +09:00
|
|
|
notificationHTML: function(){
|
2013-11-18 11:30:58 +09:00
|
|
|
return getNotificationContents(this).html;
|
2012-10-08 11:23:12 +09:00
|
|
|
}
|
2012-10-05 10:23:38 +09:00
|
|
|
});
|
|
|
|
|
2014-07-05 11:24:28 +09:00
|
|
|
Template[getTemplate('notification_item')].events({
|
2012-10-05 10:23:38 +09:00
|
|
|
'click .action-link': function(event, instance){
|
2012-10-08 11:23:12 +09:00
|
|
|
var notificationId=instance.data._id;
|
|
|
|
Notifications.update(
|
|
|
|
{_id: notificationId},
|
|
|
|
{
|
|
|
|
$set:{
|
|
|
|
read: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
function(error, result){
|
|
|
|
if(error){
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2012-10-05 10:23:38 +09:00
|
|
|
}
|
2012-10-04 13:30:57 +09:00
|
|
|
});
|