JS changes to load drag and drop

This commit is contained in:
Christophe Vilayphiou 2012-05-22 17:37:15 +08:00
parent 1c35e38097
commit 541aa5831e
2 changed files with 8 additions and 1 deletions

View File

@ -34,6 +34,10 @@ $('.part_kind').live('click', function() {
});
$(document).ready(function(){
bindTreeDragHandle();
});
var bindTreeDragHandle = function(){
$('ol.sortable').nestedSortable({
disableNesting: 'no-nest',
forcePlaceholderSize: true,
@ -52,4 +56,4 @@ $(document).ready(function(){
$.post("<%= Rails.application.routes.url_helpers.admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: ui.item.parent().closest('li').attr('id'), position: ui.item.index() } );
}
});
});
}

View File

@ -1,3 +1,6 @@
<ol class="nav nav-list">
<%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
</ol>
<script type="text/javascript">
bindTreeDragHandle();
</script>