1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-30 21:52:08 +02:00

Property:

- update initialValue when Property has been save successfully to enable consecutive cancel + save actions

Private Note:

- Made private note non-required
This commit is contained in:
Tim Daubenschütz 2015-07-21 16:23:50 +02:00
parent d0e5fe50cb
commit 550a2d9e58
2 changed files with 11 additions and 7 deletions

View File

@ -328,8 +328,7 @@ let EditionPersonalNote = React.createClass({
rows={1}
editable={true}
defaultValue={this.props.edition.note_from_user}
placeholder={getLangText('Enter a personal note%s', '...')}
required="required"/>
placeholder={getLangText('Enter a personal note%s', '...')}/>
</Property>
<Property hidden={true} name='bitcoin_id'>
<input defaultValue={this.props.edition.bitcoin_id}/>

View File

@ -57,13 +57,15 @@ let Property = React.createClass({
});
}
this.setState({
initialValue: this.refs.input.getDOMNode().defaultValue
});
if(!this.state.initialValue) {
this.setState({
initialValue: this.refs.input.getDOMNode().defaultValue
});
}
},
reset(){
// maybe do reset by reload instead of frontend state?
// maybe do reset by reload instead of front end state?
this.setState({value: this.state.initialValue});
if (this.refs.input.state){
// This is probably not the right way but easy fix
@ -117,7 +119,10 @@ let Property = React.createClass({
handleSuccess(){
this.setState({
isFocused: false,
errors: null
errors: null,
// also update initialValue in case of the user updating and canceling its actions again
initialValue: this.refs.input.getDOMNode().value
});
},