aboutsummaryrefslogtreecommitdiffstats
path: root/app/assets/javascripts
diff options
context:
space:
mode:
authorVlatka Pavisic2017-04-11 15:35:01 +0200
committerVlatka Pavisic2017-04-11 15:35:01 +0200
commitaa481c087b162bc775b4418e205f91c5b6bead19 (patch)
tree914ba9b39e0338317bcc2bfd839f745647beda1a /app/assets/javascripts
parent8adf909694b52959483818bf839d6e180015eb99 (diff)
downloadchouette-core-aa481c087b162bc775b4418e205f91c5b6bead19.tar.bz2
Refs #3047: Associate RoutingConstraintZone with StopPoints
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/routing_constraint_zones.coffee18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/assets/javascripts/routing_constraint_zones.coffee b/app/assets/javascripts/routing_constraint_zones.coffee
new file mode 100644
index 000000000..57f94e654
--- /dev/null
+++ b/app/assets/javascripts/routing_constraint_zones.coffee
@@ -0,0 +1,18 @@
+fill_stop_points_options = ->
+ stop_point_select = $('#routing_constraint_zone_stop_point_ids')
+ stop_point_select.empty()
+ route_id = $('#routing_constraint_zone_route_id').val()
+ $.ajax
+ url: "/referentials/5/lines/162/routes/#{route_id}/stop_points"
+ dataType: 'json'
+ success: (data, textStatus, jqXHR) ->
+ for stop_point in data
+ stop_point_select.append "<option value='#{stop_point.id}'>#{stop_point.name}</option>"
+ error: (jqXHR, textStatus, errorThrown) ->
+ console.log textStatus
+ console.log errorThrown
+
+$ ->
+ if document.location.pathname.endsWith('new')
+ fill_stop_points_options()
+ $('#routing_constraint_zone_route_id').change(fill_stop_points_options)