shinoka7 6 лет назад
Родитель
Сommit
30cda04e97

+ 13 - 1
src/client/js/components/PageComment/Comment.jsx

@@ -24,6 +24,7 @@ export default class Comment extends React.Component {
 
 
     this.state = {
     this.state = {
       html: '',
       html: '',
+      isLayoutTypeGrowi: false,
     };
     };
 
 
     this.isCurrentUserIsAuthor = this.isCurrentUserEqualsToAuthor.bind(this);
     this.isCurrentUserIsAuthor = this.isCurrentUserEqualsToAuthor.bind(this);
@@ -36,6 +37,12 @@ export default class Comment extends React.Component {
 
 
   componentWillMount() {
   componentWillMount() {
     this.renderHtml(this.props.comment.comment);
     this.renderHtml(this.props.comment.comment);
+    this.init();
+  }
+
+  init() {
+    const layoutType = this.props.crowi.getConfig().layoutType;
+    this.setState({ isLayoutTypeGrowi: layoutType === 'crowi-plus' || layoutType === 'growi' });
   }
   }
 
 
   componentWillReceiveProps(nextProps) {
   componentWillReceiveProps(nextProps) {
@@ -114,7 +121,12 @@ export default class Comment extends React.Component {
   }
   }
 
 
   renderReplies() {
   renderReplies() {
-    return this.props.replyList.map((reply) => {
+    const isLayoutTypeGrowi = this.state.isLayoutTypeGrowi;
+    let replyList = this.props.replyList;
+    if (!isLayoutTypeGrowi) {
+      replyList = replyList.slice().reverse();
+    }
+    return replyList.map((reply) => {
       return (
       return (
         <div key={reply._id} className="col-xs-offset-1 col-xs-11 col-sm-offset-1 col-sm-11 col-md-offset-1 col-md-11 col-lg-offset-1 col-lg-11">
         <div key={reply._id} className="col-xs-offset-1 col-xs-11 col-sm-offset-1 col-sm-11 col-md-offset-1 col-md-11 col-lg-offset-1 col-lg-11">
           <Comment
           <Comment

+ 2 - 1
src/client/js/components/PageComment/CommentEditorLazyRenderer.jsx

@@ -27,7 +27,7 @@ export default class CommentEditorLazyRenderer extends React.Component {
   }
   }
 
 
   showCommentFormBtnClickHandler() {
   showCommentFormBtnClickHandler() {
-    this.setState({ isEditorShown: true });
+    this.setState({ isEditorShown: !this.state.isEditorShown });
   }
   }
 
 
   render() {
   render() {
@@ -70,6 +70,7 @@ export default class CommentEditorLazyRenderer extends React.Component {
           <CommentEditor
           <CommentEditor
             {...this.props}
             {...this.props}
             replyTo={undefined}
             replyTo={undefined}
+            commentButtonClickedHandler={this.showCommentFormBtnClickHandler}
           >
           >
           </CommentEditor>
           </CommentEditor>
 )
 )