1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 16:31:13 +00:00
This commit is contained in:
MichaelAn
2018-11-12 09:28:02 +08:00
committed by Daniel Pan
parent 0915a44103
commit 66422e3454
5 changed files with 52 additions and 28 deletions

View File

@@ -43,8 +43,6 @@ class AddReviewerDialog extends React.Component {
loadOptions = (value, callback) => {
if (value.trim().length > 0) {
this.Options = [];
let that = this;
seafileAPI.searchUsers(value.trim()).then((res) => {
for (let i = 0 ; i < res.data.users.length; i++) {
let obj = {};
@@ -55,7 +53,8 @@ class AddReviewerDialog extends React.Component {
<img src={res.data.users[i].avatar_url} className="avatar reviewer-select-avatar" alt=""/>
<span className='reviewer-select-name'>{res.data.users[i].name}</span>
</React.Fragment>;
that.Options.push(obj);
this.Options.splice(0, this.Options.length);
this.Options.push(obj);
}
callback(this.Options);
});
@@ -131,7 +130,7 @@ class AddReviewerDialog extends React.Component {
<Button color="primary" onClick={this.addReviewers}>{gettext('Submit')}</Button>
}
<Button color="secondary" onClick={this.props.toggleAddReviewerDialog}>
{gettext('Cancel')}</Button>
{gettext('Close')}</Button>
</ModalFooter>
</Modal>
);

View File

@@ -31,12 +31,15 @@ class ReviewComments extends React.Component {
this.accountInfo = {};
}
listComments = () => {
listComments = (scroll) => {
seafileAPI.listReviewComments(reviewID).then((response) => {
response.data.comments.reverse();
this.setState({
commentsList: response.data.comments
});
if (scroll) {
this.refs.commentsList.scrollTo(0, 10000);
}
});
}
@@ -59,7 +62,7 @@ class ReviewComments extends React.Component {
let comment = this.refs.commentTextarea.value;
if (comment.trim().length > 0) {
seafileAPI.addReviewComment(reviewID, comment.trim()).then((res) => {
this.listComments();
this.listComments(true);
this.props.getCommentsNumber();
});
this.refs.commentTextarea.value = '';
@@ -108,6 +111,16 @@ class ReviewComments extends React.Component {
onResizeMouseMove = (event) => {
let rate = 100 - (event.nativeEvent.clientY - 50 ) / this.refs.comment.clientHeight * 100;
if (rate < 20 || rate > 70) {
if (rate < 20) {
this.setState({
commentFooterHeight: 25
});
}
if (rate > 70) {
this.setState({
commentFooterHeight: 65
});
}
this.setState({
inResizing: false
});
@@ -150,10 +163,11 @@ class ReviewComments extends React.Component {
<div className="comment-vacant">{gettext('No comment yet.')}</div>
</div>
}
{ (this.state.commentsList.length == 0 && this.props.commentsNumber > 0) &&
<div><Loading/></div>
{ (this.state.commentsList.length === 0 && this.props.commentsNumber > 0) &&
<div className={'seafile-comment-list'}><Loading/></div>
}
<ul className={'seafile-comment-list'}>
{ this.state.commentsList.length > 0 &&
<ul className={'seafile-comment-list'} ref='commentsList'>
{ (this.state.commentsList.length > 0 && this.props.commentsNumber > 0) &&
this.state.commentsList.map((item, index = 0, arr) => {
let oldTime = (new Date(item.created_at)).getTime();
@@ -172,6 +186,7 @@ class ReviewComments extends React.Component {
})
}
</ul>
}
</div>
<div className="seafile-comment-footer" style={{height:this.state.commentFooterHeight+'%'}}>
<div className="seafile-comment-row-resize" onMouseDown={this.onResizeMouseDown}></div>

View File

@@ -88,6 +88,9 @@
border-bottom: 1px solid #e6e6dd;
padding: 1em 0;
}
.reviewer-info {
margin-bottom: 0.8125rem;
}
.reviewers-header, .author-header {
display: flex;
justify-content: space-between;

View File

@@ -76,7 +76,10 @@
background-color: #fff;
height: 100%;
}
.seafile-comment-item .seafile-comment-info.seafile-comment-dropdown .seafile-comment-dropdown-btn {
.seafile-comment-dropdown button:hover i {
color: #555;
}
.seafile-comment-item .seafile-comment-info .seafile-comment-dropdown .seafile-comment-dropdown-btn {
color: #999;
}
.seafile-comment-item .seafile-comment-info .seafile-comment-dropdown:hover .seafile-comment-dropdown-btn {
@@ -136,6 +139,7 @@
height: calc(100% - 38px);
min-height: 90px;
width: 100%;
resize: none;
}
.seafile-comment-footer .seafile-add-comment .submit-comment {
height: 28px;

View File

@@ -157,6 +157,9 @@ class DraftReview extends React.Component {
}
toggleAddReviewerDialog = () => {
if (this.state.showReviewerDialog) {
this.listReviewers();
}
this.setState({
showReviewerDialog: !this.state.showReviewerDialog
});