WIP: Aureplop/kpsul js refactor #501
1 changed files with 9 additions and 4 deletions
|
@ -720,18 +720,21 @@ class ModelForest {
|
|||
var that = this;
|
||||
function recurse(node) {
|
||||
if (node.constructor.verbose_name === modelname) {
|
||||
callback(node);
|
||||
if callback(node);
|
||||
return true;
|
||||
}
|
||||
|
||||
var children = that.get_children(node);
|
||||
if (children) {
|
||||
for (let child of children)
|
||||
recurse(child);
|
||||
if (recurse(child))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (let root of this.roots)
|
||||
recurse(root);
|
||||
if (recurse(root))
|
||||
return ;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -743,8 +746,10 @@ class ModelForest {
|
|||
var result = null;
|
||||
|
||||
function callback(node) {
|
||||
if (node.id == id)
|
||||
if (node.id == id) {
|
||||
result = node ;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
this.traverse(modelname, callback);
|
||||
|
|
Loading…
Reference in a new issue