diff options
Diffstat (limited to 'app/assets/javascripts')
| -rw-r--r-- | app/assets/javascripts/routing_constraint_zones.coffee | 18 |
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) |
