2016-03-30 09:24:52 +09:00
|
|
|
import React from 'react';
|
2016-04-02 15:03:55 +02:00
|
|
|
import { Accounts } from 'meteor/std:accounts-ui';
|
2016-03-30 10:52:40 +09:00
|
|
|
import SmartContainers from "meteor/utilities:react-list-container";
|
|
|
|
const ListContainer = SmartContainers.ListContainer;
|
2016-03-30 09:24:52 +09:00
|
|
|
|
2016-04-03 11:42:07 +09:00
|
|
|
import Core from "meteor/nova:core";
|
|
|
|
const ModalTrigger = Core.ModalTrigger;
|
|
|
|
|
2016-04-14 10:12:35 +09:00
|
|
|
const PostsPage = ({document, currentUser}) => {
|
2016-02-18 16:26:52 +09:00
|
|
|
|
2016-04-14 10:12:35 +09:00
|
|
|
({CommentsList, CommentsNew, PostsItem, PostsCategories, SocialShare, Vote, PostsStats, HeadTags, AccountsForm} = 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 (
|
2016-03-25 12:17:29 +09:00
|
|
|
<div className="post-page">
|
2016-02-18 16:26:52 +09:00
|
|
|
|
2016-04-06 16:56:05 +02:00
|
|
|
<HeadTags url={Posts.getLink(post)} title={post.title} image={post.thumbnailUrl} />
|
2016-03-28 10:38:28 +09:00
|
|
|
|
2016-04-14 10:12:35 +09:00
|
|
|
<PostsItem post={post}/>
|
2016-03-22 10:38:57 +09:00
|
|
|
|
2016-03-25 12:17:29 +09:00
|
|
|
<div className="post-body" dangerouslySetInnerHTML={htmlBody}></div>
|
2016-03-22 10:38:57 +09:00
|
|
|
|
2016-03-25 12:17:29 +09:00
|
|
|
{/*<SocialShare url={ Posts.getLink(post) } title={ post.title }/>*/}
|
2016-02-18 16:26:52 +09:00
|
|
|
|
2016-02-16 16:12:13 +09:00
|
|
|
<div className="comments-thread">
|
2016-03-25 12:17:29 +09:00
|
|
|
<h4 className="comments-thread-title">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-04-14 10:12:35 +09:00
|
|
|
component={CommentsList}
|
2016-04-03 20:58:11 +09:00
|
|
|
/>
|
2016-02-23 16:49:56 +09:00
|
|
|
|
2016-04-02 15:03:55 +02:00
|
|
|
{ currentUser ?
|
|
|
|
<div className="post-new-comment">
|
|
|
|
<h4>New Comment:</h4>
|
2016-04-14 10:12:35 +09:00
|
|
|
<CommentsNew type="comment" postId={post._id} />
|
2016-04-02 15:03:55 +02:00
|
|
|
</div> :
|
|
|
|
<div>
|
2016-04-03 11:42:07 +09:00
|
|
|
<ModalTrigger size="small" component={<a>Please log in to comment</a>}>
|
|
|
|
<AccountsForm/>
|
|
|
|
</ModalTrigger>
|
2016-04-02 15:03:55 +02:00
|
|
|
</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>
|
|
|
|
)
|
2016-04-02 15:03:55 +02:00
|
|
|
};
|
2016-02-15 22:33:44 +09:00
|
|
|
|
2016-04-14 10:12:35 +09:00
|
|
|
module.exports = PostsPage;
|