*/
public function __construct( array $config = array() ) {
// Configuration initialization
-
$config = array_merge(
array(
'nameNamespace' => 'namespace',
*/
namespace MediaWiki\Widget;
-use OOUI\TextInputWidget;
-
/**
* Title input widget.
*/
-class TitleInputWidget extends TextInputWidget {
+class TitleInputWidget extends \OOUI\TextInputWidget {
protected $namespace = null;
protected $relative = null;
<?php
/**
- * MediaWiki Widgets \96 UserInputWidget class.
+ * MediaWiki Widgets – UserInputWidget class.
*
* @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
namespace MediaWiki\Widget;
-use OOUI\TextInputWidget;
-
/**
* User input widget.
*/
-class UserInputWidget extends TextInputWidget {
+class UserInputWidget extends \OOUI\TextInputWidget {
+
/**
* @param array $config Configuration options
*/
*/
mw.widgets.NamespaceInputWidget = function MwWidgetsNamespaceInputWidget( config ) {
// Parent constructor
- OO.ui.Widget.call( this, config );
+ mw.widgets.NamespaceInputWidget.parent.call( this, config );
// Properties
this.namespace = config.namespace;
this.allValue = config.allValue;
// Events
- config.namespace.connect( this, { change: 'updateCheckboxesState' } );
+ this.namespace.connect( this, { change: 'updateCheckboxesState' } );
// Initialization
this.$element
.addClass( 'mw-widget-namespaceInputWidget' )
.append(
- config.namespace.$element,
- config.invert ? config.invert.$element : '',
- config.associated ? config.associated.$element : ''
+ this.namespace.$element,
+ this.invert ? this.invert.$element : '',
+ this.associated ? this.associated.$element : ''
);
this.updateCheckboxesState();
};
- /* Inheritance */
+ /* Setup */
OO.inheritClass( mw.widgets.NamespaceInputWidget, OO.ui.Widget );
* @license The MIT License (MIT); see LICENSE.txt
*/
( function ( $, mw ) {
+
/**
* Creates an mw.widgets.TitleInputWidget object.
*
config = config || {};
// Parent constructor
- OO.ui.TextInputWidget.call( this, $.extend( {}, config, { autocomplete: false } ) );
+ mw.widgets.TitleInputWidget.parent.call( this, $.extend( {}, config, { autocomplete: false } ) );
// Mixin constructors
OO.ui.mixin.LookupElement.call( this, config );
} );
};
- /* Inheritance */
+ /* Setup */
OO.inheritClass( mw.widgets.TitleInputWidget, OO.ui.TextInputWidget );
-
OO.mixinClass( mw.widgets.TitleInputWidget, OO.ui.mixin.LookupElement );
/* Methods */
this.setLookupsDisabled( true );
// Parent method
- retval = OO.ui.TextInputWidget.prototype.focus.apply( this, arguments );
+ retval = mw.widgets.TitleInputWidget.parent.prototype.focus.apply( this, arguments );
this.setLookupsDisabled( false );
* Get lookup cache item from server response data.
*
* @method
- * @param {Mixed} data Response from server
+ * @param {Mixed} response Response from server
*/
- mw.widgets.TitleInputWidget.prototype.getLookupCacheDataFromResponse = function ( data ) {
- return data.query || {};
+ mw.widgets.TitleInputWidget.prototype.getLookupCacheDataFromResponse = function ( response ) {
+ return response.query || {};
};
/**
}, config );
// Parent constructor
- OO.ui.MenuOptionWidget.call( this, config );
+ mw.widgets.TitleOptionWidget.parent.call( this, config );
- // Intialization
+ // Initialization
this.$label.wrap( '<a>' );
this.$link = this.$label.parent();
this.$link.attr( 'href', config.href );
}
};
- /* Inheritance */
+ /* Setup */
OO.inheritClass( mw.widgets.TitleOptionWidget, OO.ui.MenuOptionWidget );
* @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 );
* 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 || {};
};
/**
*/
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