Sha256: 6c25ece5261dc1a30899499ba0aa6e9ce4f26fa534ea41c2d687883d13d91f11
Contents?: true
Size: 863 Bytes
Versions: 10
Compression:
Stored size: 863 Bytes
Contents
sendSorted = (dataList) -> $.ajax type : 'PATCH' url : "#{window.location.pathname}/sort" data : sorted : dataList initDnDSorting = -> $table = $('[data-sortable]') $tableRows = $table.children('tr') if isDnDSorting($table, $tableRows) minimum = $tableRows.first().data('position') $table.tableDnD onDrop : -> resortedList = [] $table.children('tr').each (index, item) -> $item = $(item) resortedList.push id : $item.data('id') position : index + minimum sendSorted resortedList return return isDnDSorting = ($table, $tableRows) -> first = window.location.search.indexOf('sort') is -1 second = $tableRows.length > 0 third = $table.data('sortable') first and second and third $ -> $(document).on 'ready page:load', initDnDSorting
Version data entries
10 entries across 10 versions & 1 rubygems