mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 18:11:40 -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() {
|
||||
return [
|
||||
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() {
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
<template name="comment_page">
|
||||
{{#if canView}}
|
||||
<div class="post grid comment-page">
|
||||
|
||||
{{#with post}}
|
||||
{{>post_item}}
|
||||
{{/with}}
|
||||
|
||||
{{#if comment}}
|
||||
{{#with comment}}
|
||||
<ul class="selected-comment">
|
||||
{{> comment_item}}
|
||||
</ul>
|
||||
{{/with}}
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
Template.comment_page.post = function(){
|
||||
var selectedComment = Comments.findOne(Session.get('selectedCommentId'));
|
||||
return selectedComment && Posts.findOne(selectedComment.post);
|
||||
};
|
||||
Template.comment_page.helpers({
|
||||
post: function () {
|
||||
return Posts.findOne(this.comment.post);
|
||||
}
|
||||
});
|
|
@ -1,21 +1,19 @@
|
|||
<template name="comment_reply">
|
||||
{{#if canComment "replace"}}
|
||||
<div class="post grid comment-page">
|
||||
{{#if post}}
|
||||
|
||||
{{#with post}}
|
||||
{{> post_item}}
|
||||
{{/with}}
|
||||
{{/if}}
|
||||
|
||||
{{#if comment}}
|
||||
{{#with comment}}
|
||||
<ul class="selected-comment">
|
||||
{{> comment_item}}
|
||||
</ul>
|
||||
{{/with}}
|
||||
{{/if}}
|
||||
|
||||
{{> comment_form}}
|
||||
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
Template.comment_reply.post = function(){
|
||||
var comment = this;
|
||||
return comment && Posts.findOne(comment.post);
|
||||
};
|
||||
Template.comment_reply.helpers({
|
||||
post: function () {
|
||||
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) {
|
||||
if(canViewById(this.userId)){
|
||||
options = options || {};
|
||||
|
|
Loading…
Add table
Reference in a new issue