JS changes to load drag and drop
This commit is contained in:
parent
1c35e38097
commit
541aa5831e
|
@ -34,6 +34,10 @@ $('.part_kind').live('click', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
bindTreeDragHandle();
|
||||||
|
});
|
||||||
|
|
||||||
|
var bindTreeDragHandle = function(){
|
||||||
$('ol.sortable').nestedSortable({
|
$('ol.sortable').nestedSortable({
|
||||||
disableNesting: 'no-nest',
|
disableNesting: 'no-nest',
|
||||||
forcePlaceholderSize: true,
|
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() } );
|
$.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() } );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
|
@ -1,3 +1,6 @@
|
||||||
<ol class="nav nav-list">
|
<ol class="nav nav-list">
|
||||||
<%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
|
<%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
|
||||||
</ol>
|
</ol>
|
||||||
|
<script type="text/javascript">
|
||||||
|
bindTreeDragHandle();
|
||||||
|
</script>
|
Loading…
Reference in New Issue