1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 02:42:47 +00:00

fix-related-file (#2778)

This commit is contained in:
Michael An
2019-01-07 15:57:38 +08:00
committed by Daniel Pan
parent b6ee4fb34b
commit 3f2e9303d6
2 changed files with 10 additions and 2 deletions

View File

@@ -60,7 +60,7 @@ class AddRelatedFileDialog extends React.Component {
}
onDirentItemClick = (repo, selectedPath, dirent) => {
if(dirent.type === 'file') {
if (dirent.type === 'file') {
this.setState({
repo: repo,
selectedPath: selectedPath,
@@ -74,6 +74,13 @@ class AddRelatedFileDialog extends React.Component {
}
}
onRepoItemClick = (repo) => {
this.setState({
repo: null,
selectedPath: '',
});
}
render() {
let subtitle = gettext('Select related file for {placeholder}');
subtitle = subtitle.replace('{placeholder}', '<span class="sf-font">' + Utils.HTMLescape(this.props.dirent.name) + '</span>');
@@ -86,6 +93,7 @@ class AddRelatedFileDialog extends React.Component {
isShowFile={this.state.isShowFile}
repoID={this.props.repoID}
onDirentItemClick={this.onDirentItemClick}
onRepoItemClick={this.onRepoItemClick}
/>
{this.state.errMessage && <Alert color="danger">{this.state.errMessage}</Alert>}
</ModalBody>

View File

@@ -147,7 +147,7 @@ class RelatedFile extends React.Component {
<td><a href={relatedFile.link} target='_blank'>{relatedFile.name}</a></td>
<td>{relatedFile.repo_name}</td>
<td>{relatedFile.size}</td>
<td>{relatedFile.mtime}</td>
<td>{relatedFile.mtime_relative}</td>
<td><i className={className} onClick={this.props.onDeleteRelatedFile.bind(this, relatedFile)}></i></td>
</tr>
);