This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
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() } );
|
|
|
|
}
|
|
|
|
});
|
2013-04-08 06:39:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$("div.editable").live("mouseenter mouseleave", function (event) {
|
|
|
|
$(this).children('.edit_link').toggle();
|
|
|
|
});
|