From e6567cbfc987d8488492e2b1ce66a03db3a3d37d Mon Sep 17 00:00:00 2001 From: Zog Date: Wed, 18 Apr 2018 16:14:54 +0200 Subject: Refs #6193; Show journey length in VJs editor If `journey_length_in_vehicle_journeys` feature is enabled --- app/javascript/vehicle_journeys/actions/index.js | 12 +++--------- app/javascript/vehicle_journeys/components/VehicleJourney.js | 9 +++++++++ .../vehicle_journeys/components/VehicleJourneys.js | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/vehicle_journeys/actions/index.js b/app/javascript/vehicle_journeys/actions/index.js index d51012cdb..70d6e953a 100644 --- a/app/javascript/vehicle_journeys/actions/index.js +++ b/app/javascript/vehicle_journeys/actions/index.js @@ -48,16 +48,10 @@ const actions = { }), selectJPCreateModal : (selectedJP) => ({ type : 'SELECT_JP_CREATE_MODAL', - selectedItem: { - id: selectedJP.id, + selectedItem: _.assign({}, selectedJP, { objectid: selectedJP.object_id, - short_id: selectedJP.short_id, - name: selectedJP.name, - published_name: selectedJP.published_name, - stop_areas: selectedJP.stop_area_short_descriptions, - costs: selectedJP.costs, - full_schedule: selectedJP.full_schedule - } + stop_areas: selectedJP.stop_area_short_descriptions + }) }), openEditModal : (vehicleJourney) => ({ type : 'EDIT_VEHICLEJOURNEY_MODAL', diff --git a/app/javascript/vehicle_journeys/components/VehicleJourney.js b/app/javascript/vehicle_journeys/components/VehicleJourney.js index 73d99d120..5eb73de0e 100644 --- a/app/javascript/vehicle_journeys/components/VehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/VehicleJourney.js @@ -10,6 +10,10 @@ export default class VehicleJourney extends Component { this.previousCity = undefined } + journey_length() { + return this.props.value.journey_pattern.journey_length + "km" + } + cityNameChecker(sp) { return this.props.vehicleJourneys.showHeader(sp.stop_point_objectid) } @@ -115,6 +119,11 @@ export default class VehicleJourney extends Component {
{this.extraHeaderValue(header)}
) } + { this.hasFeature('journey_length_in_vehicle_journeys') && +
+ {this.journey_length()} +
+ } { this.hasFeature('purchase_windows') &&
{purchase_windows.slice(0,3).map((tt, i)=> diff --git a/app/javascript/vehicle_journeys/components/VehicleJourneys.js b/app/javascript/vehicle_journeys/components/VehicleJourneys.js index e4f5ad11c..27e147b37 100644 --- a/app/javascript/vehicle_journeys/components/VehicleJourneys.js +++ b/app/javascript/vehicle_journeys/components/VehicleJourneys.js @@ -224,6 +224,11 @@ export default class VehicleJourneys extends Component {
{this.extraHeaderLabel(header)}
) } + { this.hasFeature('journey_length_in_vehicle_journeys') && +
+ {I18n.attribute_name("vehicle_journey", "journey_length")} +
+ } { this.hasFeature('purchase_windows') &&
{ detailed_purchase_windows && -- cgit v1.2.3