diff options
| author | Thomas Haddad | 2017-05-03 11:45:45 +0200 |
|---|---|---|
| committer | Thomas Haddad | 2017-05-03 11:46:21 +0200 |
| commit | 534bc4065c4b3a2ed0a10527f27bac4e7b5aa472 (patch) | |
| tree | bfcb7020fbef040ecef7202b9a5328989e2f501a | |
| parent | e4880ded62ee261a25a464073add6e202d62216c (diff) | |
| download | chouette-core-534bc4065c4b3a2ed0a10527f27bac4e7b5aa472.tar.bz2 | |
Refs #3096: Add/store comment when olmap is toggled
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
8 files changed, 16 insertions, 5 deletions
diff --git a/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js b/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js index dae62d3e1..64c6d3ac7 100644 --- a/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js +++ b/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js @@ -24,7 +24,8 @@ class BSelect3 extends React.Component{ short_name: e.params.data.short_name, city_name: e.params.data.city_name, area_type: e.params.data.area_type, - zip_code: e.params.data.zip_code + zip_code: e.params.data.zip_code, + comment: e.params.data.comment }) } diff --git a/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js b/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js index 0eca5f3ff..b9e106c1a 100644 --- a/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js +++ b/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js @@ -142,6 +142,10 @@ class OlMap extends Component{ <strong>Commune : </strong> {this.props.value.olMap.json.city_name} </p> + <p> + <strong>Commentaire : </strong> + {this.props.value.olMap.json.comment} + </p> {(this.props.value.stoparea_id != this.props.value.olMap.json.stoparea_id) &&( <div className='btn btn-outline-primary btn-sm' onClick= {() => {this.props.onUpdateViaOlMap(this.props.index, this.props.value.olMap.json)}} diff --git a/app/assets/javascripts/es6_browserified/itineraries/index.js b/app/assets/javascripts/es6_browserified/itineraries/index.js index 57c63a97b..12a44e376 100644 --- a/app/assets/javascripts/es6_browserified/itineraries/index.js +++ b/app/assets/javascripts/es6_browserified/itineraries/index.js @@ -38,6 +38,7 @@ const getInitialState = () => { for_alighting: v.for_alighting || "normal", longitude: v.longitude || 0, latitude: v.latitude || 0, + comment: v.comment, olMap: { isOpened: false, json: {} diff --git a/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js b/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js index 79b9648a6..a1be73cd9 100644 --- a/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js +++ b/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js @@ -75,6 +75,7 @@ const stopPoints = (state = [], action) => { short_name: action.text.short_name, area_type: action.text.area_type, city_name: action.text.city_name, + comment: action.text.comment, registration_number: action.text.registration_number } ) diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb index 4a9215653..a8c9a1f0c 100644 --- a/app/helpers/routes_helper.rb +++ b/app/helpers/routes_helper.rb @@ -21,7 +21,7 @@ module RoutesHelper def route_json_for_edit(route) route.stop_points.includes(:stop_area).order(:position).map do |stop_point| - stop_area_attributes = stop_point.stop_area.attributes.slice("name","city_name", "zip_code", "registration_number", "longitude", "latitude", "area_type") + stop_area_attributes = stop_point.stop_area.attributes.slice("name","city_name", "zip_code", "registration_number", "longitude", "latitude", "area_type", "comment") stop_area_attributes["short_name"] = truncate(stop_area_attributes["name"], :length => 30) || "" stop_point_attributes = stop_point.attributes.slice("for_boarding","for_alighting") stop_area_attributes.merge(stop_point_attributes).merge(stoppoint_id: stop_point.id, stoparea_id: stop_point.stop_area.id).merge(user_objectid: stop_point.stop_area.user_objectid) diff --git a/app/views/autocomplete_stop_areas/around.rabl b/app/views/autocomplete_stop_areas/around.rabl index da4e92552..bc8f06054 100644 --- a/app/views/autocomplete_stop_areas/around.rabl +++ b/app/views/autocomplete_stop_areas/around.rabl @@ -19,7 +19,8 @@ child @stop_areas, root: :features, object_root: false do user_objectid: s.user_objectid, zip_code: s.zip_code, latitude: s.latitude, - longitude: s.longitude + longitude: s.longitude, + comment: s.comment } end end diff --git a/app/views/autocomplete_stop_areas/index.rabl b/app/views/autocomplete_stop_areas/index.rabl index 5b7f71565..5a9f76a47 100644 --- a/app/views/autocomplete_stop_areas/index.rabl +++ b/app/views/autocomplete_stop_areas/index.rabl @@ -13,7 +13,8 @@ node do |stop_area| :user_objectid => stop_area.user_objectid, :longitude => stop_area.longitude, :latitude => stop_area.latitude, - :area_type => stop_area.area_type + :area_type => stop_area.area_type, + :comment => stop_area.comment } end diff --git a/spec/javascripts/itineraries/reducers/stop_points_spec.js b/spec/javascripts/itineraries/reducers/stop_points_spec.js index 6065fa4ed..93fe85d36 100644 --- a/spec/javascripts/itineraries/reducers/stop_points_spec.js +++ b/spec/javascripts/itineraries/reducers/stop_points_spec.js @@ -195,7 +195,8 @@ describe('stops reducer', () => { registration_number: '0', city_name: 'city', area_type: 'area', - short_name: 'new' + short_name: 'new', + comment: 'newcomment' } }) ).toEqual( @@ -216,6 +217,7 @@ describe('stops reducer', () => { city_name: 'city', area_type: 'area', short_name: 'new', + comment: 'newcomment', olMap: { isOpened: false, json: {} |
