From aa481c087b162bc775b4418e205f91c5b6bead19 Mon Sep 17 00:00:00 2001 From: Vlatka Pavisic Date: Tue, 11 Apr 2017 15:35:01 +0200 Subject: Refs #3047: Associate RoutingConstraintZone with StopPoints --- app/assets/javascripts/routing_constraint_zones.coffee | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 app/assets/javascripts/routing_constraint_zones.coffee (limited to 'app/assets/javascripts') 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 "" + 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) -- cgit v1.2.3