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

29 lines
735 B
Plaintext
Raw Permalink 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() } );
}
});
2013-04-08 06:39:31 +00:00
}
$("div.editable").live("mouseenter mouseleave", function (event) {
$(this).children('.edit_link').toggle();
});