2012-10-04 13:30:57 +09:00
|
|
|
Template.notification_item.helpers({
|
|
|
|
nice_time: function(){
|
|
|
|
return moment(this.timestamp).fromNow();
|
|
|
|
},
|
|
|
|
properties: function(){
|
|
|
|
return this.properties;
|
|
|
|
},
|
2012-10-04 14:54:26 +09:00
|
|
|
isNewComment: function(){
|
|
|
|
return this.event=="newComment";
|
2012-10-04 13:30:57 +09:00
|
|
|
},
|
2012-10-04 14:54:26 +09:00
|
|
|
isNewReply: function(){
|
|
|
|
return this.event=="newReply";
|
2012-10-04 17:25:10 +09:00
|
|
|
},
|
2012-10-06 13:15:55 +09:00
|
|
|
isMessage: function(){
|
|
|
|
return this.event=="message";
|
|
|
|
},
|
2012-10-04 17:25:10 +09:00
|
|
|
postHeadline: function(){
|
|
|
|
var post=Posts.findOne(this.postId);
|
|
|
|
if(post)
|
|
|
|
return post.headline;
|
2012-10-04 13:30:57 +09:00
|
|
|
}
|
2012-10-05 10:23:38 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
Template.notification_item.events({
|
|
|
|
'click .action-link': function(event, instance){
|
|
|
|
Meteor.call('markNotificationAsRead', instance.data._id);
|
|
|
|
}
|
2012-10-04 13:30:57 +09:00
|
|
|
});
|