Sha256: 73977e24bd25817d6847e91e303a506cbef97ac9fbf5dd7ead7a7b147f72afc0
Contents?: true
Size: 924 Bytes
Versions: 3
Compression:
Stored size: 924 Bytes
Contents
minimum = 0 sendSorted = (dataList) -> $.ajax type: "PATCH" url: urlWithoutParams() data: sorted: dataList minimum: minimum initDnDSorting = -> if isDnDSorting() setMinimum() $(".table-sortable").tableDnD onDrop: (table, row) -> rows = $(table).children('tr') i = 0 resortedList = [] rows.each (index, item) -> resortedList[i] = [ $(item).data('id'), item.id ] i++ sendSorted(resortedList) return return urlWithoutParams = -> window.location.pathname + '/re_sort' setMinimum = -> minimum = $('.table-sortable').children('tr')[0].id isDnDSorting = -> first = window.location.search.indexOf('sort') == -1 second = $('.table-sortable').children('tr').length > 0 third = $('.table-sortable').data('position') first && second && third $ -> $(document).on('ready page:load', initDnDSorting)
Version data entries
3 entries across 3 versions & 1 rubygems