aboutsummaryrefslogtreecommitdiffstats
path: root/app/assets/javascripts
diff options
context:
space:
mode:
authorjpl2017-03-16 16:42:38 +0100
committerjpl2017-03-16 16:42:46 +0100
commitc6bfb5a83f040695760fd29330bc2953f2b695be (patch)
tree47d93655c4b2b5969aa008aaeee6ce932e9ac73a /app/assets/javascripts
parent699c5d97f767c052fc78f7f8c694fa3d4721c580 (diff)
downloadchouette-core-c6bfb5a83f040695760fd29330bc2953f2b695be.tar.bz2
Massive JS gardening, removing old & unused
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/access_points.coffee32
-rw-r--r--app/assets/javascripts/application.js4
-rw-r--r--app/assets/javascripts/group_of_line.coffee7
-rw-r--r--app/assets/javascripts/import_tasks.coffee37
-rw-r--r--app/assets/javascripts/journey_pattern.coffee14
-rw-r--r--app/assets/javascripts/multiple_selection.coffee56
-rw-r--r--app/assets/javascripts/partials/ie_report.js.coffee.erb22
-rw-r--r--app/assets/javascripts/route.coffee14
-rw-r--r--app/assets/javascripts/route_section.js.coffee93
-rw-r--r--app/assets/javascripts/rule_parameter_set.coffee10
-rw-r--r--app/assets/javascripts/stop_areas/edit.coffee31
-rw-r--r--app/assets/javascripts/stop_areas/index.coffee25
-rw-r--r--app/assets/javascripts/time_tables.coffee32
-rw-r--r--app/assets/javascripts/tools.coffee32
-rw-r--r--app/assets/javascripts/vehicle_journey.coffee75
-rw-r--r--app/assets/javascripts/vehicle_journeys/index.coffee6
-rw-r--r--app/assets/javascripts/vehicle_journeys/show.coffee8
17 files changed, 0 insertions, 498 deletions
diff --git a/app/assets/javascripts/access_points.coffee b/app/assets/javascripts/access_points.coffee
deleted file mode 100644
index 56ae24d1e..000000000
--- a/app/assets/javascripts/access_points.coffee
+++ /dev/null
@@ -1,32 +0,0 @@
-jQuery ->
- x_y_change = (event) ->
- c = $('input#access_point_coordinates').val().split(",")
- if c.length == 2
- if referential_projection != undefined
- referential_point = new OpenLayers.Geometry.Point(c[1], c[0]).transform(new OpenLayers.Projection("EPSG:4326"), referential_projection )
-
- $('input#access_point_projection_xy').val(referential_point.x.toString()+","+referential_point.y.toString())
-
- feature = map.getLayersByName("access_point")[0].getFeatureByFid($('input#access_point_id').val())
- google_point = new OpenLayers.LonLat(c[1], c[0]).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
- feature.move(google_point)
- map.setCenter(google_point, 16, false, true)
-
- $('input#access_point_coordinates').change(x_y_change)
-
- lon_lat_change = (event) ->
- c = $('input#access_point_projection_xy').val().split(",")
- if c.length == 2
- if referential_projection != undefined
- wgs84_point = new OpenLayers.Geometry.Point(c[0], c[1]).transform(referential_projection, new OpenLayers.Projection("EPSG:4326"))
-
- $('input#access_point_coordinates').val( wgs84_point.y.toString()+","+wgs84_point.x)
-
- feature = map.getLayersByName("access_point")[0].getFeatureByFid($('input#access_point_id').val())
- google_point = new OpenLayers.LonLat(wgs84_point.x, wgs84_point.y).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
- feature.move(google_point)
- map.setCenter(google_point, 16, false, true)
-
- $('input#access_point_projection_xy').change(lon_lat_change)
-
-
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index eeca98190..d1f1b0c25 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -24,15 +24,11 @@
//= require footable/footable.filter
//= require footable/footable.paginate
//= require footable/footable.sort
-//= require tools
//= require_directory ./plugins
//= require_directory .
-//= require_directory ./stop_areas
-//= require_directory ./vehicle_journeys
//= require_directory ./vehicle_journey_frequencies
//= require_directory ./import_tasks
//= require_directory ./compliance_check_tasks
//= require_directory ./export_tasks
//= require_directory ./exports
//= require_directory ./lines
-//= require_directory ./partials
diff --git a/app/assets/javascripts/group_of_line.coffee b/app/assets/javascripts/group_of_line.coffee
deleted file mode 100644
index 737f343ba..000000000
--- a/app/assets/javascripts/group_of_line.coffee
+++ /dev/null
@@ -1,7 +0,0 @@
-jQuery ->
-
- make_ajax_pagination = () ->
- $.get(this.href, null, null, 'script')
- false
-
- $(document).on("click", '.group_of_lines.show .lines_detail .pagination a', make_ajax_pagination)
diff --git a/app/assets/javascripts/import_tasks.coffee b/app/assets/javascripts/import_tasks.coffee
deleted file mode 100644
index 864288848..000000000
--- a/app/assets/javascripts/import_tasks.coffee
+++ /dev/null
@@ -1,37 +0,0 @@
-jQuery ->
-
- import_format_change = (event) ->
- import_task_type = $("input:radio:checked").attr("value")
- $(form).toggle($(form).is("#" + import_task_type + "_new")) for form in $('form.import_task[method = "post"]')
-
- $("#import_task_format_input :radio[name='import_task[format]']").change(import_format_change)
-
- import_check_change = (event) ->
- import_task_type = $("input:radio:checked").attr("value")
- format_class = '#' + import_task_type + "_new"
- state = $(format_class + ' input[name="import_task[no_save]"]:checked') == "1"
- $(format_class + " #import_task_rule_parameter_set_id_input").toggle( )
-
- $(check_input).change(import_check_change) for check_input in $('form input[name="import_task[no_save]"][type="checkbox"]')
-
- $('[id$="_import_task_name"]').focusout ->
- $this = $(this)
- value = $this.val()
- $('[id$="_import_task_name"]').each ->
- if $(this) != $this
- $(this).val value
- return
- return
-
- $('[id$="_import_task_no_save"]').click ->
- $('[id$="_import_task_no_save"]').prop 'checked', $(this).is(':checked')
- return
-
- $('[id$="_import_task_rule_parameter_set_id"]').focusout ->
- $this = $(this)
- value = $this.val()
- $('[id$="_import_task_rule_parameter_set_id"]').each ->
- if $(this) != $this
- $(this).val value
- return
- return
diff --git a/app/assets/javascripts/journey_pattern.coffee b/app/assets/javascripts/journey_pattern.coffee
deleted file mode 100644
index 0f203397b..000000000
--- a/app/assets/javascripts/journey_pattern.coffee
+++ /dev/null
@@ -1,14 +0,0 @@
-jQuery ->
- select_stop_on_map = (event) ->
- if (event.type == 'mouseenter')
- if event.target.id.match(/^stop_point_(\w+)$/)
- stopAreaId = $("#"+event.target.id+" a").attr('href').match(/\d+$/)[0]
- console.log(stopAreaId)
- placeMark = selectFeature.layer.getFeatureByFid( stopAreaId)
- selectFeature.unselectAll()
- selectFeature.select( placeMark)
- else
- selectFeature.unselectAll()
-
- $(document).on("hover", '.journey_patterns.show div.stop_points .stop_point', select_stop_on_map)
-
diff --git a/app/assets/javascripts/multiple_selection.coffee b/app/assets/javascripts/multiple_selection.coffee
deleted file mode 100644
index fc81fd5d0..000000000
--- a/app/assets/javascripts/multiple_selection.coffee
+++ /dev/null
@@ -1,56 +0,0 @@
-jQuery ->
- enable_multiple_selection = (event) ->
- event.preventDefault()
- $('#multiple_selection_menu div.enabled').show()
- $('#multiple_selection_menu div.disabled').hide()
- $('input[type=checkbox].multiple_selection').show()
- $('.line_number').hide()
-
- $('#multiple_selection_menu a.enable').click(enable_multiple_selection)
-
- disable_multiple_selection = (event) ->
- event.preventDefault()
- $('#multiple_selection_menu div.enabled').hide()
- $('#multiple_selection_menu div.disabled').show()
- $('input[type=checkbox].multiple_selection').hide()
- $('.line_number').show()
-
- $('#multiple_selection_menu a.disable').click(disable_multiple_selection)
-
- select_all = (event) ->
- event.preventDefault()
- $('input[type=checkbox].multiple_selection').prop("checked", true)
-
- $('#multiple_selection_menu a.select_all').click(select_all)
-
- deselect_all = (event) ->
- event.preventDefault()
- $('input[type=checkbox].multiple_selection').prop("checked", false)
-
- $('#multiple_selection_menu a.deselect_all').click(deselect_all)
-
- handle_multiple_action = (event) ->
- event.preventDefault()
- link = $(event.target)
- r = confirm( link.attr( "confirmation-text" ) );
- if (r == true)
- href = link.attr("href")
- method = link.data('multiple-method')
- csrf_token = $('meta[name=csrf-token]').attr('content')
- csrf_param = $('meta[name=csrf-param]').attr('content')
- form = $('<form method="post" action="' + href + '"></form>')
- target = link.attr('target')
-
- metadata_input = '<input name="_method" value="' + method + '" type="hidden" />'
-
- if csrf_param? and csrf_token?
- metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />'
-
- form.append($(input).clone()) for input in $('input[type=checkbox].multiple_selection:checked')
-
- form.attr('target', target) if target?
-
- form.hide().append(metadata_input).appendTo('body')
- form.submit()
-
- $('#multiple_selection_menu .actions a.remove').click(handle_multiple_action)
diff --git a/app/assets/javascripts/partials/ie_report.js.coffee.erb b/app/assets/javascripts/partials/ie_report.js.coffee.erb
deleted file mode 100644
index 5d42566ea..000000000
--- a/app/assets/javascripts/partials/ie_report.js.coffee.erb
+++ /dev/null
@@ -1,22 +0,0 @@
-$(".imports.show, .exports.show, .compliance_checks.show").ready ->
-
- refreshInterval = $(".report").data("refresh-interval")
- if refreshInterval > 0
- reloadPage = () -> window.location.reload()
- setInterval(reloadPage,refreshInterval * 1000)
-
- footableFilter = (parent, el) ->
- no_pagination = $(parent).data('no-pagination') != true
- $(parent).footable( { paginate: no_pagination } ).bind 'footable_filtering', (e) ->
- selected = $("select#{el} option:selected").val()
- if selected and selected.length > 0
- e.filter += if e.filter and e.filter.length > 0 then ' ' + selected else selected
- e.clear = !e.filter
- return
- $("select#{el}").change (e) ->
- e.preventDefault()
- $(parent).trigger 'footable_filter', filter: $("select#{el} option:selected").val()
- return
-
- footableFilter('#table-file', '.filter-file-status')
- footableFilter('#table-line', '.filter-line-status')
diff --git a/app/assets/javascripts/route.coffee b/app/assets/javascripts/route.coffee
deleted file mode 100644
index ea2984d02..000000000
--- a/app/assets/javascripts/route.coffee
+++ /dev/null
@@ -1,14 +0,0 @@
-jQuery ->
- select_stop_on_map = (event) ->
- if (event.type == 'mouseenter')
- if event.target.id.match(/^stop_point_(\w+)$/)
- console.log(event.target.id)
- stopAreaId = $("#"+event.target.id+" a").attr('href').match(/\d+$/)[0]
- console.log(stopAreaId)
- placeMark = selectFeature.layer.getFeatureByFid( stopAreaId)
- selectFeature.unselectAll()
- selectFeature.select( placeMark)
- else
- selectFeature.unselectAll()
-
- $(document).on("hover", '.routes.show div.stop_points .stop_point', select_stop_on_map)
diff --git a/app/assets/javascripts/route_section.js.coffee b/app/assets/javascripts/route_section.js.coffee
deleted file mode 100644
index 5c721cdfb..000000000
--- a/app/assets/javascripts/route_section.js.coffee
+++ /dev/null
@@ -1,93 +0,0 @@
-class @RouteSectionMap
- @onSelectedFeature: (feature) ->
- route_section_id = feature.data.id
-
- routeSectionOption = $("option[value=#{route_section_id}]")
- routeSectionOption.parent().val route_section_id
- RouteSectionMap.changeStyle(routeSectionOption.parent())
-
- $('#map-selection').show()
- $('#empty-map-selection').hide()
-
- selectionUrl = location.pathname.replace /edit$/, "selection"
- $.ajax(url: selectionUrl, method: 'POST', data: { route_section_id: route_section_id }, dataType: 'html').done (data) ->
- $('#map-selection div').replaceWith(data)
-
- @onUnselectedFeature: (feature) ->
- $('#map-selection').hide()
- $('#empty-map-selection').show()
-
- @editRoute = (el) ->
- new_route_section_id = $(el).val()
- edit_link = $(el).closest("tr").find("a.edit-route-section")
-
- # Save edit link to play with it
- unless edit_link.data("href-pattern")?
- edit_link.data "href-pattern", edit_link.attr('href').replace(new RegExp("/route_sections/([0-9]+)/edit"), "/route_sections/:id/edit")
-
- if !!new_route_section_id
- edit_link.removeClass "disabled"
- edit_link.attr 'href', edit_link.data("href-pattern").replace(/:id/, new_route_section_id)
- else
- edit_link.addClass "disabled"
- edit_link.attr 'href', '#'
-
- @featureStyle = (id, erase) ->
- if id
- features = route_section_geometry.getFeaturesByAttribute('id', id.toString())
- if features.length > 0
- $.each features, (key, feature) ->
- style = null
- if !erase
- style =
- strokeWidth: 3
- strokeColor: 'green'
- feature.style = style
- feature.layer.redraw()
-
- @changeStyle = (el) ->
- id = $(el).val()
- options = $(el).find('option').map(->
- $(this).val()
- )
- $.each options, (key, value) ->
- RouteSectionMap.featureStyle value, true
- return
- RouteSectionMap.featureStyle id, false
- RouteSectionMap.editRoute el
-
-jQuery ->
- $route_sections_selector = $('[name^="route_sections_selector[sections_attributes]"]')
- $.each $route_sections_selector, (index, el) ->
- RouteSectionMap.changeStyle el
-
- if $("#map.route_section").length > 0 and user_geometry?
- projWGS84 = new OpenLayers.Projection("EPSG:4326")
- proj900913 = new OpenLayers.Projection("EPSG:900913")
- wtk_format = new OpenLayers.Format.WKT()
-
- user_geometry.events.on({
- featureclick: (event) ->
- $('circle[stroke-opacity="0.3"]').attr('stroke-opacity', '0.6').attr('fill-opacity', '0.6')
- afterfeaturemodified: (event) ->
- efg = event.feature.geometry
- wgs84_geometry = efg.transform(proj900913, projWGS84)
- wgs84_feature = new OpenLayers.Feature.Vector(wgs84_geometry)
- ewtk = "SRID=4326;#{wtk_format.write(wgs84_feature)}"
-
- $('#route_section_editable_geometry').val(ewtk)
- efg.transform(projWGS84, proj900913)
- return
- })
-
- $('#new_route_sections_selector select').on 'change', ->
- RouteSectionMap.changeStyle this
-
- $('form.route_section').find('button[type="submit"]').on 'click', (e) ->
- e.preventDefault();
- if typeof modify_feature != 'undefined'
- modify_feature.deactivate()
- $('form.route_section').submit()
- return
-
- return
diff --git a/app/assets/javascripts/rule_parameter_set.coffee b/app/assets/javascripts/rule_parameter_set.coffee
deleted file mode 100644
index bb1e2226b..000000000
--- a/app/assets/javascripts/rule_parameter_set.coffee
+++ /dev/null
@@ -1,10 +0,0 @@
-jQuery ->
- mode_change = (event) ->
- $(".mode_specific.selected").toggle()
- $(".mode_specific.selected").toggleClass( "selected" )
- mode_selected = $("option:selected").attr("value")
- $(".mode_specific."+mode_selected).toggle()
- $(".mode_specific."+mode_selected).toggleClass( "selected" )
-
- $("#mode").change(mode_change)
-
diff --git a/app/assets/javascripts/stop_areas/edit.coffee b/app/assets/javascripts/stop_areas/edit.coffee
deleted file mode 100644
index d1d945ebf..000000000
--- a/app/assets/javascripts/stop_areas/edit.coffee
+++ /dev/null
@@ -1,31 +0,0 @@
-$(".stop_areas.edit").ready ->
-
- x_y_change = (event) ->
- c = $('input#stop_area_coordinates').val().split(",")
- if c.length == 2
- if referential_projection != undefined
- referential_point = new OpenLayers.Geometry.Point(c[1], c[0]).transform(new OpenLayers.Projection("EPSG:4326"), referential_projection )
-
- $('input#stop_area_projection_xy').val(referential_point.x.toString()+","+referential_point.y.toString())
-
- feature = map.getLayersByName("stop_area")[0].getFeatureByFid($('input#stop_area_id').val())
- google_point = new OpenLayers.LonLat(c[1], c[0]).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
- feature.move(google_point)
- map.setCenter(google_point, 16, false, true)
-
- $('input#stop_area_coordinates').change(x_y_change)
-
- lon_lat_change = (event) ->
- c = $('input#stop_area_projection_xy').val().split(",")
- if c.length == 2
- if referential_projection != undefined
- wgs84_point = new OpenLayers.Geometry.Point(c[0], c[1]).transform(referential_projection, new OpenLayers.Projection("EPSG:4326"))
-
- $('input#stop_area_coordinates').val( wgs84_point.y.toString()+","+wgs84_point.x)
-
- feature = map.getLayersByName("stop_area")[0].getFeatureByFid($('input#stop_area_id').val())
- google_point = new OpenLayers.LonLat(wgs84_point.x, wgs84_point.y).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
- feature.move(google_point)
- map.setCenter(google_point, 16, false, true)
-
- $('input#stop_area_projection_xy').change(lon_lat_change)
diff --git a/app/assets/javascripts/stop_areas/index.coffee b/app/assets/javascripts/stop_areas/index.coffee
deleted file mode 100644
index dff016666..000000000
--- a/app/assets/javascripts/stop_areas/index.coffee
+++ /dev/null
@@ -1,25 +0,0 @@
-$(".stop_areas.index").ready ->
- # Autocomplete input to choose postal code in stop_areas index
- # constructs the suggestion engine
- country_codes = new Bloodhound(
- datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value')
- queryTokenizer: Bloodhound.tokenizers.whitespace
- local: $.map( JSON.parse($('#country_codes').text() ), (country_code) ->
- value: country_code
- )
- )
-
- country_codes.initialize()
- # kicks off the loading/processing of `local` and `prefetch`
- $('#search .typeahead').typeahead(
- {
- hint: true,
- highlight: true,
- minLength: 1
- },
- {
- name: 'country_codes',
- displayKey: 'value',
- source: country_codes.ttAdapter(),
- }
- ) \ No newline at end of file
diff --git a/app/assets/javascripts/time_tables.coffee b/app/assets/javascripts/time_tables.coffee
deleted file mode 100644
index ccc4fe0fe..000000000
--- a/app/assets/javascripts/time_tables.coffee
+++ /dev/null
@@ -1,32 +0,0 @@
-jQuery ->
-
-# add trigger when creating new date or period entries to activate datepicker
- tt_datepickerI18n = (index, element) ->
- # do nothing if a datepicker is already attached
- return if ($(element).hasClass('hasDatepicker') )
- # check if html already manage date input
- i = document.createElement('input')
- i.setAttribute('type', 'date')
- return if i.type != 'text'
- # affect datepicker on date input
- $(element).datepicker({
- dateFormat: "dd/mm/y",
- dayNamesShort: $.datepicker.regional[ $('html').attr('lang') ].dayNamesShort,
- dayNames: $.datepicker.regional[ $('html').attr('lang') ].dayNames,
- monthNamesShort: $.datepicker.regional[ $('html').attr('lang') ].monthNamesShort,
- monthNames: $.datepicker.regional[ $('html').attr('lang') ].monthNames
- })
- $(element).datepicker("setDate", $.datepicker.parseDate('dd/mm/y', $(element).val() ) ) if ($(element).val().indexOf('/') >= 0)
- $(element).datepicker("setDate", $.datepicker.parseDate('yy-mm-dd', $(element).val() ) ) if ($(element).val().indexOf('/') < 0)
-
- after_inserts = ->
- $('input[type="date"]').each(tt_datepickerI18n)
-
- bind_after_inserts = ->
- $('#periods_content').bind('insertion-callback',after_inserts)
- $('#dates_content').bind('insertion-callback',after_inserts)
- #after_inserts()
-
- $(document).on('cocoon:after-insert',after_inserts)
-
- $(document).ready(bind_after_inserts) if $('.time_tables').length > 0
diff --git a/app/assets/javascripts/tools.coffee b/app/assets/javascripts/tools.coffee
deleted file mode 100644
index 04b61cde6..000000000
--- a/app/assets/javascripts/tools.coffee
+++ /dev/null
@@ -1,32 +0,0 @@
-(($) ->
- $ ->
- $('.ce-hide').removeClass 'ce-hide'
- sidebar = $('#sidebar').text().trim().length > 0
- if (sidebar)
- $('#map').before('<button id="ce-SidebarNavBlock" class="hide"><i class="fa fa-bars"></i></button>')
- $('[data-ce-action]').click (e) ->
- e.preventDefault()
- action = $(this).data('ce-action')
- id = $(this).data('ce-id')
- $map = $('#'+id)
- if (action == 'map-fullscreen')
- if $map.hasClass('ce-MapBlock-fullWidth')
- $map.removeClass('ce-MapBlock-fullWidth')
- $map.css('height', '')
- else
- offset_top = $map.offset().top + 2
- height = $(window).height() - offset_top
- $map.addClass('ce-MapBlock-fullWidth')
- $map.css('height', height)
- if sidebar
- $('#sidebar').toggleClass('hide')
- $('#sidebar').toggleClass('ce-SidebarFloatBlock')
- $('#ce-SidebarNavBlock').toggleClass('hide')
- $map.closest('.col-md-9, .col-md-12').toggleClass('col-md-9 col-md-12')
- $map.find('i').toggleClass('fa-expand fa-compress')
- map.updateSize()
- if sidebar
- $('#ce-SidebarNavBlock').click (e) ->
- e.preventDefault()
- $('.ce-SidebarFloatBlock').toggleClass('hide')
-) jQuery
diff --git a/app/assets/javascripts/vehicle_journey.coffee b/app/assets/javascripts/vehicle_journey.coffee
deleted file mode 100644
index d87df7cd4..000000000
--- a/app/assets/javascripts/vehicle_journey.coffee
+++ /dev/null
@@ -1,75 +0,0 @@
-jQuery ->
- swap_hour_minute = ( from, to) ->
- rows = $('tbody.journey_pattern_dependent_list tr.time')
- for row in rows
- do (row) ->
- $(row).find( to).find('.hour')[0].value = $(row).find( from).find('.hour')[0].value
- $(row).find( to).find('.minute')[0].value = $(row).find( from).find('.minute')[0].value
-
- copy_departures_to_arrivals = (event) ->
- event.preventDefault()
- swap_hour_minute('.departure_time', '.arrival_time')
-
- $(document).on('click', '[data-ce-action="to_arrivals"]', copy_departures_to_arrivals)
-
- copy_arrivals_to_departures = (event) ->
- event.preventDefault()
- swap_hour_minute('.arrival_time', '.departure_time')
-
- $(document).on('click', '[data-ce-action="to_departures"]', copy_arrivals_to_departures)
-
- switch_vehicle_journey_at_stops = (event) ->
- event.preventDefault()
- $('.vehicle_journeys.show .vehicle_journey_at_stops.content').toggle('slow')
- $('a.vehicle_journey_at_stops .switcher').toggle()
-
- $('.vehicle_journeys.show a.vehicle_journey_at_stops').click(switch_vehicle_journey_at_stops)
-
- switch_time_tables = (event) ->
- event.preventDefault()
- $('.vehicle_journeys.show .vehicle_journey_time_tables.content').toggle('slow')
- $('a.vehicle_journey_time_tables .switcher').toggle()
-
- $('.vehicle_journeys.show a.vehicle_journey_time_tables').click(switch_time_tables)
-
- convert = (val) ->
- if (val < 10)
- return "0" + val.toString()
- else
- return val.toString()
-
- slide_to = ( col, duration) ->
- rows = $('.vehicle_journeys tbody.journey_pattern_dependent_list .time')
- for row in rows
- do (row) ->
-
- oldHour = parseInt( $( $(row).find( col).find('.hour')).val())
- oldMinute = parseInt( $( $(row).find( col).find('.minute')).val())
- aTime = (((oldHour - 1) * 60) + oldMinute + duration) * 60000
- newValue = new Date(aTime)
- $( $(row).find( col).find('select.hour')).prop( "selectedIndex", convert(newValue.getHours()))
- $( $(row).find( col).find('select.minute')).prop( "selectedIndex", convert(newValue.getMinutes()))
-
- slide = (event) ->
- event.preventDefault()
- hour = parseInt( $(".vehicle_journey_at_stops select#date_hour").val())
- minute = parseInt( $(".vehicle_journey_at_stops select#date_minute").val())
- departure_or_arrival = $(".departure_or_arrival option:selected").val()
- console.log(hour)
- selector_prefix = ".journey_pattern_dependent_list"
- if (departure_or_arrival == "departure")
- vjas_hour_selector = selector_prefix + " .departure_time select.hour"
- vjas_minute_selector = selector_prefix + " .departure_time select.minute"
- else
- vjas_hour_selector = selector_prefix + " .arrival_time select.hour"
- vjas_minute_selector = selector_prefix + " .arrival_time select.minute"
-
- vjas_hour = $( vjas_hour_selector).prop( "selectedIndex" )
- vjas_minute = $( vjas_minute_selector).prop( "selectedIndex" )
- console.log(vjas_hour_selector)
- duration = (hour - vjas_hour) * 60 + (minute - vjas_minute)
- console.log(duration)
- slide_to( '.departure_time', duration)
- slide_to( '.arrival_time', duration)
-
- $(document).on("click", '.vehicle_journeys a.slide', slide)
diff --git a/app/assets/javascripts/vehicle_journeys/index.coffee b/app/assets/javascripts/vehicle_journeys/index.coffee
deleted file mode 100644
index 02de558d4..000000000
--- a/app/assets/javascripts/vehicle_journeys/index.coffee
+++ /dev/null
@@ -1,6 +0,0 @@
-$(".vehicle_journeys.index").ready ->
-
- $( 'body' ).popover({html: true, trigger: "focus", selector: 'thead th button'})
- .on("show.bs.popover", (event)->
- $(event.target).data("bs.popover").tip().css("maxWidth", "350px"))
-
diff --git a/app/assets/javascripts/vehicle_journeys/show.coffee b/app/assets/javascripts/vehicle_journeys/show.coffee
deleted file mode 100644
index 103937d7b..000000000
--- a/app/assets/javascripts/vehicle_journeys/show.coffee
+++ /dev/null
@@ -1,8 +0,0 @@
-$(".vehicle_journeys.show").ready ->
- clean_content = (event) ->
- $(event.target).find('#translate_form').contents().remove()
-
- $('#modal_translation').on( 'hide.bs.modal', clean_content )
-
-
-