Put nestedSortable in page_edit.js.erb

This commit is contained in:
Christophe Vilayphiou committed 2012-05-12 22:12:17 +08:00
1 parent ef49df448d
commit 803253ebcf
2 files changed
+21 -24

No files matched your search

@@ -1,25 +1 @@
<%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
<script>
$(document).ready(function(){
$('ol.sortable').nestedSortable({
disableNesting: 'no-nest',
forcePlaceholderSize: true,
handle: 'i',
helper: 'clone',
items: 'li',
maxLevels: 3,
opacity: .5,
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() } );
}
});
});
</script>