Vulcan/client/templates/post_single_trash.js

34 lines
897 B
JavaScript
Raw Normal View History

2012-08-22 23:40:09 -04:00
Template.selected_post.events = {
2012-08-31 19:08:15 -04:00
'click input[type=submit]': function(evt){
evt.preventDefault();
2012-09-05 13:46:57 +09:00
var post = Posts.findOne(Session.get('selected_post_id'));
2012-08-22 23:40:09 -04:00
var $comment = $('#comment');
2012-08-31 19:41:54 -04:00
Meteor.call('comment', post, null, $comment.val());
2012-08-22 23:40:09 -04:00
$comment.val('');
}
};
Template.selected_post.show = function(){
2012-08-23 00:15:48 -04:00
return Session.equals('state', 'view_post');
2012-08-22 23:40:09 -04:00
};
2012-08-23 09:49:41 -04:00
Template.selected_post.show_comment_form = function(){
return Meteor.user() !== null;
};
2012-08-22 23:40:09 -04:00
Template.selected_post.post = function(){
var post = Session.get('selected_post');
return post;
};
2012-08-23 00:35:31 -04:00
Template.selected_post.has_comments = function(){
var post = Session.get('selected_post');
2012-08-23 09:49:41 -04:00
return Comments.find({post: post._id, parent: null}).count() > 0;
2012-08-23 00:35:31 -04:00
};
2012-08-23 00:51:31 -04:00
Template.selected_post.child_comments = function(){
2012-08-23 00:35:31 -04:00
var post = Session.get('selected_post');
2012-08-23 09:49:41 -04:00
return Comments.find({post: post._id, parent: null});
2012-08-23 00:35:31 -04:00
};