Sha256: 5ed508fb13d3f296ddabe52dcb85c63ad8a86a42a132543e5a3dce0ecd8670c5
Contents?: true
Size: 753 Bytes
Versions: 5
Compression:
Stored size: 753 Bytes
Contents
//= require jquery.ui.sortable $(function() { if(!$("#simple_content_management_simple_menu_items_index").length) return; $("#simple-menu-items-draggable-nav").sortable({ update: function(e, ui) { var id = ui.item.find("a[data-id]").data("id"); var nextPosition = ui.item.prevAll("li").length; $.ajax({ type: "POST", url: $(this).data("insert-at-path").replace("smi_id", id).replace("smi_position", nextPosition), data: { _method: "PUT" }, dataType: "json", success: function(responseData) { console.log(responseData); for(var i=0; i<responseData.length; i++) { $("a[data-id="+responseData[i]["id"]+"]").data("position", responseData[i]["position"]); } } }); } }).disableSelection(); })
Version data entries
5 entries across 5 versions & 1 rubygems