From: Prateek Saxena Date: Fri, 11 Sep 2015 06:05:38 +0000 (+0530) Subject: mw.widgets.CategorySelector: Add configuration to limit number of results X-Git-Tag: 1.31.0-rc.0~10044^2 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=57a932bdf79670a106c65f8fa89d6b14f0728871;p=lhc%2Fweb%2Fwiklou.git mw.widgets.CategorySelector: Add configuration to limit number of results Change-Id: I530bca7950fa75e667d7e5f08d51b304fe3ad14b --- diff --git a/resources/src/mediawiki.widgets/mw.widgets.CategorySelector.js b/resources/src/mediawiki.widgets/mw.widgets.CategorySelector.js index a15cd8707c..8d6452cd19 100644 --- a/resources/src/mediawiki.widgets/mw.widgets.CategorySelector.js +++ b/resources/src/mediawiki.widgets/mw.widgets.CategorySelector.js @@ -16,8 +16,13 @@ * * @constructor * @param {Object} [config] Configuration options + * @cfg {number} [limit=10] Maximum number of results to load */ mw.widgets.CategorySelector = function ( config ) { + // Config initialization + config = $.extend( { limit: 10 }, config ); + this.limit = config.limit; + // Parent constructor mw.widgets.CategorySelector.parent.call( this, config ); @@ -82,7 +87,7 @@ api.get( { action: 'opensearch', namespace: catNsId, - limit: 10, + limit: this.limit, search: input } ).done( function ( res ) { var categoryNames = res[ 1 ].map( function ( name ) {