diff options
| author | Zog | 2017-12-27 15:40:25 +0100 |
|---|---|---|
| committer | Zog | 2017-12-27 15:40:25 +0100 |
| commit | 590c63521cc29a3704e93f326e8f9b7c300b71d8 (patch) | |
| tree | 04c315e438e62eaac6918379aeec332dc1eb95e4 | |
| parent | 7d61f7cb513b6df9d0c72e6ad0d13748a5db7be2 (diff) | |
| download | chouette-core-590c63521cc29a3704e93f326e8f9b7c300b71d8.tar.bz2 | |
Refs #5407; Add cancel button on VehicleJourneys editor
| -rw-r--r-- | app/javascript/vehicle_journeys/components/SaveVehicleJourneys.js | 32 | ||||
| -rw-r--r-- | app/javascript/vehicle_journeys/containers/SaveVehicleJourneys.js | 4 |
2 files changed, 26 insertions, 10 deletions
diff --git a/app/javascript/vehicle_journeys/components/SaveVehicleJourneys.js b/app/javascript/vehicle_journeys/components/SaveVehicleJourneys.js index 285e2d506..5e69af301 100644 --- a/app/javascript/vehicle_journeys/components/SaveVehicleJourneys.js +++ b/app/javascript/vehicle_journeys/components/SaveVehicleJourneys.js @@ -14,16 +14,27 @@ export default class SaveVehicleJourneys extends Component{ <div className='row mt-md'> <div className='col-lg-12 text-right'> <form className='vehicle_journeys formSubmitr ml-xs' onSubmit={e => {e.preventDefault()}}> - <button - className='btn btn-default' - type='button' - onClick={e => { - e.preventDefault() - this.props.editMode ? this.props.onSubmitVehicleJourneys(this.props.dispatch, this.props.vehicleJourneys) : this.props.onEnterEditMode() - }} - > - {this.props.editMode ? "Valider" : "Editer"} - </button> + <div className="btn-group sticky-actions"> + <button + className={'btn ' + (this.props.editMode ? 'btn-success' : 'btn-default')} + type='button' + onClick={e => { + e.preventDefault() + this.props.editMode ? this.props.onSubmitVehicleJourneys(this.props.dispatch, this.props.vehicleJourneys) : this.props.onEnterEditMode() + }} + > + {this.props.editMode ? "Valider" : "Editer"} + </button> + {this.props.editMode && <button + className='btn btn-default' + type='button' + onClick={e => { + e.preventDefault() + this.props.onExitEditMode() + }} + > Annuler </button> + } + </div> </form> </div> </div> @@ -38,5 +49,6 @@ SaveVehicleJourneys.propTypes = { status: PropTypes.object.isRequired, filters: PropTypes.object.isRequired, onEnterEditMode: PropTypes.func.isRequired, + onExitEditMode: PropTypes.func.isRequired, onSubmitVehicleJourneys: PropTypes.func.isRequired } diff --git a/app/javascript/vehicle_journeys/containers/SaveVehicleJourneys.js b/app/javascript/vehicle_journeys/containers/SaveVehicleJourneys.js index 18f9e994e..f5f879ed8 100644 --- a/app/javascript/vehicle_journeys/containers/SaveVehicleJourneys.js +++ b/app/javascript/vehicle_journeys/containers/SaveVehicleJourneys.js @@ -17,6 +17,10 @@ const mapDispatchToProps = (dispatch) => { onEnterEditMode: () => { dispatch(actions.enterEditMode()) }, + onExitEditMode: () => { + dispatch(actions.cancelSelection()) + dispatch(actions.exitEditMode()) + }, onSubmitVehicleJourneys: (next, state) => { actions.submitVehicleJourneys(dispatch, state, next) } |
