]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - vendor/oojs/oojs-ui/demos/classes/OutlinedBookletDialog.js
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / vendor / oojs / oojs-ui / demos / classes / OutlinedBookletDialog.js
1 Demo.OutlinedBookletDialog = function DemoOutlinedBookletDialog( config ) {
2         Demo.OutlinedBookletDialog.parent.call( this, config );
3 };
4 OO.inheritClass( Demo.OutlinedBookletDialog, OO.ui.ProcessDialog );
5 Demo.OutlinedBookletDialog.static.title = 'Outlined booklet dialog';
6 Demo.OutlinedBookletDialog.static.actions = [
7         { action: 'save', label: 'Done', flags: [ 'primary', 'progressive' ] },
8         { action: 'cancel', label: 'Cancel', flags: [ 'safe', 'back' ] }
9 ];
10 Demo.OutlinedBookletDialog.prototype.getBodyHeight = function () {
11         return 250;
12 };
13 Demo.OutlinedBookletDialog.prototype.initialize = function () {
14         Demo.OutlinedBookletDialog.parent.prototype.initialize.apply( this, arguments );
15         this.bookletLayout = new OO.ui.BookletLayout( {
16                 outlined: true
17         } );
18         this.pages = [
19                 new Demo.SamplePage( 'small', { label: 'Small', icon: 'window' } ),
20                 new Demo.SamplePage( 'medium', { label: 'Medium', icon: 'window' } ),
21                 new Demo.SamplePage( 'large', { label: 'Large', icon: 'window' } ),
22                 new Demo.SamplePage( 'larger', { label: 'Larger', icon: 'window' } ),
23                 new Demo.SamplePage( 'full', { label: 'Full', icon: 'window' } )
24         ];
25
26         this.bookletLayout.addPages( this.pages );
27         this.bookletLayout.connect( this, { set: 'onBookletLayoutSet' } );
28         this.$body.append( this.bookletLayout.$element );
29 };
30 Demo.OutlinedBookletDialog.prototype.getActionProcess = function ( action ) {
31         if ( action ) {
32                 return new OO.ui.Process( function () {
33                         this.close( { action: action } );
34                 }, this );
35         }
36         return Demo.OutlinedBookletDialog.parent.prototype.getActionProcess.call( this, action );
37 };
38 Demo.OutlinedBookletDialog.prototype.onBookletLayoutSet = function ( page ) {
39         this.setSize( page.getName() );
40 };
41 Demo.OutlinedBookletDialog.prototype.getSetupProcess = function ( data ) {
42         return Demo.OutlinedBookletDialog.parent.prototype.getSetupProcess.call( this, data )
43                 .next( function () {
44                         this.bookletLayout.setPage( this.getSize() );
45                 }, this );
46 };