aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haddad2017-03-20 12:28:14 +0100
committerThomas Haddad2017-03-20 12:28:51 +0100
commit531f4eb80fca4cd1902f34c79222dab7de5554c9 (patch)
tree674a31ff5856a4c6a0cc2f283947098f7b160585
parentfa522151f9506de1adad4cc023b5477a7550a263 (diff)
downloadchouette-core-531f4eb80fca4cd1902f34c79222dab7de5554c9.tar.bz2
Refs #2876: Add data in sidebar when olmap is toggled
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
-rw-r--r--app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js6
-rw-r--r--app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js24
-rw-r--r--app/assets/javascripts/es6_browserified/itineraries/index.js2
-rw-r--r--app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js3
-rw-r--r--app/helpers/routes_helper.rb4
-rw-r--r--app/views/autocomplete_stop_areas/around.rabl3
-rw-r--r--app/views/autocomplete_stop_areas/index.rabl3
-rw-r--r--spec/javascripts/itineraries/reducers/stop_points_spec.js8
8 files changed, 46 insertions, 7 deletions
diff --git a/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js b/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js
index cad7a9130..67310c6b6 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js
+++ b/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js
@@ -19,7 +19,11 @@ class BSelect3 extends React.Component{
user_objectid: e.params.data.user_objectid,
longitude: e.params.data.longitude,
latitude: e.params.data.latitude,
- name: e.params.data.name
+ name: e.params.data.name,
+ 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
})
}
diff --git a/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js b/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js
index 91944a923..c880631f6 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js
+++ b/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js
@@ -116,14 +116,32 @@ class OlMap extends Component{
{this.props.value.olMap.json.name}
</p>
<p>
- <strong>N° d'enregistrement : </strong>
- {this.props.value.olMap.json.registration_number}
+ <strong>Type d'arrêt : </strong>
+ {this.props.value.olMap.json.area_type}
</p>
<p>
- <strong>ID Reflex : </strong>
+ <strong>Nom court : </strong>
+ {this.props.value.olMap.json.short_name}
+ </p>
+ <p>
+ <strong>Code Reflex : </strong>
{this.props.value.olMap.json.user_objectid}
</p>
+ <p>
+ <strong>Coordonnées : </strong>
+ WSG84
+ {this.props.value.olMap.json.latitude}
+ {this.props.value.olMap.json.longitude}
+ </p>
+ <p>
+ <strong>Code Postal : </strong>
+ {this.props.value.olMap.json.zip_code}
+ </p>
+ <p>
+ <strong>Commune : </strong>
+ {this.props.value.olMap.json.city_name}
+ </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 05b171230..e4a28ab49 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/index.js
+++ b/app/assets/javascripts/es6_browserified/itineraries/index.js
@@ -25,6 +25,8 @@ const getInitialState = () => {
stoppoint_id: v.stoppoint_id,
stoparea_id: v.stoparea_id,
user_objectid: v.user_objectid,
+ short_name: v.short_name,
+ area_type: v.area_type,
index: i,
edit: false,
city_name: v.city_name,
diff --git a/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js b/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js
index abbf7a0b7..6fc5c165f 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js
+++ b/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js
@@ -71,6 +71,9 @@ const stopPoints = (state = [], action) => {
latitude: action.text.latitude,
longitude: action.text.longitude,
name: action.text.name,
+ short_name: action.text.short_name,
+ area_type: action.text.area_type,
+ city_name: action.text.city_name,
registration_number: action.text.registration_number
}
)
diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb
index 40c1278f7..38d2a232f 100644
--- a/app/helpers/routes_helper.rb
+++ b/app/helpers/routes_helper.rb
@@ -15,7 +15,9 @@ module RoutesHelper
def route_json_for_edit(route)
route.stop_points.includes(:stop_area).map do |stop_point|
- stop_area_attributes = stop_point.stop_area.attributes.slice("name","city_name", "zip_code", "registration_number", "longitude", "latitude")
+ stop_area_attributes = stop_point.stop_area.attributes.slice("name","city_name", "zip_code", "registration_number", "longitude", "latitude", "area_type")
+ stop_area_attributes["short_name"] = truncate(stop_area_attributes["name"], :length => 30) || ""
+ Rails.logger.debug(stop_area_attributes)
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)
end.to_json
diff --git a/app/views/autocomplete_stop_areas/around.rabl b/app/views/autocomplete_stop_areas/around.rabl
index a6f7ed1ed..da4e92552 100644
--- a/app/views/autocomplete_stop_areas/around.rabl
+++ b/app/views/autocomplete_stop_areas/around.rabl
@@ -10,11 +10,14 @@ child @stop_areas, root: :features, object_root: false do
node :properties do |s|
{
name: s.name,
+ short_name: truncate(s.name, :length => 30) || "",
+ city_name: s.city_name,
area_type: s.area_type,
registration_number: s.registration_number,
stoparea_id: s.id,
text: "#{s.name}, #{s.zip_code} #{s.city_name}",
user_objectid: s.user_objectid,
+ zip_code: s.zip_code,
latitude: s.latitude,
longitude: s.longitude
}
diff --git a/app/views/autocomplete_stop_areas/index.rabl b/app/views/autocomplete_stop_areas/index.rabl
index 5b58b04c7..5b7f71565 100644
--- a/app/views/autocomplete_stop_areas/index.rabl
+++ b/app/views/autocomplete_stop_areas/index.rabl
@@ -12,7 +12,8 @@ node do |stop_area|
:short_city_name => truncate(stop_area.city_name, :length => 15) || "",
:user_objectid => stop_area.user_objectid,
:longitude => stop_area.longitude,
- :latitude => stop_area.latitude
+ :latitude => stop_area.latitude,
+ :area_type => stop_area.area_type
}
end
diff --git a/spec/javascripts/itineraries/reducers/stop_points_spec.js b/spec/javascripts/itineraries/reducers/stop_points_spec.js
index adbf77aa1..6065fa4ed 100644
--- a/spec/javascripts/itineraries/reducers/stop_points_spec.js
+++ b/spec/javascripts/itineraries/reducers/stop_points_spec.js
@@ -192,7 +192,10 @@ describe('stops reducer', () => {
user_objectid: "1234",
longitude: 123,
latitude: 123,
- registration_number: '0'
+ registration_number: '0',
+ city_name: 'city',
+ area_type: 'area',
+ short_name: 'new'
}
})
).toEqual(
@@ -210,6 +213,9 @@ describe('stops reducer', () => {
longitude: 123,
latitude: 123,
registration_number: '0',
+ city_name: 'city',
+ area_type: 'area',
+ short_name: 'new',
olMap: {
isOpened: false,
json: {}