Vulcan/client/views/posts/post_page.js
2013-10-21 23:07:36 +08:00

26 lines
749 B
JavaScript

Template.post_page.helpers({
post: function () {
return Posts.findOne(this.postId);
},
body_formatted: function(){
var converter = new Markdown.Converter();
var html_body=converter.makeHtml(this.body);
return html_body.autoLink();
},
canComment: function(){
console.log(canComment(Meteor.user()))
return canComment(Meteor.user());
},
canView: function(){
return canView(Meteor.user());
}
});
Template.post_page.rendered = function(){
if((scrollToCommentId=Session.get('scrollToCommentId')) && !this.rendered && $('#'+scrollToCommentId).exists()){
scrollPageTo('#'+scrollToCommentId);
Session.set('scrollToCommentId', null);
this.rendered=true;
}
document.title = this.data.headline;
}