mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 23:05:35 +00:00
Merge "MWCategoryWidget: Implement setDisabled"
This commit is contained in:
commit
99351fa20a
|
@ -49,6 +49,9 @@ ve.ui.MWCategoryItemWidget = function VeUiMWCategoryItemWidget( config ) {
|
||||||
ve.init.platform.linkCache.styleElement( this.name, this.$label );
|
ve.init.platform.linkCache.styleElement( this.name, this.$label );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Events
|
||||||
|
this.on( 'click', this.onButtonClick.bind( this ) );
|
||||||
|
|
||||||
this.$element.addClass( 've-ui-mwCategoryItemWidget' );
|
this.$element.addClass( 've-ui-mwCategoryItemWidget' );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,15 +71,11 @@ OO.mixinClass( ve.ui.MWCategoryItemWidget, OO.ui.mixin.DraggableElement );
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle mouse click events.
|
* Handle button widget click events.
|
||||||
*
|
*
|
||||||
* @method
|
* @method
|
||||||
* @param {jQuery.Event} e Mouse click event
|
|
||||||
* @fires togglePopupMenu on click.
|
* @fires togglePopupMenu on click.
|
||||||
*/
|
*/
|
||||||
ve.ui.MWCategoryItemWidget.prototype.onClick = function () {
|
ve.ui.MWCategoryItemWidget.prototype.onButtonClick = function () {
|
||||||
this.emit( 'togglePopupMenu', this );
|
this.emit( 'togglePopupMenu', this );
|
||||||
|
|
||||||
// Parent method
|
|
||||||
return ve.ui.MWCategoryItemWidget.super.prototype.onClick.apply( this, arguments );
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -230,6 +230,29 @@ ve.ui.MWCategoryWidget.prototype.setDefaultSortKey = function ( value ) {
|
||||||
this.popup.setDefaultSortKey( value );
|
this.popup.setDefaultSortKey( value );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
ve.ui.MWCategoryWidget.prototype.setDisabled = function () {
|
||||||
|
var isDisabled;
|
||||||
|
// Parent method
|
||||||
|
ve.ui.MWCategoryWidget.super.prototype.setDisabled.apply( this, arguments );
|
||||||
|
|
||||||
|
isDisabled = this.isDisabled();
|
||||||
|
|
||||||
|
if ( this.input ) {
|
||||||
|
this.input.setDisabled( isDisabled );
|
||||||
|
}
|
||||||
|
if ( this.items ) {
|
||||||
|
this.items.forEach( function ( item ) {
|
||||||
|
item.setDisabled( isDisabled );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
if ( this.popup ) {
|
||||||
|
this.popup.closePopup();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get list of category names.
|
* Get list of category names.
|
||||||
*
|
*
|
||||||
|
@ -362,6 +385,7 @@ ve.ui.MWCategoryWidget.prototype.addItems = function ( items, index ) {
|
||||||
}
|
}
|
||||||
config.hidden = cachedData.hidden;
|
config.hidden = cachedData.hidden;
|
||||||
config.missing = cachedData.missing;
|
config.missing = cachedData.missing;
|
||||||
|
config.disabled = widget.disabled;
|
||||||
|
|
||||||
categoryItem = new ve.ui.MWCategoryItemWidget( config );
|
categoryItem = new ve.ui.MWCategoryItemWidget( config );
|
||||||
categoryItem.connect( widget, {
|
categoryItem.connect( widget, {
|
||||||
|
|
Loading…
Reference in a new issue