X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/vendor/oojs/oojs-ui/demos/classes/SearchWidgetDialog.js diff --git a/vendor/oojs/oojs-ui/demos/classes/SearchWidgetDialog.js b/vendor/oojs/oojs-ui/demos/classes/SearchWidgetDialog.js new file mode 100644 index 00000000..f8d17188 --- /dev/null +++ b/vendor/oojs/oojs-ui/demos/classes/SearchWidgetDialog.js @@ -0,0 +1,30 @@ +Demo.SearchWidgetDialog = function DemoSearchWidgetDialog( config ) { + Demo.SearchWidgetDialog.parent.call( this, config ); + this.broken = false; +}; +OO.inheritClass( Demo.SearchWidgetDialog, OO.ui.ProcessDialog ); +Demo.SearchWidgetDialog.static.title = 'Search widget dialog'; +Demo.SearchWidgetDialog.prototype.initialize = function () { + var i, items, searchWidget; + Demo.SearchWidgetDialog.parent.prototype.initialize.apply( this, arguments ); + items = []; + searchWidget = new OO.ui.SearchWidget(); + for ( i = 1; i <= 20; i++ ) { + items.push( new OO.ui.OptionWidget( { data: i, label: 'Item ' + i } ) ); + } + searchWidget.results.addItems( items ); + searchWidget.onQueryChange = function () {}; + this.$body.append( searchWidget.$element ); +}; +Demo.SearchWidgetDialog.prototype.getBodyHeight = function () { + return 300; +}; +Demo.SearchWidgetDialog.static.actions = [ + { action: 'cancel', label: 'Cancel', flags: [ 'safe', 'back' ] } +]; +Demo.SearchWidgetDialog.prototype.getActionProcess = function ( action ) { + var dialog = this; + return new OO.ui.Process( function () { + dialog.close( { action: action } ); + } ); +};