mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-17 15:53:28 +00:00
[tag popup] don't show new popup; added 'back' icon
This commit is contained in:
@@ -3,6 +3,7 @@ import { gettext, siteRoot } from '../../utils/constants';
|
||||
import { Utils } from '../../utils/utils';
|
||||
import PropTypes from 'prop-types';
|
||||
import ModalPortal from '../modal-portal';
|
||||
import { Modal } from 'reactstrap';
|
||||
import ListTagDialog from '../dialog/list-tag-dialog';
|
||||
import CreateTagDialog from '../dialog/create-tag-dialog';
|
||||
import UpdateTagDialog from '../dialog/update-tag-dialog';
|
||||
@@ -20,6 +21,7 @@ class DirTool extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
showTagPopup: false,
|
||||
currentTag: null,
|
||||
isListRepoTagShow: false,
|
||||
isUpdateRepoTagShow: false,
|
||||
@@ -29,7 +31,10 @@ class DirTool extends React.Component {
|
||||
}
|
||||
|
||||
onListRepoTagToggle = () => {
|
||||
this.setState({isListRepoTagShow: !this.state.isListRepoTagShow});
|
||||
this.setState({
|
||||
showTagPopup: !this.state.showTagPopup,
|
||||
isListRepoTagShow: !this.state.isListRepoTagShow
|
||||
});
|
||||
}
|
||||
|
||||
onCreateRepoTagToggle = () => {
|
||||
@@ -39,6 +44,13 @@ class DirTool extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
onCreateRepoTagPopupToggle = () => {
|
||||
this.setState({
|
||||
isCreateRepoTagShow: !this.state.isCreateRepoTagShow,
|
||||
showTagPopup: !this.state.showTagPopup
|
||||
});
|
||||
}
|
||||
|
||||
onUpdateRepoTagToggle = (currentTag) => {
|
||||
this.setState({
|
||||
currentTag: currentTag,
|
||||
@@ -47,6 +59,13 @@ class DirTool extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
onUpdateRepoTagPopupToggle = () => {
|
||||
this.setState({
|
||||
isUpdateRepoTagShow: !this.state.isUpdateRepoTagShow,
|
||||
showTagPopup: !this.state.showTagPopup
|
||||
});
|
||||
}
|
||||
|
||||
onListTaggedFileToggle = (currentTag) => {
|
||||
this.setState({
|
||||
currentTag: currentTag,
|
||||
@@ -55,6 +74,13 @@ class DirTool extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
onListTaggedFilePopupToggle = () => {
|
||||
this.setState({
|
||||
isListTaggedFileShow: !this.state.isListTaggedFileShow,
|
||||
showTagPopup: !this.state.showTagPopup
|
||||
});
|
||||
}
|
||||
|
||||
isMarkdownFile(filePath) {
|
||||
let name = Utils.getFileName(filePath);
|
||||
return name.indexOf('.md') > -1 ? true : false;
|
||||
@@ -74,8 +100,11 @@ class DirTool extends React.Component {
|
||||
<li className="toolbar-item"><a className="op-link sf2-icon-trash" href={trashUrl} title={gettext('Trash')} aria-label={gettext('Trash')}></a></li>
|
||||
<li className="toolbar-item"><a className="op-link sf2-icon-history" href={historyUrl} title={gettext('History')} aria-label={gettext('History')}></a></li>
|
||||
</ul>
|
||||
{this.state.isListRepoTagShow && (
|
||||
|
||||
{this.state.showTagPopup && (
|
||||
<ModalPortal>
|
||||
<Modal isOpen={true}>
|
||||
{this.state.isListRepoTagShow && (
|
||||
<ListTagDialog
|
||||
repoID={repoID}
|
||||
onListTagCancel={this.onListRepoTagToggle}
|
||||
@@ -83,32 +112,34 @@ class DirTool extends React.Component {
|
||||
onUpdateRepoTag={this.onUpdateRepoTagToggle}
|
||||
onListTaggedFiles={this.onListTaggedFileToggle}
|
||||
/>
|
||||
</ModalPortal>
|
||||
)}
|
||||
|
||||
{this.state.isCreateRepoTagShow && (
|
||||
<ModalPortal>
|
||||
<CreateTagDialog
|
||||
repoID={repoID}
|
||||
togglePopup={this.onCreateRepoTagPopupToggle}
|
||||
toggleCancel={this.onCreateRepoTagToggle}
|
||||
/>
|
||||
</ModalPortal>
|
||||
)}
|
||||
|
||||
{this.state.isUpdateRepoTagShow && (
|
||||
<ModalPortal>
|
||||
<UpdateTagDialog
|
||||
repoID={repoID}
|
||||
currentTag={this.state.currentTag}
|
||||
togglePopup={this.onUpdateRepoTagPopupToggle}
|
||||
toggleCancel={this.onUpdateRepoTagToggle}
|
||||
/>
|
||||
</ModalPortal>
|
||||
)}
|
||||
|
||||
{this.state.isListTaggedFileShow && (
|
||||
<ModalPortal>
|
||||
<ListTaggedFilesDialog
|
||||
repoID={this.props.repoID}
|
||||
currentTag={this.state.currentTag}
|
||||
togglePopup={this.onListTaggedFilePopupToggle}
|
||||
toggleCancel={this.onListTaggedFileToggle}
|
||||
/>
|
||||
)}
|
||||
</Modal>
|
||||
</ModalPortal>
|
||||
)}
|
||||
</Fragment>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { Fragment } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Input } from 'reactstrap';
|
||||
import { gettext } from '../../utils/constants';
|
||||
@@ -7,6 +7,7 @@ import { seafileAPI } from '../../utils/seafile-api';
|
||||
const propTypes = {
|
||||
repoID: PropTypes.string.isRequired,
|
||||
toggleCancel: PropTypes.func.isRequired,
|
||||
togglePopup: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
class CreateTagDialog extends React.Component {
|
||||
@@ -48,10 +49,6 @@ class CreateTagDialog extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
this.props.toggleCancel();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.setState({
|
||||
tagColor: this.state.colorList[0]
|
||||
@@ -63,8 +60,11 @@ class CreateTagDialog extends React.Component {
|
||||
render() {
|
||||
let colorList = this.state.colorList;
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('New Tag')}</ModalHeader>
|
||||
<Fragment>
|
||||
<ModalHeader toggle={this.props.togglePopup}>
|
||||
<span className="tag-popup-back fas fa-sm fa-arrow-left" onClick={this.props.toggleCancel} aria-label={gettext('Back')}></span>
|
||||
{gettext('New Tag')}
|
||||
</ModalHeader>
|
||||
<ModalBody>
|
||||
<div role="form" className="tag-create">
|
||||
<div className="form-group">
|
||||
@@ -94,9 +94,9 @@ class CreateTagDialog extends React.Component {
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="primary" onClick={this.createTag}>{gettext('Save')}</Button>
|
||||
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
||||
<Button color="secondary" onClick={this.props.toggleCancel}>{gettext('Cancel')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -103,7 +103,6 @@ class ListTagDialog extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<Fragment>
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('Tags')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<ul className="tag-list tag-list-container">
|
||||
@@ -123,7 +122,6 @@ class ListTagDialog extends React.Component {
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={this.toggle}>{gettext('Close')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { Fragment } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
|
||||
import { gettext, siteRoot } from '../../utils/constants';
|
||||
@@ -10,6 +10,7 @@ const propTypes = {
|
||||
repoID: PropTypes.string.isRequired,
|
||||
currentTag: PropTypes.object.isRequired,
|
||||
toggleCancel: PropTypes.func.isRequired,
|
||||
togglePopup: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
class ListTaggedFilesDialog extends React.Component {
|
||||
@@ -40,15 +41,14 @@ class ListTaggedFilesDialog extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
this.props.toggleCancel();
|
||||
}
|
||||
|
||||
render() {
|
||||
let taggedFileList = this.state.taggedFileList;
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('Tagged Files')}</ModalHeader>
|
||||
<Fragment>
|
||||
<ModalHeader toggle={this.props.togglePopup}>
|
||||
<span className="tag-popup-back fas fa-sm fa-arrow-left" onClick={this.props.toggleCancel} aria-label={gettext('Back')}></span>
|
||||
{gettext('Tagged Files')}
|
||||
</ModalHeader>
|
||||
<ModalBody className="dialog-list-container">
|
||||
<table>
|
||||
<thead className="table-thread-hidden">
|
||||
@@ -81,9 +81,9 @@ class ListTaggedFilesDialog extends React.Component {
|
||||
</table>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="primary" onClick={this.toggle}>{gettext('Close')}</Button>
|
||||
<Button color="primary" onClick={this.props.toggleCancel}>{gettext('Close')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ const propTypes = {
|
||||
currentTag: PropTypes.object,
|
||||
repoID: PropTypes.string.isRequired,
|
||||
toggleCancel: PropTypes.func.isRequired,
|
||||
togglePopup: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
class UpdateTagDialog extends React.Component {
|
||||
@@ -55,10 +56,6 @@ class UpdateTagDialog extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
this.props.toggleCancel();
|
||||
}
|
||||
|
||||
deleteTagClick = (item) => {
|
||||
this.setState({
|
||||
deleteRepoTag: !this.state.deleteRepoTag,
|
||||
@@ -77,8 +74,10 @@ class UpdateTagDialog extends React.Component {
|
||||
let colorList = this.state.colorList;
|
||||
return (
|
||||
<Fragment>
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('Edit Tag')}</ModalHeader>
|
||||
<ModalHeader toggle={this.props.togglePopup}>
|
||||
<span className="tag-popup-back fas fa-sm fa-arrow-left" onClick={this.props.toggleCancel} aria-label={gettext('Back')}></span>
|
||||
{gettext('Edit Tag')}
|
||||
</ModalHeader>
|
||||
<ModalBody>
|
||||
<div className="tag-edit">
|
||||
<div className="form-group">
|
||||
@@ -109,7 +108,6 @@ class UpdateTagDialog extends React.Component {
|
||||
<Button color="primary" onClick={this.updateTag}>{gettext('Save')}</Button>
|
||||
<Button color="danger" onClick={this.onDeleteTag}>{gettext('Delete')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
@@ -92,3 +92,13 @@
|
||||
.file-tag-item:hover {
|
||||
background-color: #bbb;
|
||||
}
|
||||
|
||||
.tag-popup-back {
|
||||
color: #888;
|
||||
cursor: pointer;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.tag-popup-back:hover,
|
||||
.tag-popup-back:focus {
|
||||
color: #444;
|
||||
}
|
||||
|
Reference in New Issue
Block a user