mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
making post route non-reactive
This commit is contained in:
parent
68a83868d8
commit
e76e7b06bc
6 changed files with 18 additions and 11 deletions
|
@ -335,8 +335,10 @@ Router.map(function() {
|
|||
// }
|
||||
// },
|
||||
data: function() {
|
||||
// note: do not pass actual post object in data property because we don't want the route to be reactive
|
||||
// and re-run every time a post score changes
|
||||
return {
|
||||
post: Posts.findOne(this.params._id)
|
||||
postId: this.params._id
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ Template.comment_list.created = function(){
|
|||
|
||||
Template.comment_list.helpers({
|
||||
has_comments: function(){
|
||||
console.log(this)
|
||||
// console.log(this)
|
||||
// note: use this.post to access 'post' object in router data context
|
||||
if(this.post)
|
||||
return Comments.find({post: postObject._id, parent: null}, {sort: {score: -1, submitted: -1}}).count() > 0;
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<template name="post_page">
|
||||
{{#if canView}}
|
||||
<div class="single-post grid">
|
||||
{{> post_item}}
|
||||
{{#if canComment}}
|
||||
{{> comment_form}}
|
||||
{{/if}}
|
||||
{{> comment_list}}
|
||||
</div>
|
||||
{{#with post}}
|
||||
<div class="single-post grid">
|
||||
{{> post_item}}
|
||||
{{#if canComment}}
|
||||
{{> comment_form}}
|
||||
{{/if}}
|
||||
{{> comment_list}}
|
||||
</div>
|
||||
{{/with}}
|
||||
{{/if}}
|
||||
</template>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
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);
|
||||
|
|
|
@ -1 +1 @@
|
|||
/Users/sacha/.meteorite/packages/iron-router/EventedMind/iron-router/13d0007ee9dfa1a111a0e55eedcf002c593f5489
|
||||
/Users/sacha/.meteorite/packages/iron-router/EventedMind/iron-router/dddf61e618285ec2045a16f224870b1aeba05cdd
|
|
@ -38,7 +38,7 @@
|
|||
"iron-router": {
|
||||
"git": "https://github.com/EventedMind/iron-router.git",
|
||||
"branch": "dev",
|
||||
"commit": "13d0007ee9dfa1a111a0e55eedcf002c593f5489"
|
||||
"commit": "dddf61e618285ec2045a16f224870b1aeba05cdd"
|
||||
},
|
||||
"crypto-base": {
|
||||
"git": "https://github.com/tmeasday/meteor-crypto-base.git",
|
||||
|
|
Loading…
Add table
Reference in a new issue