Created
April 1, 2015 19:01
-
-
Save anonymous/75a641cb97f570d06c98 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mixins: [Reflux.listenTo(BuildingAppStore,"onBuildingChange")], | |
| getInitialState: function(){ | |
| BuildingActions.loadData(); | |
| return { | |
| objects: BuildingAppStore.getObjects(), | |
| errors: BuildingAppStore.getError() | |
| }; | |
| }, | |
| onBuildingChange:function(item){ | |
| var error = BuildingAppStore.getError(); | |
| if(!error) | |
| { | |
| this.setState({ | |
| objects: BuildingAppStore.getObjects(), | |
| errors: error | |
| }); | |
| if(this.state.deleting) | |
| { | |
| this.setState({ | |
| editObject: {}, | |
| isEditing: false, | |
| deleting: false | |
| }); | |
| } | |
| else if(this.state.isEditing) | |
| { | |
| this.setState({ | |
| editObject: item, | |
| isEditing: true, | |
| deleting: false | |
| }); | |
| } | |
| else if(item.id) | |
| { | |
| this.setState({ | |
| editObject: item, | |
| isEditing: true, | |
| deleting: false | |
| }); | |
| } | |
| } | |
| else | |
| { | |
| this.setState({ | |
| errors: error, | |
| editObject: item, | |
| isEditing: true | |
| }); | |
| } | |
| }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment