mirror of
https://github.com/vale981/Vulcan
synced 2025-03-08 19:11:38 -05:00
publish the post related to a single comment
This commit is contained in:
parent
65e59767d1
commit
0c47f6e250
6 changed files with 27 additions and 15 deletions
|
@ -298,7 +298,8 @@ CommentPageController = RouteController.extend({
|
||||||
waitOn: function() {
|
waitOn: function() {
|
||||||
return [
|
return [
|
||||||
Meteor.subscribe('singleComment', this.params._id),
|
Meteor.subscribe('singleComment', this.params._id),
|
||||||
Meteor.subscribe('commentUser', this.params._id)
|
Meteor.subscribe('commentUser', this.params._id),
|
||||||
|
Meteor.subscribe('commentPost', this.params._id)
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function() {
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
<template name="comment_page">
|
<template name="comment_page">
|
||||||
{{#if canView}}
|
{{#if canView}}
|
||||||
<div class="post grid comment-page">
|
<div class="post grid comment-page">
|
||||||
|
|
||||||
|
{{#with post}}
|
||||||
|
{{>post_item}}
|
||||||
|
{{/with}}
|
||||||
|
|
||||||
{{#if comment}}
|
|
||||||
{{#with comment}}
|
{{#with comment}}
|
||||||
<ul class="selected-comment">
|
<ul class="selected-comment">
|
||||||
{{> comment_item}}
|
{{> comment_item}}
|
||||||
</ul>
|
</ul>
|
||||||
{{/with}}
|
{{/with}}
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
Template.comment_page.post = function(){
|
Template.comment_page.helpers({
|
||||||
var selectedComment = Comments.findOne(Session.get('selectedCommentId'));
|
post: function () {
|
||||||
return selectedComment && Posts.findOne(selectedComment.post);
|
return Posts.findOne(this.comment.post);
|
||||||
};
|
}
|
||||||
|
});
|
|
@ -1,21 +1,19 @@
|
||||||
<template name="comment_reply">
|
<template name="comment_reply">
|
||||||
{{#if canComment "replace"}}
|
{{#if canComment "replace"}}
|
||||||
<div class="post grid comment-page">
|
<div class="post grid comment-page">
|
||||||
{{#if post}}
|
|
||||||
{{#with post}}
|
{{#with post}}
|
||||||
{{> post_item}}
|
{{> post_item}}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if comment}}
|
|
||||||
{{#with comment}}
|
{{#with comment}}
|
||||||
<ul class="selected-comment">
|
<ul class="selected-comment">
|
||||||
{{> comment_item}}
|
{{> comment_item}}
|
||||||
</ul>
|
</ul>
|
||||||
{{/with}}
|
{{/with}}
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{> comment_form}}
|
{{> comment_form}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
Template.comment_reply.post = function(){
|
Template.comment_reply.helpers({
|
||||||
var comment = this;
|
post: function () {
|
||||||
return comment && Posts.findOne(comment.post);
|
return Posts.findOne(this.comment.post);
|
||||||
};
|
}
|
||||||
|
});
|
|
@ -83,6 +83,15 @@ Meteor.publish('singlePost', function(id) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// The post related to the current comment
|
||||||
|
|
||||||
|
Meteor.publish('commentPost', function(commentId) {
|
||||||
|
if(canViewById(this.userId)){
|
||||||
|
var comment = Comments.findOne(commentId);
|
||||||
|
return Posts.find(comment.post);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Meteor.publish('postsList', function(find, options) {
|
Meteor.publish('postsList', function(find, options) {
|
||||||
if(canViewById(this.userId)){
|
if(canViewById(this.userId)){
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
Loading…
Add table
Reference in a new issue