Commit 8175b7be authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Add "Open in new window" button to ExtJS examples.

Simply copy over the toolbar code from Touch example component
and generalize the handler for the button.
parent 4937a9ec
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -46,6 +46,15 @@ Ext.define('Docs.controller.Examples', {
                    this.loadExample(url);
                }
            },
            'touchexamplecontainer, examplecontainer': {
                afterrender: function(cmp) {
                    cmp.el.addListener('click', function(e, el) {
                        this.openInNewWindow();
                    }, this, {
                        delegate: 'button.new-window'
                    });
                }
            },
            'touchexamplecontainer': {
                afterrender: function(cmp) {
                    cmp.el.addListener('click', function(e, el) {
@@ -68,11 +77,6 @@ Ext.define('Docs.controller.Examples', {
                    }, this, {
                        delegate: 'button.landscape'
                    });
                    cmp.el.addListener('click', function(e, el) {
                        this.openInNewWindow();
                    }, this, {
                        delegate: 'button.new-window'
                    });
                }
            }
        });
+13 −1
Original line number Diff line number Diff line
@@ -4,11 +4,23 @@
 * Renders the example inside iframe.
 */
Ext.define('Docs.view.examples.Container', {
    extend: 'Ext.container.Container',
    extend: 'Ext.panel.Panel',
    alias: 'widget.examplecontainer',
    layout: 'fit',

    initComponent: function() {
        this.dockedItems = [{
            xtype: 'container',
            dock: 'top',
            html: [
                '<div class="cls-grouping example-toolbar">',
                    '<div>',
                        '<button class="new-window">Open in new window</button>',
                    '</div>',
                '</div>'
            ].join('')
        }];

        this.tpl = new Ext.XTemplate(
            '<iframe style="width: 100%; height: 100%; border: 0;" src="{url}"></iframe>'
        );