Skip to content

Commit

Permalink
Switch back to setting nodes as leaves, but fix the drop zone code to
Browse files Browse the repository at this point in the history
allow dropping on leaves.
  • Loading branch information
bharat committed Jan 6, 2011
1 parent 9682b7e commit fc6907d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 1 addition & 5 deletions modules/organize/controllers/organize.php
Expand Up @@ -169,6 +169,7 @@ private function _get_tree($item, $selected) {
"editable" => false,
"expandable" => false,
"id" => $child->id,
"leaf" => $child->children_count(array(array("type", "=", "album"))) == 0,
"text" => $child->title,
"nodeType" => "async");

Expand All @@ -177,11 +178,6 @@ private function _get_tree($item, $selected) {
$node["children"] = $this->_get_tree($child, $selected);
$node["expanded"] = true;
}

if ($child->children_count(array(array("type", "=", "album"))) == 0) {
$node["children"] = array();
$node["expanded"] = true;
}
$tree[] = $node;
}
return $tree;
Expand Down
7 changes: 7 additions & 0 deletions modules/organize/views/organize_frame.html.php
Expand Up @@ -345,6 +345,13 @@
return returnCls;
}

// Override Ext.tree.TreeDropZone.getDropPoint so that it allows dropping
// on any node. The standard function won't let you drop on leaves, but
// in our model we consider an album without sub-albums a leaf.
v.dropZone.getDropPoint = function(e, n, dd) {
return "append";
}

v.dropZone.onNodeDrop = function(target, dd, e, data) {
var nodes = data.nodes;
source_ids = [];
Expand Down

0 comments on commit fc6907d

Please sign in to comment.