29 lines
		
	
	
		
			735 B
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			735 B
		
	
	
	
		
			Plaintext
		
	
	
	
$(document).ready(function(){
 | 
						|
	bindTreeDragHandle();
 | 
						|
});
 | 
						|
 | 
						|
var bindTreeDragHandle = function(){
 | 
						|
	$('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() } );
 | 
						|
  	}
 | 
						|
	});
 | 
						|
}
 | 
						|
 | 
						|
$("div.editable").live("mouseenter mouseleave", function (event) {
 | 
						|
  $(this).children('.edit_link').toggle();
 | 
						|
});
 |