2012-10-02 13:49:38 +09:00
|
|
|
Template.post_page.helpers({
|
2013-10-21 17:47:30 +08:00
|
|
|
post: function () {
|
|
|
|
return Posts.findOne(this.postId);
|
|
|
|
},
|
2013-07-04 13:07:47 +09:00
|
|
|
body_formatted: function(){
|
|
|
|
var converter = new Markdown.Converter();
|
|
|
|
var html_body=converter.makeHtml(this.body);
|
|
|
|
return html_body.autoLink();
|
|
|
|
},
|
|
|
|
canComment: function(){
|
|
|
|
return canComment(Meteor.user());
|
|
|
|
},
|
|
|
|
canView: function(){
|
|
|
|
return canView(Meteor.user());
|
|
|
|
}
|
2012-10-02 13:49:38 +09:00
|
|
|
});
|
2012-08-30 21:35:48 -04:00
|
|
|
|
2012-10-02 13:49:38 +09:00
|
|
|
Template.post_page.rendered = function(){
|
2013-07-04 13:07:47 +09:00
|
|
|
if((scrollToCommentId=Session.get('scrollToCommentId')) && !this.rendered && $('#'+scrollToCommentId).exists()){
|
|
|
|
scrollPageTo('#'+scrollToCommentId);
|
|
|
|
Session.set('scrollToCommentId', null);
|
|
|
|
this.rendered=true;
|
|
|
|
}
|
2013-10-06 08:47:15 +09:00
|
|
|
document.title = this.data.headline;
|
2013-05-15 18:45:27 +02:00
|
|
|
}
|