2014-08-20 17:03:54 +09:00
|
|
|
Template[getTemplate('notificationItem')].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(){
|
2014-08-03 11:50:10 +09:00
|
|
|
return buildSiteNotification(this);
|
2012-10-08 11:23:12 +09:00
|
|
|
}
|
2012-10-05 10:23:38 +09:00
|
|
|
});
|
|
|
|
|
2014-08-20 17:03:54 +09:00
|
|
|
Template[getTemplate('notificationItem')].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
|
|
|
});
|