Thiemo Mättig (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/351665 )
Change subject: Use addAllowedValue in GrammaticalFeatureListWidget ...................................................................... Use addAllowedValue in GrammaticalFeatureListWidget We still don't know why, but the original patch I6863219 (PS 8) does not work on my machine, but does work on Alekseys. The change in this patch makes it work for me. Change-Id: I7db5c2d3aca4cfe320045e48d01e84edc9425aa6 --- M resources/widgets/GrammaticalFeatureListWidget.js 1 file changed, 24 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme refs/changes/65/351665/1 diff --git a/resources/widgets/GrammaticalFeatureListWidget.js b/resources/widgets/GrammaticalFeatureListWidget.js index e54ecc0..115b2f6 100644 --- a/resources/widgets/GrammaticalFeatureListWidget.js +++ b/resources/widgets/GrammaticalFeatureListWidget.js @@ -1,4 +1,4 @@ -module.exports = (function ( $, OO ) { +module.exports = ( function ( $, OO ) { 'use strict'; /** @@ -58,53 +58,56 @@ return this.input.getValue(); }, - getRequestCacheDataFromResponse: function (response) { + getRequestCacheDataFromResponse: function ( response ) { return response || []; }, - updateMenu: function updateMenu(term) { - if (term === '') { + updateMenu: function updateMenu( term ) { + var self = this; + + if ( term === '' ) { this.clearMenuItems(); return; } - this.getRequestData().then(function (response) { + this.getRequestData().then( function ( response ) { if ( response.error ) { - throw new Error(response.error.info); + throw new Error( response.error.info ); } - this.clearMenuItems(); + self.clearMenuItems(); - var options = response.search.map(function (item) { - var label = $('<div>').text( item.label ).add( - $('<div>').append( $( '<small>' ).text( item.description ) ) ); + var options = response.search.map( function ( item ) { + var label = $( '<div>').text( item.label ).add( + $( '<div>' ).append( $( '<small>' ).text( item.description ) ) ); + self.addAllowedValue( item.id ); return new OO.ui.MenuOptionWidget( { data: item.id, label: label } ); - }); + } ); - this.addOptions(options); - this.menu.updateItemVisibility(); - this.menu.toggle(true); - }.bind(this)); + self.addOptions( options ); + self.menu.updateItemVisibility(); + self.menu.toggle( true ); + }.bind( this )); }, - onMenuChoose: function onMenuChoose(menuItem) { - GrammaticalFeatureListWidget.parent.prototype.onMenuChoose.call(this, menuItem); + onMenuChoose: function onMenuChoose( menuItem ) { + GrammaticalFeatureListWidget.parent.prototype.onMenuChoose.call( this, menuItem ); this.clearInput(); this.clearMenuItems(); }, clearInput: function () { - this.input.$input.val(''); + this.input.$input.val( '' ); }, clearMenuItems: function () { this.menu.clearItems(); - this.menu.toggle(false); + this.menu.toggle( false ); this.menu.updateItemVisibility(); - }, + } } ); return GrammaticalFeatureListWidget; -})( jQuery, OO ); +} )( jQuery, OO ); -- To view, visit https://gerrit.wikimedia.org/r/351665 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7db5c2d3aca4cfe320045e48d01e84edc9425aa6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseLexeme Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits