Vulcan/client/templates/post_page.js

37 lines
938 B
JavaScript
Raw Normal View History

(function() {
Template.post_page.events = {
'click input[type=submit]': function(e){
e.preventDefault();
2012-09-02 23:51:18 +09:00
2012-09-08 12:11:26 +09:00
var post_id = Session.get('selected_post_id');
var $comment = $('#comment');
var new_comment_id=Meteor.call('comment', post_id, null, $comment.val(), function(error, result){
$("#"+result).removeClass("queued"); // does not work because new element is not yet in the DOM (probably)
});
$comment.val('');
2012-09-04 11:14:12 +09:00
}
};
Template.post_page.show_comment_form = function(){
return Meteor.user() !== null;
2012-08-31 19:41:54 -04:00
};
Template.post_page.post = function(){
2012-09-05 11:55:06 +09:00
var post = Posts.findOne(Session.get('selected_post_id'));
return post;
2012-08-22 23:40:09 -04:00
};
2012-08-30 21:35:48 -04:00
Template.post_page.body_formatted = function(){
2012-09-08 11:54:08 +09:00
var converter = new Markdown.Converter();
var html_body=converter.makeHtml(this.body);
return html_body.autoLink();
}
Template.post_page.rendered = function(){
t("post_page");
}
window.newCommentTimestamp=new Date();
})();