2012-10-02 13:49:38 +09:00
|
|
|
Template.post_page.helpers({
|
|
|
|
post: function(){
|
|
|
|
var post = Posts.findOne(Session.get('selectedPostId'));
|
|
|
|
return post;
|
|
|
|
},
|
|
|
|
body_formatted: function(){
|
|
|
|
var converter = new Markdown.Converter();
|
|
|
|
var html_body=converter.makeHtml(this.body);
|
|
|
|
return html_body.autoLink();
|
2012-10-05 13:59:40 +09:00
|
|
|
},
|
|
|
|
canComment: function(){
|
|
|
|
return canComment(Meteor.user());
|
2012-10-05 14:08:46 +09:00
|
|
|
},
|
|
|
|
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(){
|
|
|
|
if((scrollToCommentId=Session.get('scrollToCommentId')) && !this.rendered && $('#'+scrollToCommentId).exists()){
|
|
|
|
scrollPageTo('#'+scrollToCommentId);
|
|
|
|
Session.set('scrollToCommentId', null);
|
|
|
|
this.rendered=true;
|
|
|
|
}
|
2012-09-09 13:38:56 +09:00
|
|
|
}
|
|
|
|
|
2012-10-01 14:18:41 +09:00
|
|
|
window.newCommentTimestamp=new Date();
|