diff options
| author | Luc Donnet | 2017-07-27 09:23:17 +0200 |
|---|---|---|
| committer | Luc Donnet | 2017-07-27 09:23:17 +0200 |
| commit | a9ffff2c6884d01fb432666de64860894708e11d (patch) | |
| tree | 1c3d7e24563cf6006c1fdca2c2ed8f1584ce28f0 | |
| parent | 1a23188b58e9695a0df116c38f1c30d07b1e5501 (diff) | |
| download | chouette-core-a9ffff2c6884d01fb432666de64860894708e11d.tar.bz2 | |
Fix js call for routing_constraint_zone refs #4029 @1
| -rw-r--r-- | app/assets/javascripts/routing_constraint_zones.coffee | 33 | ||||
| -rw-r--r-- | app/views/routing_constraint_zones/new.html.slim | 2 |
2 files changed, 17 insertions, 18 deletions
diff --git a/app/assets/javascripts/routing_constraint_zones.coffee b/app/assets/javascripts/routing_constraint_zones.coffee index c01c9ca2f..8fdcb3b50 100644 --- a/app/assets/javascripts/routing_constraint_zones.coffee +++ b/app/assets/javascripts/routing_constraint_zones.coffee @@ -1,18 +1,17 @@ -$ -> - - update_stop_points = () -> - url = $('#routing_constraint_zone_route_id').attr("data-url") - routing_constraint_zone_json = $('#routing_constraint_zone_route_id').attr("data-object") - route_id = $('#routing_constraint_zone_route_id').val() - $.ajax - url: url - dataType: 'script' - data: { route_id: route_id, routing_constraint_zone_json: routing_constraint_zone_json } - error: (jqXHR, textStatus, errorThrown) -> - console.log("ERROR") - success: (data, textStatus, jqXHR) -> - console.log("SUCCESS") +update_stop_points = () -> + url = $('#routing_constraint_zone_route_id').attr("data-url") + routing_constraint_zone_json = $('#routing_constraint_zone_route_id').attr("data-object") + route_id = $('#routing_constraint_zone_route_id').val() + $.ajax + url: url + dataType: 'script' + data: { route_id: route_id, routing_constraint_zone_json: routing_constraint_zone_json } + error: (jqXHR, textStatus, errorThrown) -> + console.log("ERROR") + success: (data, textStatus, jqXHR) -> + console.log("SUCCESS") - $("#itl_form #routing_constraint_zone_route_id").on 'change', -> update_stop_points() - - update_stop_points() +$ -> + if $('#routing_constraint_zone_route_id').hasClass('new_routing_constraint_zone_route') + $("#routing_constraint_zone_route_id").on 'change', -> update_stop_points() + update_stop_points() diff --git a/app/views/routing_constraint_zones/new.html.slim b/app/views/routing_constraint_zones/new.html.slim index 4e792f8af..600663b18 100644 --- a/app/views/routing_constraint_zones/new.html.slim +++ b/app/views/routing_constraint_zones/new.html.slim @@ -12,7 +12,7 @@ .row .col-lg-12 = form.input :name - = form.input :route_id, collection: @line.routes, include_blank: false, input_html: {data: {url: new_referential_line_routing_constraint_zone_path(@referential, @line), object: @routing_constraint_zone.to_json }} + = form.input :route_id, collection: @line.routes, include_blank: false, input_html: { class: 'new_routing_constraint_zone_route', data: {url: new_referential_line_routing_constraint_zone_path(@referential, @line), object: @routing_constraint_zone.to_json }} .separator |
