CategoryPopupWidget: Track popup hiding again so sortkey changes are applied

OOjs UI killed the 'hide' event that was running this code in the dialog refactor
back in July (Id121fc3a), but left it documented (along with 'show').

Just use the 'toggle' event instead.

Bug: 72168
Change-Id: I172fac81c4cbb89505522011aed57db57ccbc52f
This commit is contained in:
Alex Monk 2014-10-21 20:16:16 +01:00 committed by Roan Kattouw
parent bc76c6ea3e
commit d7a5f4c1ac

View file

@ -43,7 +43,7 @@ ve.ui.MWCategoryPopupWidget = function VeUiMWCategoryPopupWidget( config ) {
.append( this.sortKeyField.$element );
// Events
this.connect( this, { hide: 'onHide' } );
this.connect( this, { toggle: 'onToggle' } );
this.removeButton.connect( this, { click: 'onRemoveCategory' } );
this.$sortKeyForm.on( 'submit', this.onSortKeySubmit.bind( this ) );
@ -122,11 +122,15 @@ ve.ui.MWCategoryPopupWidget.prototype.openPopup = function ( item ) {
};
/**
* Handle popup hide events.
* Handle popup toggle events.
*
* @param {boolean} show Widget is being made visible
* @method
*/
ve.ui.MWCategoryPopupWidget.prototype.onHide = function () {
ve.ui.MWCategoryPopupWidget.prototype.onToggle = function ( show ) {
if ( show ) {
return;
}
var newSortkey = this.sortKeyInput.$input.val();
if ( !this.removed && newSortkey !== ( this.origSortkey || '' ) ) {
this.emit( 'updateSortkey', this.category, this.sortKeyInput.$input.val() );