]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - vendor/oojs/oojs-ui/demos/classes/SearchWidgetDialog.js
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / vendor / oojs / oojs-ui / demos / classes / SearchWidgetDialog.js
1 Demo.SearchWidgetDialog = function DemoSearchWidgetDialog( config ) {
2         Demo.SearchWidgetDialog.parent.call( this, config );
3         this.broken = false;
4 };
5 OO.inheritClass( Demo.SearchWidgetDialog, OO.ui.ProcessDialog );
6 Demo.SearchWidgetDialog.static.title = 'Search widget dialog';
7 Demo.SearchWidgetDialog.prototype.initialize = function () {
8         var i, items, searchWidget;
9         Demo.SearchWidgetDialog.parent.prototype.initialize.apply( this, arguments );
10         items = [];
11         searchWidget = new OO.ui.SearchWidget();
12         for ( i = 1; i <= 20; i++ ) {
13                 items.push( new OO.ui.OptionWidget( { data: i, label: 'Item ' + i } ) );
14         }
15         searchWidget.results.addItems( items );
16         searchWidget.onQueryChange = function () {};
17         this.$body.append( searchWidget.$element );
18 };
19 Demo.SearchWidgetDialog.prototype.getBodyHeight = function () {
20         return 300;
21 };
22 Demo.SearchWidgetDialog.static.actions = [
23         { action: 'cancel', label: 'Cancel', flags: [ 'safe', 'back' ] }
24 ];
25 Demo.SearchWidgetDialog.prototype.getActionProcess = function ( action ) {
26         var dialog = this;
27         return new OO.ui.Process( function () {
28                 dialog.close( { action: action } );
29         } );
30 };