From 34775f5157902a30d1bbbb18991a1872b59fde3b Mon Sep 17 00:00:00 2001
From: Luc Donnet
Date: Mon, 3 Jul 2017 15:13:08 +0200
Subject: Fix routing constraint zones edit and new Refs #3953
---
.../javascripts/routing_constraint_zones.coffee | 80 ++++------------------
1 file changed, 12 insertions(+), 68 deletions(-)
(limited to 'app/assets/javascripts')
diff --git a/app/assets/javascripts/routing_constraint_zones.coffee b/app/assets/javascripts/routing_constraint_zones.coffee
index 8721dfb38..2fd83fa28 100644
--- a/app/assets/javascripts/routing_constraint_zones.coffee
+++ b/app/assets/javascripts/routing_constraint_zones.coffee
@@ -1,73 +1,17 @@
-@ITL_stoppoints = ->
- routeID = $('#routing_constraint_zone_route_id').val()
-
- if (routeID)
- origin = window.location.origin
- path = window.location.pathname.split('/', 5).join('/')
- reqURL = origin + path + '/routes/' + routeID + '/stop_points.json'
+$ ->
+ update_stop_points = () ->
+ url = $('#routing_constraint_zone_route_id').attr("data-url")
+ route_id = $('#routing_constraint_zone_route_id').val()
$.ajax
- url: reqURL
- dataType: 'json'
+ url: url
+ dataType: 'script'
+ data: { route_id: route_id }
error: (jqXHR, textStatus, errorThrown) ->
- console.log(errorThrown)
- success: (collection, textStatus, jqXHR) ->
- html = ''
- stopAreaBaseURL = origin + window.location.pathname.split('/', 3).join('/') + '/stop_areas/'
-
- collection.forEach (item, index) ->
- html += "
-
-
" + item.city_name + " (" + item.zip_code + ")
-
-
-
-
-
-
-
"
-
- $('#ITL_stoppoints').find('.nested-fields').remove()
- $('#ITL_stoppoints').find('.nested-head').after(html)
-
- # VALIDATION
- selection = []
-
- totalItems = collection.length
-
- $('#ITL_stoppoints').on 'click', "input[type='checkbox']", (e) ->
- v = $(e.target).val()
+ console.log("ERROR")
+ success: (data, textStatus, jqXHR) ->
+ console.log("SUCCESS")
- if ( $.inArray(v, selection) != -1 )
- selection.splice(selection.indexOf(v), 1)
- else
- selection.push(v)
-
- alertMsg1 = "
-
Un ITL doit comporter au moins deux arrêts
-
"
- alertMsg2 = "
-
Un ITL ne peut recouvrir tous les arrêts d'un itinéraire
-
"
-
- $(document).on 'click', "input[type='submit']", (e)->
- inputName = $('#routing_constraint_zone_name').val()
-
- $('.alert-danger').remove()
-
- if ( selection.length < 2 && inputName != "" )
- e.preventDefault()
- $('#routing_constraint_zone_name').closest('.form-group').removeClass('has-error').find('.help-block').remove()
- $('#ITL_stoppoints').prepend(alertMsg1)
-
- if ( selection.length == totalItems && inputName != "" )
- e.preventDefault()
- $('#routing_constraint_zone_name').closest('.form-group').removeClass('has-error').find('.help-block').remove()
- $('#ITL_stoppoints').prepend(alertMsg2)
-
-$ ->
- ITL_stoppoints()
+ $("#itl_form #routing_constraint_zone_route_id").on 'change', -> update_stop_points()
- $('#routing_constraint_zone_route_id').on 'change', ->
- $('.alert-danger').remove()
- ITL_stoppoints()
+ update_stop_points()
--
cgit v1.2.3
From a78db962d1f25f569ff3e8294cd565137ede92d3 Mon Sep 17 00:00:00 2001
From: af83
Date: Thu, 6 Jul 2017 12:18:31 +0200
Subject: Change wording for clean up + add exclusive dates for between clean
up
---
app/assets/javascripts/cleanup.coffee | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
(limited to 'app/assets/javascripts')
diff --git a/app/assets/javascripts/cleanup.coffee b/app/assets/javascripts/cleanup.coffee
index 169a006a9..7f6594018 100644
--- a/app/assets/javascripts/cleanup.coffee
+++ b/app/assets/javascripts/cleanup.coffee
@@ -2,8 +2,13 @@ $(document).on("change", 'input[name="clean_up[date_type]"]', (e) ->
type = $(this).val()
end_date = $('.cleanup_end_date_wrapper')
- if type == 'between'
- end_date.removeClass('hidden').show()
- else
+ if type == 'before'
+ end_date.hide()
+ $("label[for='clean_up_begin_date_3i']").html("Date de fin de purge");
+ else if type == 'after'
end_date.hide()
+ $("label[for='clean_up_begin_date_3i']").html("Date de début de purge");
+ else
+ $("label[for='clean_up_begin_date_3i']").html("Date de début de purge");
+ end_date.show()
)
--
cgit v1.2.3