From 734658d256119647c798acbb9d9900f1daacfd30 Mon Sep 17 00:00:00 2001 From: taggon Date: Tue, 23 Aug 2011 09:47:58 +0000 Subject: [PATCH] Drag&drop for Admin menu setup page git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8845 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/admin/tpl/js/menu_setup.js | 177 +++++++++++++++++++++++++++++ modules/admin/tpl/menu_setup.html | 10 +- 2 files changed, 182 insertions(+), 5 deletions(-) diff --git a/modules/admin/tpl/js/menu_setup.js b/modules/admin/tpl/js/menu_setup.js index f85ef04ec..5c429f160 100644 --- a/modules/admin/tpl/js/menu_setup.js +++ b/modules/admin/tpl/js/menu_setup.js @@ -46,3 +46,180 @@ jQuery(function($){ }); }); +// menu - drag and drop +jQuery(function($){ + +var + dragging = false, + $holder = $('
  • '); + +$('div.adminMenu') + .delegate('li:not(.placeholder,.parent)', { + 'mousedown.st' : function(event) { + var $this, $uls, $ul, width, height, offset, position, offsets, i, dropzone, wrapper=''; + + if($(event.target).is('a,input,label,textarea') || event.which != 1) return; + + dragging = true; + + $this = $(this); + height = $this.height(); + width = $this.width(); + $uls = $this.parentsUntil('.siteMap').filter('ul'); + $ul = $uls.eq(-1); + + $ul.css('position', 'relative'); + + position = {x:event.pageX, y:event.pageY}; + offset = getOffset(this, $ul.get(0)); + + $clone = $this.clone(true).attr('target', true); + + for(i=$uls.length-1; i; i--) { + $clone = $clone.wrap('