From d5db245d67ba14351f09c707b566671e1bd04541 Mon Sep 17 00:00:00 2001 From: cedricnjanga Date: Mon, 27 Nov 2017 15:45:37 +0100 Subject: Refs #4941 Fix objectid short version Display on views --- app/javascript/journey_patterns/actions/index.js | 5 +---- app/javascript/journey_patterns/components/JourneyPattern.js | 2 +- app/javascript/vehicle_journeys/actions/index.js | 5 +---- app/javascript/vehicle_journeys/components/VehicleJourney.js | 4 ++-- .../vehicle_journeys/components/tools/EditVehicleJourney.js | 2 +- .../vehicle_journeys/components/tools/ShiftVehicleJourney.js | 2 +- .../vehicle_journeys/components/tools/select2s/MissionSelect2.js | 2 +- .../vehicle_journeys/components/tools/select2s/TimetableSelect2.js | 2 +- .../vehicle_journeys/components/tools/select2s/VJSelect2.js | 2 +- 9 files changed, 10 insertions(+), 16 deletions(-) (limited to 'app/javascript') 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) : '' */}
-
{this.props.value.object_id ? actions.humanOID(this.props.value.object_id) : '-'}
+
{this.props.value.object_id ? this.props.value.short_id : '-'}
{this.props.value.registration_number}
{actions.getChecked(this.props.value.stop_points).length} arrêt(s)
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 (
-
{this.props.value.objectid ? actions.humanOID(this.props.value.objectid) : '-'}
-
{actions.humanOID(this.props.value.journey_pattern.objectid)}
+
{this.props.value.objectid ? this.props.value.short_id : '-'}
+
{this.props.value.journey_pattern.short_id}
{time_tables.slice(0,3).map((tt, i)=> {this.timeTableURL(tt)} 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 {
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 {

Mettre à jour une course

{(this.props.modal.type == 'shift') && ( - Mettre à jour les horaires de la course {actions.humanOID(actions.getSelected(this.props.vehicleJourneys)[0].objectid)} + Mettre à jour les horaires de la course {actions.getSelected(this.props.vehicleJourneys)[0].short_id} )} ×
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: "" + item.published_name + " - " + actions.humanOID(item.object_id) + "
" + item.registration_number + "" } + { text: "" + item.published_name + " - " + item.short_id + "
" + item.registration_number + "" } ) ) }; 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: '' + " " + item.comment + ' - ' + actions.humanOID(item.objectid) + '
' + (item.day_types ? item.day_types.match(/[A-Z]?[a-z]+/g).join(', ') : "") + ''} + {text: '' + " " + item.comment + ' - ' + item.short_id + '
' + (item.day_types ? item.day_types.match(/[A-Z]?[a-z]+/g).join(', ') : "") + ''} ) ) }; 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 } ) ) }; -- cgit v1.2.3