mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Merge pull request #193 from ascribe/AG-162-stuck-piece-registration
Hide button and spinner in form instead of replace
This commit is contained in:
commit
6b147cdef9
@ -55,4 +55,4 @@ const FormSubmitButton = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default FormSubmitButton;
|
export default FormSubmitButton;
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactAddons from 'react/addons';
|
import ReactAddons from 'react/addons';
|
||||||
|
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import Button from 'react-bootstrap/lib/Button';
|
import Button from 'react-bootstrap/lib/Button';
|
||||||
import AlertDismissable from './alert';
|
import AlertDismissable from './alert';
|
||||||
|
|
||||||
@ -206,21 +208,30 @@ let Form = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getButtons() {
|
getButtons() {
|
||||||
if (this.state.submitted) {
|
const { buttons, disabled, buttonSubmitText, spinner } = this.props;
|
||||||
return this.props.spinner;
|
const { submitted, edited } = this.state;
|
||||||
}
|
|
||||||
if (this.props.buttons !== undefined) {
|
if (submitted || buttons !== undefined) {
|
||||||
return this.props.buttons;
|
return (
|
||||||
|
<div>
|
||||||
|
<div className={classNames({ 'hide': !submitted })}>
|
||||||
|
{spinner}
|
||||||
|
</div>
|
||||||
|
<div className={classNames({ 'hide': submitted })}>
|
||||||
|
{buttons}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.edited && !this.props.disabled) {
|
if (edited && !disabled) {
|
||||||
return (
|
return (
|
||||||
<div className="row" style={{margin: 0}}>
|
<div className="row" style={{margin: 0}}>
|
||||||
<p className="pull-right">
|
<p className="pull-right">
|
||||||
<Button
|
<Button
|
||||||
className="btn btn-default btn-sm ascribe-margin-1px"
|
className="btn btn-default btn-sm ascribe-margin-1px"
|
||||||
type="submit">
|
type="submit">
|
||||||
{this.props.buttonSubmitText}
|
{buttonSubmitText}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
className="btn btn-danger btn-delete btn-sm ascribe-margin-1px"
|
className="btn btn-danger btn-delete btn-sm ascribe-margin-1px"
|
||||||
|
Loading…
Reference in New Issue
Block a user