Commit 2e151556 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Fix PackageLogic - mark parent always as not leaf.

Previously when class Foo happened to be listed before Foo.Bar,
the Foo node was created and Bar added as a child to it, but
Foo was left to be a leaf node, which meant its children were
invisible, making the class-tree look broken.
parent d0885382
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
@@ -62,11 +62,8 @@ Ext.define('Docs.view.cls.PackageLogic', {
        else {
            var parentName = this.packageName(cls.name);
            var parent = this.packages[parentName] || this.addPackage(parentName);
            if (parent.leaf) {
                parent.leaf = false;
            }
            var node = this.classNode(cls);
            parent.children.push(node);
            this.addChild(parent, node);
            this.packages[cls.name] = node;
        }
    },
@@ -81,11 +78,19 @@ Ext.define('Docs.view.cls.PackageLogic', {
        var parentName = this.packageName(name);
        var parent = this.packages[parentName] || this.addPackage(parentName);
        var pkg = this.packageNode(name);
      parent.children.push(pkg);
        this.addChild(parent, pkg);
        this.packages[name] = pkg;
        return pkg;
    },

    // Add child node and ensure parent is no more marked as a leaf
    addChild: function(parent, child) {
        parent.children.push(child);
        if (parent.leaf) {
            parent.leaf = false;
        }
    },

    // Given full doc object for class creates class node
    classNode: function(cls) {
      return {