Commit 9a2fff5d authored by Nick Poulden's avatar Nick Poulden
Browse files

Tab activation fixes

parent b1682af4
Loading
Loading
Loading
Loading
+3 −26
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ Ext.define('Docs.controller.Tabs', {
                    this.addTabListeners(cmp);

                    Ext.getStore('Favorites').each(function(f) {
                        this.addTabFromTree(f.data.url, this.getClassTree(), true);
                        this.addTabFromTree(f.data.url, this.getClassTree(), true, true);
                    }, this);
                },
                scope: this
@@ -60,14 +60,14 @@ Ext.define('Docs.controller.Tabs', {
     * Adds a tab based on information from the class tree
     * @param {String} url The url of the record in the tree
     */
    addTabFromTree: function(url, tree, noAnimate) {
    addTabFromTree: function(url, tree, noAnimate, noActivate) {
        var treeRecord = tree.findRecordByUrl(url);
        if (treeRecord && treeRecord.raw) {
            Ext.getCmp('doctabs').addTab({
                href: '#' + treeRecord.raw.url,
                text: treeRecord.raw.text,
                iconCls: treeRecord.raw.iconCls
            }, noAnimate);
            }, noAnimate, noActivate);
        }
    },

@@ -121,11 +121,6 @@ Ext.define('Docs.controller.Tabs', {
            }
            var url = Ext.get(el).down('.tabUrl').getAttribute('href');
            Ext.getCmp('doctabs').activateTab(url);
            // Ext.Array.each(Ext.get(el).up('.doctabs').query('.doctab'), function(t) {
            //     Ext.get(t).removeCls('active');
            // });
            // Ext.get(el).addCls('active');
            // window.location = Ext.get(el).down('.tabUrl').getAttribute('href');
        }, this, {
            delegate: '.doctab'
        });
@@ -134,24 +129,6 @@ Ext.define('Docs.controller.Tabs', {
            delegate: '.tabUrl',
            preventDefault: true
        });

        cmp.el.addListener('mouseover', function(event, el) {
            var icn = Ext.get(el).down('.icn');
            if (icn) {
                icn.addCls('close');
            }
        }, this, {
            delegate: '.doctab'
        });

        cmp.el.addListener('mouseout', function(event, el) {
            var icn = Ext.get(el).down('.icn');
            if (icn) {
                icn.removeCls('close');
            }
        }, this, {
            delegate: '.doctab'
        });
    }

});
+4 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ Ext.define('Docs.view.Tabs', {
     * @param {String} tab.text Text to be used on the tab
     * @param {String} tab.iconCls CSS class to be used as the icon
     */
    addTab: function(tab, noAnimate) {
    addTab: function(tab, noAnimate, noActivate) {
        if (!Ext.Array.contains(this.openTabs, tab.href)) {
            var tpl = Ext.create('Ext.XTemplate',
                '<div class="doctab" style="visibility: hidden">',
@@ -74,7 +74,9 @@ Ext.define('Docs.view.Tabs', {
            this.openTabs.push(tab.href);
        }

        if (!noActivate) {
            this.activateTab(tab.href);
        }
    },

    /**