d14681bc2bfb9f706a578d1ce7787c9b4b7187f1
3 * Widget to select and display target page on Special:RecentChangesLinked (AKA Related Changes)
5 * @extends OO.ui.Widget
8 * @param {mw.rcfilters.Controller} controller
9 * @param {mw.rcfilters.dm.FilterItem} targetPageModel
10 * @param {Object} [config] Configuration object
12 mw
.rcfilters
.ui
.RclTargetPageWidget
= function MwRcfiltersUiRclTargetPageWidget(
13 controller
, targetPageModel
, config
15 config
= config
|| {};
18 mw
.rcfilters
.ui
.RclTargetPageWidget
.parent
.call( this, config
);
20 this.controller
= controller
;
21 this.model
= targetPageModel
;
23 this.titleSearch
= new mw
.widgets
.TitleInputWidget( {
25 placeholder
: mw
.msg( 'rcfilters-target-page-placeholder' )
29 this.model
.connect( this, { update
: 'updateUiBasedOnModel' } );
31 this.titleSearch
.$input
.on( {
32 blur
: this.onLookupInputBlur
.bind( this )
35 this.titleSearch
.lookupMenu
.connect( this, {
36 choose
: 'onLookupMenuItemChoose'
41 .addClass( 'mw-rcfilters-ui-rclTargetPageWidget' )
42 .append( this.titleSearch
.$element
);
44 this.updateUiBasedOnModel();
49 OO
.inheritClass( mw
.rcfilters
.ui
.RclTargetPageWidget
, OO
.ui
.Widget
);
54 * Respond to the user choosing a title
56 mw
.rcfilters
.ui
.RclTargetPageWidget
.prototype.onLookupMenuItemChoose = function () {
57 this.titleSearch
.$input
.blur();
61 * Respond to titleSearch $input blur
63 mw
.rcfilters
.ui
.RclTargetPageWidget
.prototype.onLookupInputBlur = function () {
64 this.controller
.setTargetPage( this.titleSearch
.getQueryValue() );
68 * Respond to the model being updated
70 mw
.rcfilters
.ui
.RclTargetPageWidget
.prototype.updateUiBasedOnModel = function () {
71 this.titleSearch
.setValue( this.model
.getValue() );