reformat post_body.jsx to match style guide more closely
Этот коммит содержится в:
@@ -9,11 +9,11 @@ var Constants = require('../utils/constants.jsx');
|
|||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
componentWillReceiveProps: function(nextProps) {
|
componentWillReceiveProps: function(nextProps) {
|
||||||
var linkData = utils.extractLinks(nextProps.post.message);
|
var linkData = utils.extractLinks(nextProps.post.message);
|
||||||
this.setState({ links: linkData["links"], message: linkData["text"] });
|
this.setState({links: linkData.links, message: linkData.text});
|
||||||
},
|
},
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
var linkData = utils.extractLinks(this.props.post.message);
|
var linkData = utils.extractLinks(this.props.post.message);
|
||||||
return { links: linkData["links"], message: linkData["text"] };
|
return {links: linkData.links, message: linkData.text};
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
var post = this.props.post;
|
var post = this.props.post;
|
||||||
@@ -21,43 +21,43 @@ module.exports = React.createClass({
|
|||||||
var parentPost = this.props.parentPost;
|
var parentPost = this.props.parentPost;
|
||||||
var inner = utils.textToJsx(this.state.message);
|
var inner = utils.textToJsx(this.state.message);
|
||||||
|
|
||||||
var comment = "";
|
var comment = '';
|
||||||
var reply = "";
|
var reply = '';
|
||||||
var postClass = "";
|
var postClass = '';
|
||||||
|
|
||||||
if (parentPost) {
|
if (parentPost) {
|
||||||
var profile = UserStore.getProfile(parentPost.user_id);
|
var profile = UserStore.getProfile(parentPost.user_id);
|
||||||
var apostrophe = "";
|
var apostrophe = '';
|
||||||
var name = "...";
|
var name = '...';
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
if (profile.username.slice(-1) === 's') {
|
if (profile.username.slice(-1) === 's') {
|
||||||
apostrophe = '\'';
|
apostrophe = '\'';
|
||||||
} else {
|
} else {
|
||||||
apostrophe = '\'s';
|
apostrophe = '\'s';
|
||||||
}
|
}
|
||||||
name = <a className="theme" onClick={function(){ utils.searchForTerm(profile.username); }}>{profile.username}</a>;
|
name = <a className='theme' onClick={function searchName() { utils.searchForTerm(profile.username); }}>{profile.username}</a>;
|
||||||
}
|
}
|
||||||
|
|
||||||
var message = ""
|
var message = '';
|
||||||
if(parentPost.message) {
|
if (parentPost.message) {
|
||||||
message = utils.replaceHtmlEntities(parentPost.message)
|
message = utils.replaceHtmlEntities(parentPost.message);
|
||||||
} else if (parentPost.filenames.length) {
|
} else if (parentPost.filenames.length) {
|
||||||
message = parentPost.filenames[0].split('/').pop();
|
message = parentPost.filenames[0].split('/').pop();
|
||||||
|
|
||||||
if (parentPost.filenames.length === 2) {
|
if (parentPost.filenames.length === 2) {
|
||||||
message += " plus 1 other file";
|
message += ' plus 1 other file';
|
||||||
} else if (parentPost.filenames.length > 2) {
|
} else if (parentPost.filenames.length > 2) {
|
||||||
message += " plus " + (parentPost.filenames.length - 1) + " other files";
|
message += ' plus ' + (parentPost.filenames.length - 1) + ' other files';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
comment = (
|
comment = (
|
||||||
<p className="post-link">
|
<p className='post-link'>
|
||||||
<span>Commented on {name}{apostrophe} message: <a className="theme" onClick={this.props.handleCommentClick}>{message}</a></span>
|
<span>Commented on {name}{apostrophe} message: <a className='theme' onClick={this.props.handleCommentClick}>{message}</a></span>
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
|
||||||
postClass += " post-comment";
|
postClass += ' post-comment';
|
||||||
}
|
}
|
||||||
|
|
||||||
var loading;
|
var loading;
|
||||||
@@ -84,9 +84,9 @@ module.exports = React.createClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="post-body">
|
<div className='post-body'>
|
||||||
{comment}
|
{comment}
|
||||||
<p key={post.id+"_message"} className={postClass}>{loading}<span>{inner}</span></p>
|
<p key={post.id + '_message'} className={postClass}>{loading}<span>{inner}</span></p>
|
||||||
{fileAttachmentHolder}
|
{fileAttachmentHolder}
|
||||||
{embed}
|
{embed}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user