import React, { PropTypes, Component } from 'react'; import { Button } from 'react-bootstrap'; import Core from "meteor/nova:core"; const ModalTrigger = Core.ModalTrigger; class PostsItem extends Component { renderCategories() { ({PostsCategories} = Telescope.components); return this.props.post.categoriesArray ? : ""; } renderCommenters() { ({PostsCommenters} = Telescope.components); return this.props.post.commentersArray ? : ""; } renderActions() { ({PostsEditForm} = Telescope.components); const component = ( Edit}> ); return (
{Users.can.edit(this.context.currentUser, this.props.post) ? component : ""}
) } render() { ({UsersAvatar, UsersName, Vote, PostsStats, PostsThumbnail} = Telescope.components); const post = this.props.post; let postClass = "posts-item"; if (post.sticky) postClass += " posts-sticky"; // console.log(post) // console.log(post.user) return (
{post.thumbnailUrl ? : null}

{post.title} {this.renderCategories()}

{post.user?
: null}
{moment(post.postedAt).fromNow()}
{this.renderActions()}
{this.renderCommenters()}
) } }; PostsItem.propTypes = { post: React.PropTypes.object.isRequired } PostsItem.contextTypes = { currentUser: React.PropTypes.object }; module.exports = PostsItem; export default PostsItem;