* @license The MIT License (MIT); see LICENSE.txt
*/
( function ( $, mw ) {
+
/**
* Creates a mw.widgets.UserInputWidget object.
*
config = config || {};
// Parent constructor
- OO.ui.TextInputWidget.call( this, $.extend( {}, config, { autocomplete: false } ) );
+ mw.widgets.UserInputWidget.parent.call( this, $.extend( {}, config, { autocomplete: false } ) );
// Mixin constructors
OO.ui.mixin.LookupElement.call( this, config );
this.lookupMenu.$element.addClass( 'mw-widget-userInputWidget-menu' );
};
- /* Inheritance */
+ /* Setup */
OO.inheritClass( mw.widgets.UserInputWidget, OO.ui.TextInputWidget );
-
OO.mixinClass( mw.widgets.UserInputWidget, OO.ui.mixin.LookupElement );
/* Methods */
this.setLookupsDisabled( true );
// Parent method
- retval = OO.ui.TextInputWidget.prototype.focus.apply( this, arguments );
+ retval = mw.widgets.UserInputWidget.parent.prototype.focus.apply( this, arguments );
this.setLookupsDisabled( false );
list: 'allusers',
// Prefix of list=allusers is case sensitive. Normalise first
// character to uppercase so that "fo" may yield "Foo".
- auprefix: inputValue[0].toUpperCase() + inputValue.slice( 1 ),
+ auprefix: inputValue[ 0 ].toUpperCase() + inputValue.slice( 1 ),
aulimit: this.limit
} );
};
* Get lookup cache item from server response data.
*
* @method
- * @param {Mixed} data Response from server
+ * @param {Mixed} response Response from server
*/
- mw.widgets.UserInputWidget.prototype.getLookupCacheDataFromResponse = function ( data ) {
- return data.query || {};
+ mw.widgets.UserInputWidget.prototype.getLookupCacheDataFromResponse = function ( response ) {
+ return response.query.allusers || {};
};
/**
* Get list of menu items from a server response.
*
* @param {Object} data Query result
- * @returns {OO.ui.MenuOptionWidget[]} Menu items
+ * @return {OO.ui.MenuOptionWidget[]} Menu items
*/
mw.widgets.UserInputWidget.prototype.getLookupMenuOptionsFromData = function ( data ) {
var len, i, user,
- users = data.allusers,
items = [];
- for ( i = 0, len = users.length; i < len; i++ ) {
- user = users[i] || {};
+ for ( i = 0, len = data.length; i < len; i++ ) {
+ user = data[ i ] || {};
items.push( new OO.ui.MenuOptionWidget( {
label: user.name,
data: user.name