]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - vendor/oojs/oojs-ui/demos/classes/IndexedDialog.js
MediaWiki 1.30.2
[autoinstalls/mediawiki.git] / vendor / oojs / oojs-ui / demos / classes / IndexedDialog.js
1 Demo.IndexedDialog = function DemoIndexedDialog( config ) {
2         Demo.IndexedDialog.parent.call( this, config );
3 };
4 OO.inheritClass( Demo.IndexedDialog, OO.ui.ProcessDialog );
5 Demo.IndexedDialog.static.title = 'Indexed dialog';
6 Demo.IndexedDialog.static.actions = [
7         { action: 'save', label: 'Done', flags: [ 'primary', 'progressive' ] },
8         { action: 'cancel', label: 'Cancel', flags: [ 'safe', 'back' ] }
9 ];
10 Demo.IndexedDialog.prototype.getBodyHeight = function () {
11         return 250;
12 };
13 Demo.IndexedDialog.prototype.initialize = function () {
14         Demo.IndexedDialog.parent.prototype.initialize.apply( this, arguments );
15         this.indexLayout = new OO.ui.IndexLayout();
16         this.tabPanels = [
17                 new Demo.SampleTabPanel( 'first', { label: 'One' } ),
18                 new Demo.SampleTabPanel( 'second', { label: 'Two' } ),
19                 new Demo.SampleTabPanel( 'third', { label: 'Three' } ),
20                 new Demo.SampleTabPanel( 'fourth', { label: 'Four' } )
21         ];
22
23         this.indexLayout.addTabPanels( this.tabPanels );
24         this.$body.append( this.indexLayout.$element );
25
26         this.indexLayout.getTabs().getItemFromData( 'fourth' ).setDisabled( true );
27 };
28 Demo.IndexedDialog.prototype.getActionProcess = function ( action ) {
29         if ( action ) {
30                 return new OO.ui.Process( function () {
31                         this.close( { action: action } );
32                 }, this );
33         }
34         return Demo.IndexedDialog.parent.prototype.getActionProcess.call( this, action );
35 };