Commit 4ec51915 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Remove tabs overflow menu logic from controller.

Monitor the clicks on menu items inside the view.

This way the whole interaction with tab-menu is entirely encapsulated inside view.
parent 0b7423a6
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -106,12 +106,6 @@ Ext.define('Docs.controller.Tabs', {
                    Ext.getCmp('doctabs').refresh();
                },
                scope: this
            },
            '[componentCls=tab-menu] menuitem': {
                click: function(cmp) {
                    Docs.History.push(cmp.href, { navigate: true });
                },
                scope: this
            }
        });
    },
+13 −1
Original line number Diff line number Diff line
@@ -8,6 +8,12 @@ Ext.define('Docs.view.TabMenu', {

    initComponent: function() {
        this.addEvents(
            /**
             * @event
             * Fired when one of the tab-related menu items is clicked.
             * @param {Ext.menu.Item} item
             */
            "tabItemClick",
            /**
             * @event
             * Fired when "close all tabs" item is clicked.
@@ -41,10 +47,16 @@ Ext.define('Docs.view.TabMenu', {
            iconCls: tab.iconCls,
            origIcon: tab.iconCls,
            href: tab.href,
            cls: cls
            cls: cls,
            handler: this.onTabItemClick,
            scope: this
        });
    },

    onTabItemClick: function(item) {
        this.fireEvent("tabItemClick", item);
    },

    /**
     * Adds CSS class to menu item representing a tab.
     *
+4 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ Ext.define('Docs.view.Tabs', {
    id: 'doctabs',
    componentCls: 'doctabs',
    requires: [
        'Docs.History',
        'Docs.view.TabMenu'
    ],

@@ -432,6 +433,9 @@ Ext.define('Docs.view.Tabs', {
            menu: new Docs.view.TabMenu({
                listeners: {
                    closeAllTabs: this.closeAllTabs,
                    tabItemClick: function(item) {
                        Docs.History.push(item.href, { navigate: true });
                    },
                    scope: this
                }
            })