1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-11-01 00:10:06 -04:00

Clean up some more problems after switching to using classes

This commit is contained in:
Aaron Lindsay 2017-06-10 13:37:13 -04:00
parent 905e30d87b
commit c4268ddfc8
3 changed files with 17 additions and 12 deletions

View File

@ -145,12 +145,12 @@ function importFile(url, inputElement) {
} }
function importOFXFile(inputElement, account) { function importOFXFile(inputElement, account) {
url = "account/"+account.AccountId+"/import/ofxfile"; var url = "account/"+account.AccountId+"/import/ofxfile";
return importFile(url, inputElement); return importFile(url, inputElement);
} }
function importGnucash(inputElement) { function importGnucash(inputElement) {
url = "import/gnucash"; var url = "import/gnucash";
return importFile(url, inputElement); return importFile(url, inputElement);
} }

View File

@ -781,8 +781,10 @@ class AccountRegister extends React.Component {
handleImportComplete() { handleImportComplete() {
this.props.onCloseImportModal(); this.props.onCloseImportModal();
this.props.onFetchAllAccounts(); this.props.onFetchAllAccounts();
if (this.props.selectedAccount != -1) {
this.props.onFetchTransactionPage(this.props.accounts[this.props.selectedAccount], this.props.pageSize, this.props.transactionPage.page); this.props.onFetchTransactionPage(this.props.accounts[this.props.selectedAccount], this.props.pageSize, this.props.transactionPage.page);
} }
}
handleDeleteTransaction(transaction) { handleDeleteTransaction(transaction) {
this.props.onDeleteTransaction(transaction); this.props.onDeleteTransaction(transaction);
this.props.onUnselectTransaction(); this.props.onUnselectTransaction();

View File

@ -27,6 +27,9 @@ class NewUserModal extends React.Component {
passwordChanged: false, passwordChanged: false,
initial_password: "" initial_password: ""
}; };
this.onCancel = this.handleCancel.bind(this);
this.onChange = this.handleChange.bind(this);
this.onSubmit = this.handleSubmit.bind(this);
} }
passwordValidationState() { passwordValidationState() {
if (this.state.passwordChanged) { if (this.state.passwordChanged) {
@ -81,19 +84,19 @@ class NewUserModal extends React.Component {
} }
render() { render() {
return ( return (
<Modal show={this.props.show} onHide={this.handleCancel} bsSize="large"> <Modal show={this.props.show} onHide={this.onCancel} bsSize="large">
<Modal.Header closeButton> <Modal.Header closeButton>
<Modal.Title>Create New user</Modal.Title> <Modal.Title>Create New user</Modal.Title>
</Modal.Header> </Modal.Header>
<Modal.Body> <Modal.Body>
<span style={{color: "red"}}>{this.state.error}</span> <span style={{color: "red"}}>{this.state.error}</span>
<Form horizontal onSubmit={this.handleSubmit}> <Form horizontal onSubmit={this.onSubmit}>
<FormGroup> <FormGroup>
<Col componentClass={ControlLabel} xs={2}>Name</Col> <Col componentClass={ControlLabel} xs={2}>Name</Col>
<Col xs={10}> <Col xs={10}>
<FormControl type="text" <FormControl type="text"
value={this.state.name} value={this.state.name}
onChange={this.handleChange} onChange={this.onChange}
ref="name"/> ref="name"/>
</Col> </Col>
</FormGroup> </FormGroup>
@ -102,7 +105,7 @@ class NewUserModal extends React.Component {
<Col xs={10}> <Col xs={10}>
<FormControl type="text" <FormControl type="text"
value={this.state.username} value={this.state.username}
onChange={this.handleChange} onChange={this.onChange}
ref="username"/> ref="username"/>
</Col> </Col>
</FormGroup> </FormGroup>
@ -111,7 +114,7 @@ class NewUserModal extends React.Component {
<Col xs={10}> <Col xs={10}>
<FormControl type="email" <FormControl type="email"
value={this.state.email} value={this.state.email}
onChange={this.handleChange} onChange={this.onChange}
ref="email"/> ref="email"/>
</Col> </Col>
</FormGroup> </FormGroup>
@ -120,7 +123,7 @@ class NewUserModal extends React.Component {
<Col xs={10}> <Col xs={10}>
<FormControl type="password" <FormControl type="password"
value={this.state.password} value={this.state.password}
onChange={this.handleChange} onChange={this.onChange}
ref="password"/> ref="password"/>
<FormControl.Feedback/> <FormControl.Feedback/>
</Col> </Col>
@ -130,7 +133,7 @@ class NewUserModal extends React.Component {
<Col xs={10}> <Col xs={10}>
<FormControl type="password" <FormControl type="password"
value={this.state.confirm_password} value={this.state.confirm_password}
onChange={this.handleChange} onChange={this.onChange}
ref="confirm_password"/> ref="confirm_password"/>
<FormControl.Feedback/> <FormControl.Feedback/>
</Col> </Col>
@ -139,9 +142,9 @@ class NewUserModal extends React.Component {
</Modal.Body> </Modal.Body>
<Modal.Footer> <Modal.Footer>
<ButtonGroup> <ButtonGroup>
<Button onClick={this.handleCancel} <Button onClick={this.onCancel}
bsStyle="warning">Cancel</Button> bsStyle="warning">Cancel</Button>
<Button onClick={this.handleSubmit} <Button onClick={this.onSubmit}
bsStyle="success">Create New User</Button> bsStyle="success">Create New User</Button>
</ButtonGroup> </ButtonGroup>
</Modal.Footer> </Modal.Footer>