From cf7a05f80f68b5b1c8bcc0089679dd497cec2506 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Sun, 14 Jun 2015 23:53:32 -0800 Subject: first commit --- web/react/components/post.jsx | 88 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 web/react/components/post.jsx (limited to 'web/react/components/post.jsx') diff --git a/web/react/components/post.jsx b/web/react/components/post.jsx new file mode 100644 index 000000000..afe978495 --- /dev/null +++ b/web/react/components/post.jsx @@ -0,0 +1,88 @@ +// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// See License.txt for license information. + +var PostHeader = require('./post_header.jsx'); +var PostBody = require('./post_body.jsx'); +var PostInfo = require('./post_info.jsx'); +var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); +var Constants = require('../utils/constants.jsx'); +var ActionTypes = Constants.ActionTypes; + +module.exports = React.createClass({ + componentDidMount: function() { + $('.edit-modal').on('show.bs.modal', function () { + $('.edit-modal .edit-modal-body').css('overflow-y', 'auto'); + $('.edit-modal .edit-modal-body').css('max-height', $(window).height() * 0.7); + }); + }, + handleCommentClick: function(e) { + e.preventDefault(); + + data = {}; + data.order = [this.props.post.id]; + data.posts = this.props.posts; + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECIEVED_POST_SELECTED, + post_list: data + }); + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECIEVED_SEARCH, + results: null + }); + }, + getInitialState: function() { + return { }; + }, + render: function() { + var post = this.props.post; + var parentPost = this.props.parentPost; + var posts = this.props.posts; + + var type = "Post" + if (post.root_id.length > 0) { + type = "Comment" + } + + var commentCount = 0; + var commentRootId = parentPost ? post.root_id : post.id; + var rootUser = ""; + for (var postId in posts) { + if (posts[postId].root_id == commentRootId) { + commentCount += 1; + } + } + + var error = this.state.error ?
: null; + + if(this.props.sameRoot){ + rootUser = "same--root"; + } + else { + rootUser = "other--root"; + } + + var postType = ""; + if(type != "Post"){ + postType = "post--comment"; + } + + return ( +
+
+ { !this.props.hideProfilePic ? +
+ +
+ : "" } +
+ + + +
+
+
+ ); + } +}); -- cgit v1.2.3-1-g7c22