aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXinhui2016-12-07 17:21:38 +0100
committerXinhui2016-12-07 17:21:38 +0100
commit2011d02e79659c17eebcd5f38e75a1afa34352ee (patch)
tree4c156fa8f18b190ae201e106220b1e97906468a9
parentc18839ee89fdc4e82be9bc25b148117a96ecc3c7 (diff)
downloadchouette-core-2011d02e79659c17eebcd5f38e75a1afa34352ee.tar.bz2
Rabl journey_pattern stop_points
-rw-r--r--app/views/api/v1/routes/short_description.rabl7
-rw-r--r--app/views/api/v1/stop_areas/short_description.rabl4
-rw-r--r--app/views/journey_patterns/show.rabl7
3 files changed, 12 insertions, 6 deletions
diff --git a/app/views/api/v1/routes/short_description.rabl b/app/views/api/v1/routes/short_description.rabl
index ae149167d..900096ac5 100644
--- a/app/views/api/v1/routes/short_description.rabl
+++ b/app/views/api/v1/routes/short_description.rabl
@@ -5,3 +5,10 @@ extends "api/v1/trident_objects/short_description"
attributes attr, :unless => lambda { |m| m.send( attr).nil?}
end
+child :stop_points => :stop_points do |stop_points|
+ node do |stop_point|
+ partial("api/v1/stop_areas/short_description", :object => stop_point.stop_area).merge(position: stop_point.position)
+ end
+end
+
+
diff --git a/app/views/api/v1/stop_areas/short_description.rabl b/app/views/api/v1/stop_areas/short_description.rabl
index 73627c5a1..7b6a72491 100644
--- a/app/views/api/v1/stop_areas/short_description.rabl
+++ b/app/views/api/v1/stop_areas/short_description.rabl
@@ -1,10 +1,10 @@
object @stop_area
-extends "api/v1/trident_objects/short_description"
+extends "api/v1/trident_objects/short_description"
[ :name, :area_type, :longitude, :latitude, :long_lat_type].each do |attr|
attributes attr, :unless => lambda { |m| m.send( attr).nil?}
end
node(:parent_object_id) do |stop_area|
- stop_area.parent.objectid
+ stop_area.parent.objectid
end unless root_object.parent.nil?
diff --git a/app/views/journey_patterns/show.rabl b/app/views/journey_patterns/show.rabl
index 882660360..b1eaf2376 100644
--- a/app/views/journey_patterns/show.rabl
+++ b/app/views/journey_patterns/show.rabl
@@ -15,7 +15,6 @@ end unless root_object.vehicle_journeys.empty?
child :stop_points => :stop_area_short_descriptions do |stop_points|
node do |stop_point|
- partial("api/v1/stop_areas/short_description", :object => stop_point.stop_area)
- end
-end unless root_object.stop_points.empty?
-
+ partial("api/v1/stop_areas/short_description", :object => stop_point.stop_area)
+ end
+end unless root_object.stop_points.empty?