diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-30 01:47:59 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-30 01:47:59 +0200 |
commit | 3f130b938bedfbf0fc92176166c6608cdcf0117f (patch) | |
tree | 39e44ef01cc4a76b0764338073506649233a5186 /js/menu.js | |
parent | 294333e41fee406d1493cf858734fc370aa70010 (diff) |
made item also droppable on folder menu items
Diffstat (limited to 'js/menu.js')
-rw-r--r-- | js/menu.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/js/menu.js b/js/menu.js index 2b05237a7..92132632b 100644 --- a/js/menu.js +++ b/js/menu.js @@ -307,8 +307,8 @@ var t = t || function(app, string){ return string; }; // mock translation for lo * @param $elem the element that should be set droppable */ Menu.prototype._bindDroppable = function($elem){ - var self = this; var root = this._getRoot(); + $elem.droppable({ accept: '.feed', hoverClass: 'dnd_over', @@ -326,7 +326,15 @@ var t = t || function(app, string){ return string; }; // mock translation for lo folder._addChildNode(feed); - $dropped.append($dragged[0]); + // to also be able to drop this on a folder entry or the top menu + // we have to check if we use a folder and append to a different + // item + if($elem.hasClass('folder')){ + $dropped.children('ul').append($dragged[0]); + } else { + $dropped.append($dragged[0]); + } + console.log('Moved elem with id ' + feedId + ' to folder with id ' + folderId); // TODO: notify server } @@ -433,6 +441,8 @@ var t = t || function(app, string){ return string; }; // mock translation for lo $elem.append($editButton); $elem.append($deleteButton); $elem.addClass('folder'); + this._bindDroppable($elem); + $elem.attr('data-id', this._id); break; case MenuNodeType.Starred: @@ -450,8 +460,6 @@ var t = t || function(app, string){ return string; }; // mock translation for lo var node = this._children[i]; $subList.append(node.render()); } - this._bindDroppable($subList); - $subList.attr('data-id', this._id); $elem.append($subList); return $elem; |