jenkins-bot has submitted this change and it was merged. Change subject: Make RankSelector a TemplatedWidget ......................................................................
Make RankSelector a TemplatedWidget Another prerequisite for bug 62527. The RankSelector is a widget based on a template, so it should be a TemplatedWidget. Also, this makes the template much cleaner. Change-Id: I1c0acaf043563b967bfba276e71367627ae02df8 --- M lib/resources/Resources.php M lib/resources/jquery.wikibase/jquery.wikibase.statementview.RankSelector.js M lib/resources/templates.php 3 files changed, 18 insertions(+), 11 deletions(-) Approvals: WikidataJenkins: Verified Henning Snater: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/resources/Resources.php b/lib/resources/Resources.php index 55870c0..d4dcaeb 100644 --- a/lib/resources/Resources.php +++ b/lib/resources/Resources.php @@ -747,6 +747,7 @@ 'jquery.wikibase/themes/default/jquery.wikibase.statementview.RankSelector.css', ), 'dependencies' => array( + 'jquery.ui.TemplatedWidget', 'jquery.ui.position', 'jquery.ui.toggler', 'util.inherit', diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.statementview.RankSelector.js b/lib/resources/jquery.wikibase/jquery.wikibase.statementview.RankSelector.js index d07c0c6..9ef1d7a 100644 --- a/lib/resources/jquery.wikibase/jquery.wikibase.statementview.RankSelector.js +++ b/lib/resources/jquery.wikibase/jquery.wikibase.statementview.RankSelector.js @@ -5,7 +5,7 @@ ( function( mw, wb, $, util ) { 'use strict'; - var PARENT = $.Widget; + var PARENT = $.TemplatedWidget; /** * The node of the rank selector menu to select a rank from. @@ -36,6 +36,16 @@ * @type {Object} */ options: { + template: 'wb-rankselector', + templateParams: [ + '', + '' + ], + + templateShortCuts: { + '$icon': '.ui-icon-rankselector' + }, + rank: wb.Statement.RANK.NORMAL, isRtl: undefined }, @@ -48,16 +58,12 @@ _rank: null, /** - * Icon node. - * @type {jQuery} - */ - $icon: null, - - /** * @see jQuery.Widget._create */ _create: function() { var self = this; + + PARENT.prototype._create.call( this ); if( !$menu ) { $menu = this._buildMenu().appendTo( 'body' ).hide(); @@ -110,8 +116,6 @@ $( document ).on( 'mouseup.' + self.widgetName, degrade ); $( window ).on( 'resize.' + self.widgetName, degrade ); } ); - - this.$icon = mw.template( 'wb-rankselector', '', '' ).appendTo( this.element ); this._setRank( this.options.rank ); }, diff --git a/lib/resources/templates.php b/lib/resources/templates.php index a6e3181..3edbbf2 100644 --- a/lib/resources/templates.php +++ b/lib/resources/templates.php @@ -122,7 +122,7 @@ $templates['wb-statement'] = <<<HTML <div class="wb-statement wb-statementview $1"> - <div class="wb-statement-rank wb-rankselector ui-state-disabled">$2</div> + <div class="wb-statement-rank">$2</div> <div class="wb-claim wb-claim-$3"> <div class="wb-claim-mainsnak" dir="auto"> $4 <!-- wb-snak (Main Snak) --> @@ -139,7 +139,9 @@ $templates['wb-rankselector'] = <<<HTML -<span class="ui-icon ui-icon-rankselector $1" title="$2"></span> +<div class="wb-rankselector ui-state-disabled"> + <span class="ui-icon ui-icon-rankselector $1" title="$2"></span> +</div> HTML; $templates['wb-referenceview'] = -- To view, visit https://gerrit.wikimedia.org/r/118083 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1c0acaf043563b967bfba276e71367627ae02df8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Adrian Lang <adrian.l...@wikimedia.de> Gerrit-Reviewer: Henning Snater <henning.sna...@wikimedia.de> Gerrit-Reviewer: WikidataJenkins <wikidata-servi...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits