2013-10-09 20:23:20 +09:00
|
|
|
Template.comment_list.created = function(){
|
|
|
|
postObject = this.data.post;
|
|
|
|
rootComments = Comments.find({post: postObject._id, parent: null}, {sort: {score: -1, submitted: -1}});
|
|
|
|
}
|
|
|
|
|
2012-10-10 07:28:44 +09:00
|
|
|
Template.comment_list.helpers({
|
|
|
|
has_comments: function(){
|
2013-10-09 20:11:58 +09:00
|
|
|
// note: use this.post to access 'post' object in router data context
|
|
|
|
if(this.post)
|
2013-10-09 20:23:20 +09:00
|
|
|
return rootComments.count() > 0;
|
2012-10-10 07:28:44 +09:00
|
|
|
},
|
|
|
|
child_comments: function(){
|
2013-10-09 20:23:20 +09:00
|
|
|
// return only root comments
|
|
|
|
return rootComments;
|
2012-09-09 13:38:56 +09:00
|
|
|
}
|
2013-10-09 20:23:20 +09:00
|
|
|
});
|