Commit 4e70719c authored by Nick Poulden's avatar Nick Poulden
Browse files

Open favorite class tabs

parent 77e062c1
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -36,7 +36,12 @@ Ext.define('Docs.controller.Tabs', {
                afterrender: function(cmp) {
                    this.addTabIconListeners(cmp);
                    this.addTabListeners(cmp);
                }

                    Ext.getStore('Favorites').each(function(f) {
                        this.addTabFromTree(f.data.url, this.getClassTree(), true);
                    }, this);
                },
                scope: this
            }
        });
    },
@@ -45,13 +50,15 @@ 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) {
    addTabFromTree: function(url, tree, noAnimate) {
        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);
        }
    },

    /**
+14 −8
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ Ext.define('Docs.view.Tabs', {
        this.callParent();
    },

    tabQueue: [],

    /**
     * Adds a new tab to the Tab bar
     *
@@ -43,7 +45,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) {
    addTab: function(tab, noAnimate) {

        if (!Ext.Array.contains(this.openTabs, tab.href)) {
            var tpl = Ext.create('Ext.XTemplate',
@@ -58,13 +60,17 @@ Ext.define('Docs.view.Tabs', {
            )
            var docTab = Ext.get(tpl.append(this.el.dom, tab));

            if (noAnimate) {
                docTab.setStyle({ visibility: 'visible' });
            } else {
                // Effect to 'slide' the tab out when it is created.
                var width = docTab.getWidth();
            docTab.setStyle('width', '10px')
            docTab.setStyle({visibility: 'visible'})
                docTab.setStyle('width', '10px');
                docTab.setStyle({ visibility: 'visible' });
                docTab.animate({
                    to: { width: width }
                });
            }

            this.openTabs.push(tab.href);
        }
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ Ext.define('Docs.view.Viewport', {
                        hideCollapseTool: true,
                        animCollapse: true,
                        bodyPadding: '14 9',
                        width: 220,
                        width: 240,
                        items: [
                            {
                                xtype: 'classtree',