2016-03-17 18:08:03 +09:00
|
|
|
const Post = ({document}) => {
|
2016-02-18 16:26:52 +09:00
|
|
|
|
2016-03-04 12:15:44 -05:00
|
|
|
({ListContainer, CommentList, CommentNew, PostCategories, SocialShare} = Telescope.components);
|
2016-02-18 16:26:52 +09:00
|
|
|
|
2016-03-17 18:08:03 +09:00
|
|
|
const post = document;
|
2016-02-23 11:34:40 +09:00
|
|
|
const htmlBody = {__html: post.htmlBody};
|
2016-02-18 16:26:52 +09:00
|
|
|
|
2016-02-15 22:33:44 +09:00
|
|
|
return (
|
|
|
|
<div className="post">
|
2016-02-18 16:26:52 +09:00
|
|
|
|
2016-02-23 11:34:40 +09:00
|
|
|
<h3>{post.title}</h3>
|
2016-03-04 12:15:44 -05:00
|
|
|
<SocialShare url={ Posts.getLink(post) } title={ post.title }/>
|
2016-02-23 11:34:40 +09:00
|
|
|
<p>{post.commentCount} comments</p>
|
|
|
|
<p>{moment(post.postedAt).fromNow()}</p>
|
|
|
|
{post.categoriesArray ? <PostCategories categories={post.categoriesArray} /> : ""}
|
2016-02-18 16:26:52 +09:00
|
|
|
<div dangerouslySetInnerHTML={htmlBody}></div>
|
|
|
|
|
2016-02-16 16:12:13 +09:00
|
|
|
<div className="comments-thread">
|
|
|
|
<h4>Comments</h4>
|
2016-02-18 16:26:52 +09:00
|
|
|
<ListContainer
|
|
|
|
collection={Comments}
|
|
|
|
publication="comments.list"
|
2016-02-23 11:34:40 +09:00
|
|
|
selector={{postId: post._id}}
|
|
|
|
terms={{postId: post._id, view: "postComments"}}
|
2016-02-18 16:26:52 +09:00
|
|
|
limit={0}
|
2016-02-18 17:53:04 +09:00
|
|
|
parentProperty="parentCommentId"
|
2016-03-19 18:19:28 +09:00
|
|
|
joins={Comments.getJoins()}
|
2016-02-26 10:42:57 +09:00
|
|
|
><CommentList/></ListContainer>
|
2016-02-23 16:49:56 +09:00
|
|
|
|
|
|
|
<div className="post-new-comment">
|
|
|
|
<h4>New Comment:</h4>
|
|
|
|
<CommentNew type="comment" postId={post._id} />
|
|
|
|
</div>
|
2016-02-16 16:12:13 +09:00
|
|
|
</div>
|
2016-02-18 16:26:52 +09:00
|
|
|
|
2016-02-15 22:33:44 +09:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Post;
|