1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-22 11:57:34 +00:00

[tag popup] don't show new popup; added 'back' icon

This commit is contained in:
llj
2018-12-20 18:45:31 +08:00
parent 3d324389f7
commit 983bf03c10
6 changed files with 146 additions and 109 deletions

View File

@@ -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>
);
}
}

View File

@@ -103,27 +103,25 @@ 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">
{this.state.repotagList.map((repoTag, index) => {
return (
<TagListItem
key={index}
item={repoTag}
onTagUpdate={this.props.onUpdateRepoTag}
onListTaggedFiles={this.props.onListTaggedFiles}
/>
);
})}
</ul>
<a href="#" className="add-tag-link" onClick={this.createNewTag}>{gettext('Create a new tag')}</a>
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={this.toggle}>{gettext('Close')}</Button>
</ModalFooter>
</Modal>
<ModalHeader toggle={this.toggle}>{gettext('Tags')}</ModalHeader>
<ModalBody>
<ul className="tag-list tag-list-container">
{this.state.repotagList.map((repoTag, index) => {
return (
<TagListItem
key={index}
item={repoTag}
onTagUpdate={this.props.onUpdateRepoTag}
onListTaggedFiles={this.props.onListTaggedFiles}
/>
);
})}
</ul>
<a href="#" className="add-tag-link" onClick={this.createNewTag}>{gettext('Create a new tag')}</a>
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={this.toggle}>{gettext('Close')}</Button>
</ModalFooter>
</Fragment>
);
}

View File

@@ -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>
);
}
}

View File

@@ -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,39 +74,40 @@ 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>
<ModalBody>
<div className="tag-edit">
<div className="form-group">
<label className="form-label">{gettext('Name')}</label>
<Input onKeyPress={this.handleKeyPress} innerRef={input => {this.newInput = input;}} placeholder="newName" value={this.state.newName} onChange={this.inputNewName}/>
</div>
<div className="form-group">
<label className="form-label">{gettext('Select a color')}</label>
<div className="row gutters-xs">
{colorList.map((item, index)=>{
var className = 'colorinput-color bg-' + item;
return (
<div key={index} className="col-auto" onChange={this.selectNewcolor}>
<label className="colorinput">
{item===this.props.currentTag.color ?
<input name="color" type="radio" value={item} className="colorinput-input" defaultChecked onChange={this.selectNewcolor}></input> :
<input name="color" type="radio" value={item} className="colorinput-input" onChange={this.selectNewcolor}></input>}
<span className={className}></span>
</label>
</div>
);
})}
</div>
<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">
<label className="form-label">{gettext('Name')}</label>
<Input onKeyPress={this.handleKeyPress} innerRef={input => {this.newInput = input;}} placeholder="newName" value={this.state.newName} onChange={this.inputNewName}/>
</div>
<div className="form-group">
<label className="form-label">{gettext('Select a color')}</label>
<div className="row gutters-xs">
{colorList.map((item, index)=>{
var className = 'colorinput-color bg-' + item;
return (
<div key={index} className="col-auto" onChange={this.selectNewcolor}>
<label className="colorinput">
{item===this.props.currentTag.color ?
<input name="color" type="radio" value={item} className="colorinput-input" defaultChecked onChange={this.selectNewcolor}></input> :
<input name="color" type="radio" value={item} className="colorinput-input" onChange={this.selectNewcolor}></input>}
<span className={className}></span>
</label>
</div>
);
})}
</div>
</div>
</ModalBody>
<ModalFooter>
<Button color="primary" onClick={this.updateTag}>{gettext('Save')}</Button>
<Button color="danger" onClick={this.onDeleteTag}>{gettext('Delete')}</Button>
</ModalFooter>
</Modal>
</div>
</ModalBody>
<ModalFooter>
<Button color="primary" onClick={this.updateTag}>{gettext('Save')}</Button>
<Button color="danger" onClick={this.onDeleteTag}>{gettext('Delete')}</Button>
</ModalFooter>
</Fragment>
);
}