Orbit/app/assets/javascripts/page_edit.js.erb

24 lines
619 B
Plaintext
Raw Normal View History

2012-05-12 14:12:17 +00:00
$(document).ready(function(){
2012-05-22 09:37:15 +00:00
bindTreeDragHandle();
});
var bindTreeDragHandle = function(){
2012-05-12 14:12:17 +00:00
$('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("<%= 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() } );
}
});
2012-05-22 09:37:15 +00:00
}