Sha256: 5f8ded1d56f44bc1e8aa9b1370fd2ace119ba4e365a22acb846e9e2ab54a39df
Contents?: true
Size: 814 Bytes
Versions: 39
Compression:
Stored size: 814 Bytes
Contents
//= require solidus_admin/Sortable Spree.ready(function() { var sortable_tables = document.querySelectorAll('table.sortable'); _.each(sortable_tables, function(table) { var url = table.getAttribute('data-sortable-link'); var tbody = table.querySelector('tbody'); var sortable = Sortable.create(tbody,{ handle: ".handle", onEnd: function(e) { var positions = {}; _.each(e.to.querySelectorAll('tr'), function(el, index) { var idAttr = el.id; if (idAttr) { var objId = idAttr.split('_').slice(-1); positions['positions['+objId+']'] = index + 1; } }); Spree.ajax({ type: 'POST', dataType: 'json', url: url, data: positions, }); } }); }); });
Version data entries
39 entries across 39 versions & 2 rubygems