Add drag and drop to structure side_bar
This commit is contained in:
1 parent
63f904d3b0
commit
fd52d00187
10 files changed
+457
-11
No files matched your search
@@ -1 +1,28 @@
|
||||
<%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
|
||||
<%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('ol.sortable').nestedSortable({
|
||||
disableNesting: 'no-nest',
|
||||
forcePlaceholderSize: true,
|
||||
handle: 'div',
|
||||
helper: 'clone',
|
||||
items: 'li',
|
||||
maxLevels: 3,
|
||||
opacity: .6,
|
||||
placeholder: 'placeholder',
|
||||
revert: 250,
|
||||
tabSize: 25,
|
||||
tolerance: 'pointer',
|
||||
toleranceElement: '> div',
|
||||
|
||||
stop: function(event, ui) {
|
||||
$.post("<%= admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: ui.item.parent().closest('li').attr('id'), position: ui.item.index() } );
|
||||
// console.log("parent: " + ui.item.parent().closest('li').attr('id'));
|
||||
// console.log("id: " + ui.item.attr('id'));
|
||||
// console.log("position: " + ui.item.index());
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user