diff options
| author | cedricnjanga | 2017-11-27 15:45:37 +0100 |
|---|---|---|
| committer | cedricnjanga | 2017-11-27 16:15:51 +0100 |
| commit | d5db245d67ba14351f09c707b566671e1bd04541 (patch) | |
| tree | 96d2ae3bd6b8945d980ffe655246633ba192e334 /app/javascript | |
| parent | d832ccaa091595bbab0ee0e4c5e863905963686c (diff) | |
| download | chouette-core-d5db245d67ba14351f09c707b566671e1bd04541.tar.bz2 | |
Refs #4941 Fix objectid short version Display on views
Diffstat (limited to 'app/javascript')
9 files changed, 10 insertions, 16 deletions
diff --git a/app/javascript/journey_patterns/actions/index.js b/app/javascript/journey_patterns/actions/index.js index 8bea5a990..4ff3f77ea 100644 --- a/app/javascript/journey_patterns/actions/index.js +++ b/app/javascript/journey_patterns/actions/index.js @@ -90,10 +90,6 @@ const actions = { resetValidation: (target) => { $(target).parent().removeClass('has-error').children('.help-block').remove() }, - humanOID : (oid) => { - let shortOId = oid.split(':')[2].split("-").pop() - return shortOId.length > 10 ? `${shortOId.slice(0, 10)}...` : shortOId - }, validateFields : (fields) => { const test = [] @@ -201,6 +197,7 @@ const actions = { journeyPatterns.push({ name: val.name, object_id: val.object_id, + short_id: val.short_id, published_name: val.published_name, registration_number: val.registration_number, stop_points: val.route_short_description.stop_points, diff --git a/app/javascript/journey_patterns/components/JourneyPattern.js b/app/javascript/journey_patterns/components/JourneyPattern.js index 34d102c5d..d4c9816ec 100644 --- a/app/javascript/journey_patterns/components/JourneyPattern.js +++ b/app/javascript/journey_patterns/components/JourneyPattern.js @@ -68,7 +68,7 @@ export default class JourneyPattern extends Component{ {/* this.props.value.errors ? this.getErrors(this.props.value.errors) : '' */} <div className='th'> - <div className='strong mb-xs'>{this.props.value.object_id ? actions.humanOID(this.props.value.object_id) : '-'}</div> + <div className='strong mb-xs'>{this.props.value.object_id ? this.props.value.short_id : '-'}</div> <div>{this.props.value.registration_number}</div> <div>{actions.getChecked(this.props.value.stop_points).length} arrêt(s)</div> diff --git a/app/javascript/vehicle_journeys/actions/index.js b/app/javascript/vehicle_journeys/actions/index.js index 95c739893..ddb54d615 100644 --- a/app/javascript/vehicle_journeys/actions/index.js +++ b/app/javascript/vehicle_journeys/actions/index.js @@ -269,10 +269,6 @@ const actions = { type: 'RECEIVE_TOTAL_COUNT', total }), - humanOID: (oid) => { - let shortOId = oid.split(':')[2].split("-").pop() - return shortOId.length > 10 ? `${shortOId.slice(0, 10)}...` : shortOId - }, fetchVehicleJourneys : (dispatch, currentPage, nextPage, queryString) => { if(currentPage == undefined){ currentPage = 1 @@ -334,6 +330,7 @@ const actions = { journey_pattern: val.journey_pattern, published_journey_name: val.published_journey_name, objectid: val.objectid, + short_id: val.short_id, footnotes: val.footnotes, time_tables: timeTables, vehicle_journey_at_stops: vjasWithDelta, diff --git a/app/javascript/vehicle_journeys/components/VehicleJourney.js b/app/javascript/vehicle_journeys/components/VehicleJourney.js index 13f8eced2..8fb4b8a7e 100644 --- a/app/javascript/vehicle_journeys/components/VehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/VehicleJourney.js @@ -49,8 +49,8 @@ export default class VehicleJourney extends Component { return ( <div className={'t2e-item' + (this.props.value.deletable ? ' disabled' : '') + (this.props.value.errors ? ' has-error': '')}> <div className='th'> - <div className='strong mb-xs'>{this.props.value.objectid ? actions.humanOID(this.props.value.objectid) : '-'}</div> - <div>{actions.humanOID(this.props.value.journey_pattern.objectid)}</div> + <div className='strong mb-xs'>{this.props.value.objectid ? this.props.value.short_id : '-'}</div> + <div>{this.props.value.journey_pattern.short_id}</div> <div> {time_tables.slice(0,3).map((tt, i)=> <span key={i} className='vj_tt'>{this.timeTableURL(tt)}</span> diff --git a/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js index 7ad3cf510..7d91896eb 100644 --- a/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js @@ -72,7 +72,7 @@ export default class EditVehicleJourney extends Component { <input type='text' className='form-control' - value={actions.humanOID(this.props.modal.modalProps.vehicleJourney.journey_pattern.objectid) + ' - ' + (this.props.modal.modalProps.vehicleJourney.journey_pattern.name)} + value={this.props.modal.modalProps.vehicleJourney.journey_pattern.short_id + ' - ' + (this.props.modal.modalProps.vehicleJourney.journey_pattern.name)} disabled={true} /> </div> diff --git a/app/javascript/vehicle_journeys/components/tools/ShiftVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/ShiftVehicleJourney.js index ebfbed9eb..a54e40502 100644 --- a/app/javascript/vehicle_journeys/components/tools/ShiftVehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/tools/ShiftVehicleJourney.js @@ -49,7 +49,7 @@ export default class ShiftVehicleJourney extends Component { <div className='modal-header'> <h4 className='modal-title'>Mettre à jour une course</h4> {(this.props.modal.type == 'shift') && ( - <em>Mettre à jour les horaires de la course {actions.humanOID(actions.getSelected(this.props.vehicleJourneys)[0].objectid)}</em> + <em>Mettre à jour les horaires de la course {actions.getSelected(this.props.vehicleJourneys)[0].short_id}</em> )} <span type="button" className="close modal-close" data-dismiss="modal">×</span> </div> diff --git a/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js index 6069bf089..5b4ae564c 100644 --- a/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js +++ b/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js @@ -42,7 +42,7 @@ export default class BSelect4 extends Component { item => _.assign( {}, item, - { text: "<strong>" + item.published_name + " - " + actions.humanOID(item.object_id) + "</strong><br/><small>" + item.registration_number + "</small>" } + { text: "<strong>" + item.published_name + " - " + item.short_id + "</strong><br/><small>" + item.registration_number + "</small>" } ) ) }; diff --git a/app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js index 60c3eab83..a90a9f7b8 100644 --- a/app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js +++ b/app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js @@ -44,7 +44,7 @@ export default class BSelect4 extends Component { item => _.assign( {}, item, - {text: '<strong>' + "<span class='fa fa-circle' style='color:" + (item.color ? item.color : '#4B4B4B') + "'></span> " + item.comment + ' - ' + actions.humanOID(item.objectid) + '</strong><br/><small>' + (item.day_types ? item.day_types.match(/[A-Z]?[a-z]+/g).join(', ') : "") + '</small>'} + {text: '<strong>' + "<span class='fa fa-circle' style='color:" + (item.color ? item.color : '#4B4B4B') + "'></span> " + item.comment + ' - ' + item.short_id + '</strong><br/><small>' + (item.day_types ? item.day_types.match(/[A-Z]?[a-z]+/g).join(', ') : "") + '</small>'} ) ) }; diff --git a/app/javascript/vehicle_journeys/components/tools/select2s/VJSelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/VJSelect2.js index 7cccbbc05..37628fce0 100644 --- a/app/javascript/vehicle_journeys/components/tools/select2s/VJSelect2.js +++ b/app/javascript/vehicle_journeys/components/tools/select2s/VJSelect2.js @@ -42,7 +42,7 @@ export default class BSelect4b extends Component { item => _.assign( {}, item, - { id: item.objectid, text: actions.humanOID(item.objectid) } + { id: item.objectid, text: item.short_id } ) ) }; |
