X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/vendor/oojs/oojs-ui/demos/classes/OutlinedBookletDialog.js diff --git a/vendor/oojs/oojs-ui/demos/classes/OutlinedBookletDialog.js b/vendor/oojs/oojs-ui/demos/classes/OutlinedBookletDialog.js new file mode 100644 index 00000000..c58a6fdc --- /dev/null +++ b/vendor/oojs/oojs-ui/demos/classes/OutlinedBookletDialog.js @@ -0,0 +1,46 @@ +Demo.OutlinedBookletDialog = function DemoOutlinedBookletDialog( config ) { + Demo.OutlinedBookletDialog.parent.call( this, config ); +}; +OO.inheritClass( Demo.OutlinedBookletDialog, OO.ui.ProcessDialog ); +Demo.OutlinedBookletDialog.static.title = 'Outlined booklet dialog'; +Demo.OutlinedBookletDialog.static.actions = [ + { action: 'save', label: 'Done', flags: [ 'primary', 'progressive' ] }, + { action: 'cancel', label: 'Cancel', flags: [ 'safe', 'back' ] } +]; +Demo.OutlinedBookletDialog.prototype.getBodyHeight = function () { + return 250; +}; +Demo.OutlinedBookletDialog.prototype.initialize = function () { + Demo.OutlinedBookletDialog.parent.prototype.initialize.apply( this, arguments ); + this.bookletLayout = new OO.ui.BookletLayout( { + outlined: true + } ); + this.pages = [ + new Demo.SamplePage( 'small', { label: 'Small', icon: 'window' } ), + new Demo.SamplePage( 'medium', { label: 'Medium', icon: 'window' } ), + new Demo.SamplePage( 'large', { label: 'Large', icon: 'window' } ), + new Demo.SamplePage( 'larger', { label: 'Larger', icon: 'window' } ), + new Demo.SamplePage( 'full', { label: 'Full', icon: 'window' } ) + ]; + + this.bookletLayout.addPages( this.pages ); + this.bookletLayout.connect( this, { set: 'onBookletLayoutSet' } ); + this.$body.append( this.bookletLayout.$element ); +}; +Demo.OutlinedBookletDialog.prototype.getActionProcess = function ( action ) { + if ( action ) { + return new OO.ui.Process( function () { + this.close( { action: action } ); + }, this ); + } + return Demo.OutlinedBookletDialog.parent.prototype.getActionProcess.call( this, action ); +}; +Demo.OutlinedBookletDialog.prototype.onBookletLayoutSet = function ( page ) { + this.setSize( page.getName() ); +}; +Demo.OutlinedBookletDialog.prototype.getSetupProcess = function ( data ) { + return Demo.OutlinedBookletDialog.parent.prototype.getSetupProcess.call( this, data ) + .next( function () { + this.bookletLayout.setPage( this.getSize() ); + }, this ); +};