twister-react/js/.module-cache/7d9c52e50fc3bba547fb5ebf45831927d3e74edf.js
2015-04-21 19:38:17 +02:00

59 lines
2.3 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var ReactBootstrap = require('react-bootstrap')
, Grid = ReactBootstrap.Grid
, Col = ReactBootstrap.Col
, ListGroupItem = ReactBootstrap.ListGroupItem
var React = require('react');
module.exports = Post = React.createClass({displayName: "Post",
getInitialState: function() {
return {avatar: "img/genericPerson.png", fullname: ""};
},
componentDidMount: function () {
var thisComponent = this;
//console.log(this.props.post.username+":post"+this.props.post.id);
Twister.getUser(this.props.post.username).doAvatar(function(avatar){
thisComponent.setState({avatar: avatar.getUrl()});
});
Twister.getUser(this.props.post.username).doProfile(function(profile){
thisComponent.setState({fullname: profile.getField("fullname")});
});
},
render: function() {
var post = this.props.post;
return (
React.createElement(ListGroupItem, null,
React.createElement(Grid, {fill: true},
post.isRetwist &&
React.createElement(Col, {xs: 12}, React.createElement("small", null, React.createElement("span", {className: "glyphicon glyphicon-repeat", "aria-hidden": "true"}), " ", React.createElement("em", null, "retwisted by ", post.retwistingUser))),
React.createElement(Col, {xs: 2}, React.createElement("img", {className: "img-responsive", src: this.state.avatar})),
React.createElement(Col, {xs: 10},
React.createElement("strong", null, this.state.fullname), " ",
post.content
)
)
)
);
}
});
/*
<div className="post-avatar">
<img src={this.state.avatar}/>
</div>
<div className="post-bulk">
<div className="post-username">
<span className="post-fullname">{this.state.fullname} </span>
@{post.username} - {post.id}
</div>
<div className="post-timestamp">{post.timestamp}</div>
<div className="post-content">{post.content}</div>
</div>
<hr/>
*/