mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-25 06:33:48 +00:00
Add new-wiki-dialog.js
This commit is contained in:
@@ -16,6 +16,7 @@ class NewWikiDialog extends React.Component {
|
|||||||
isExist: false,
|
isExist: false,
|
||||||
name: '',
|
name: '',
|
||||||
repoID: '',
|
repoID: '',
|
||||||
|
isSubmitBtnActive: false,
|
||||||
};
|
};
|
||||||
this.newName = React.createRef();
|
this.newName = React.createRef();
|
||||||
}
|
}
|
||||||
@@ -26,6 +27,12 @@ class NewWikiDialog extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inputNewName = (e) => {
|
inputNewName = (e) => {
|
||||||
|
if (!event.target.value.trim()) {
|
||||||
|
this.setState({isSubmitBtnActive: false});
|
||||||
|
} else {
|
||||||
|
this.setState({isSubmitBtnActive: true});
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
name: e.target.value,
|
name: e.target.value,
|
||||||
});
|
});
|
||||||
@@ -57,7 +64,7 @@ class NewWikiDialog extends React.Component {
|
|||||||
</ModalBody>
|
</ModalBody>
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
||||||
<Button color="primary" onClick={this.handleSubmit}>{gettext('Submit')}</Button>
|
<Button color="primary" onClick={this.handleSubmit} disabled={!this.state.isSubmitBtnActive}>{gettext('Submit')}</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user