aboutsummaryrefslogtreecommitdiffstats
path: root/app/javascript
diff options
context:
space:
mode:
authorZog2018-04-18 16:14:54 +0200
committercedricnjanga2018-04-19 23:12:34 -0700
commite6567cbfc987d8488492e2b1ce66a03db3a3d37d (patch)
treedbace69e87473783624c89e3351be153ba7f9bed /app/javascript
parent7c0ce4a2f39f6d7386734016452c594ee7ee8797 (diff)
downloadchouette-core-e6567cbfc987d8488492e2b1ce66a03db3a3d37d.tar.bz2
Refs #6193; Show journey length in VJs editor
If `journey_length_in_vehicle_journeys` feature is enabled
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/vehicle_journeys/actions/index.js12
-rw-r--r--app/javascript/vehicle_journeys/components/VehicleJourney.js9
-rw-r--r--app/javascript/vehicle_journeys/components/VehicleJourneys.js5
3 files changed, 17 insertions, 9 deletions
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 {
<div key={i}>{this.extraHeaderValue(header)}</div>
)
}
+ { this.hasFeature('journey_length_in_vehicle_journeys') &&
+ <div>
+ {this.journey_length()}
+ </div>
+ }
{ this.hasFeature('purchase_windows') &&
<div>
{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 {
<div key={i}>{this.extraHeaderLabel(header)}</div>
)
}
+ { this.hasFeature('journey_length_in_vehicle_journeys') &&
+ <div>
+ {I18n.attribute_name("vehicle_journey", "journey_length")}
+ </div>
+ }
{ this.hasFeature('purchase_windows') &&
<div>
{ detailed_purchase_windows &&