jenkins-bot has submitted this change and it was merged. Change subject: Added title attribute to rank icon ......................................................................
Added title attribute to rank icon (bug 57660) Added a title attribute to the rank (rank selector) icon. Change-Id: I47b14dc24d6bb90e259d85e1c2a96d04aa106cc2 --- M lib/resources/Resources.php M lib/resources/jquery.wikibase/jquery.wikibase.statementview.RankSelector.js M lib/resources/templates.php M repo/Wikibase.i18n.php M repo/includes/ClaimHtmlGenerator.php 5 files changed, 41 insertions(+), 37 deletions(-) Approvals: Tobias Gritschacher: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/resources/Resources.php b/lib/resources/Resources.php index d46a3bb..64a517a 100644 --- a/lib/resources/Resources.php +++ b/lib/resources/Resources.php @@ -621,9 +621,9 @@ 'wikibase.utilities', ), 'messages' => array( - 'wikibase-statementview-rankselector-rank-preferred', - 'wikibase-statementview-rankselector-rank-normal', - 'wikibase-statementview-rankselector-rank-deprecated', + 'wikibase-statementview-rank-preferred', + 'wikibase-statementview-rank-normal', + 'wikibase-statementview-rank-deprecated', 'wikibase-statementview-referencesheading-pendingcountersubject', 'wikibase-statementview-referencesheading-pendingcountertooltip', 'wikibase-addreference' diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.statementview.RankSelector.js b/lib/resources/jquery.wikibase/jquery.wikibase.statementview.RankSelector.js index 70dd846..dfb35bb 100644 --- a/lib/resources/jquery.wikibase/jquery.wikibase.statementview.RankSelector.js +++ b/lib/resources/jquery.wikibase/jquery.wikibase.statementview.RankSelector.js @@ -91,7 +91,7 @@ $( window ).on( 'resize.' + self.widgetName, degrade ); } ); - this.$icon = mw.template( 'wb-rankselector', '' ).appendTo( this.element ); + this.$icon = mw.template( 'wb-rankselector', '', '' ).appendTo( this.element ); self.$menu.on( 'click.' + this.widgetName, function( event ) { var $li = $( event.target ).closest( 'li' ), @@ -157,7 +157,7 @@ .data( self.widgetName + '-menuitem-rank', i ) .append( $( '<a/>' ) - .text( mw.msg( 'wikibase-statementview-rankselector-rank-' + rankId ) ) + .text( mw.msg( 'wikibase-statementview-rank-' + rankId ) ) .on( 'click.' + self.widgetName, function( event ) { event.preventDefault(); } ) @@ -166,26 +166,6 @@ } ); return $menu.menu(); - }, - - /** - * Returns a rank's serialized string. - * @see wikibase.Statement.RANK - * - * @param {number} rank - * @return {*} - */ - _getRankString: function( rank ) { - var rankString = null; - - $.each( wikibase.Statement.RANK, function( rankId, i ) { - if( rank === i ) { - rankString = rankId.toLowerCase(); - return false; - } - } ); - - return rankString; }, /** @@ -222,8 +202,8 @@ this.$menu.children().removeClass( 'ui-state-active' ); this.$menu - .children( '.' + this.widgetBaseClass + '-menuitem-' + this._getRankString( rank ) ) - .addClass( 'ui-state-active' ); + .children( '.' + this.widgetBaseClass + '-menuitem-' + getRankString( rank ) ) + .addClass( 'ui-state-active' ); this._updateIcon(); }, @@ -232,13 +212,16 @@ * Updates the rank icon to reflect the rank currently set. */ _updateIcon: function() { - var self = this; + var self = this, + rankString = getRankString( this.rank() ); $.each( wikibase.Statement.RANK, function( rankId, i ) { self.$icon.removeClass( 'wb-rankselector-' + rankId.toLowerCase() ); } ); - this.$icon.addClass( 'wb-rankselector-' + this._getRankString( this.rank() ) ); + this.$icon + .addClass( 'wb-rankselector-' + rankString ) + .attr( 'title', mw.msg( 'wikibase-statementview-rank-' + rankString ) ); }, /** @@ -289,4 +272,24 @@ } ); + /** + * Returns a rank's serialized string. + * @see wikibase.Statement.RANK + * + * @param {number} rank + * @return {string|null} + */ + function getRankString( rank ) { + var rankString = null; + + $.each( wikibase.Statement.RANK, function( rankId, i ) { + if( rank === i ) { + rankString = rankId.toLowerCase(); + return false; + } + } ); + + return rankString; + } + }( mediaWiki, wikibase, jQuery ) ); diff --git a/lib/resources/templates.php b/lib/resources/templates.php index f96e5df..f02293f 100644 --- a/lib/resources/templates.php +++ b/lib/resources/templates.php @@ -144,7 +144,7 @@ $templates['wb-rankselector'] = <<<HTML -<span class="ui-icon ui-icon-rankselector $1"></span> +<span class="ui-icon ui-icon-rankselector $1" title="$2"></span> HTML; $templates['wb-referenceview'] = diff --git a/repo/Wikibase.i18n.php b/repo/Wikibase.i18n.php index f48127a..36c39ba 100644 --- a/repo/Wikibase.i18n.php +++ b/repo/Wikibase.i18n.php @@ -73,9 +73,9 @@ 'wikibase-property-footer' => '', # do not translate or duplicate this message to other languages 'wikibase-claimview-snak-tooltip' => 'Enter a value corresponding to the property named "$1". If the property has no designated value or the actual value is not known, you may choose an alternative to specifying a custom value by clicking the icon next to the value input box.', 'wikibase-claimview-snak-new-tooltip' => 'After specifying a property you can enter a corresponding value. If the property has no designated value or the actual value is not known, you may choose an alternative to specifying a custom value by clicking the icon next to the value input box.', - 'wikibase-statementview-rankselector-rank-preferred' => 'Preferred rank', - 'wikibase-statementview-rankselector-rank-normal' => 'Normal rank', - 'wikibase-statementview-rankselector-rank-deprecated' => 'Deprecated rank', + 'wikibase-statementview-rank-preferred' => 'Preferred rank', + 'wikibase-statementview-rank-normal' => 'Normal rank', + 'wikibase-statementview-rank-deprecated' => 'Deprecated rank', 'wikibase-statementview-referencesheading-pendingcountersubject' => '{{PLURAL:$1|source|sources}}', 'wikibase-statementview-referencesheading-pendingcountertooltip' => '{{PLURAL:$1|One source|$1 sources}} not saved yet', 'wikibase-snakview-property-input-placeholder' => 'property', @@ -629,9 +629,9 @@ Parameters: * $1 - the property name the user is about to edit a value of or add another value to', 'wikibase-claimview-snak-new-tooltip' => 'Tooltip message displayed when hovering/clicking the help icon next to the save, cancel and remove links of a claim (see [[d:Wikidata:Glossary]]) when about to add a completely new claim which includes specifying the property.', - 'wikibase-statementview-rankselector-rank-preferred' => "Label of the [[d:Wikidata:Glossary#Rank-preferred|Preferred Rank]] item within the menu that allows adjusting a [[d:Wikidata:Glossary#Statement|Statement's]] [[d:Wikidata:Glossary#Rank|Rank]].", - 'wikibase-statementview-rankselector-rank-normal' => "Label of the [[d:Wikidata:Glossary#Rank-normal|Normal Rank]] item within the menu that allows adjusting a [[d:Wikidata:Glossary#Statement|Statement's]] [[d:Wikidata:Glossary#Rank|Rank]].", - 'wikibase-statementview-rankselector-rank-deprecated' => "Label of the [[d:Wikidata:Glossary#Rank-deprecated|Deprecated Rank]] item within the menu that allows adjusting a [[d:Wikidata:Glossary#Statement|Statement's]] [[d:Wikidata:Glossary#Rank|Rank]].", + 'wikibase-statementview-rank-preferred' => 'Label of the [[d:Wikidata:Glossary#Rank-preferred|Preferred Rank]] item within the menu that allows adjusting a [[d:Wikidata:Glossary#Statement|Statement\'s]] [[d:Wikidata:Glossary#Rank|Rank]]. The message is additionally used as tooltip on the rank icon when the statement has assigned the Preferred rank.', + 'wikibase-statementview-rank-normal' => 'Label of the [[d:Wikidata:Glossary#Rank-normal|Normal Rank]] item within the menu that allows adjusting a [[d:Wikidata:Glossary#Statement|Statement\'s]] [[d:Wikidata:Glossary#Rank|Rank]]. The message is additionally used as tooltip on the rank icon when the statement has assigned the Normal Rank.', + 'wikibase-statementview-rank-deprecated' => 'Label of the [[d:Wikidata:Glossary#Rank-deprecated|Deprecated Rank]] item within the menu that allows adjusting a [[d:Wikidata:Glossary#Statement|Statement\'s]] [[d:Wikidata:Glossary#Rank|Rank]]. The message is additionally used as tooltip on the rank icon when the statement has assigned the Deprecated Rank.', 'wikibase-statementview-referencesheading-pendingcountersubject' => "Used in the heading for the references associated with a statement (see [[d:Wikidata:Glossary]]). The heading is giving information about how many references exist for that statement. This is just the label for the counter's subject: the number of references is not part of this message, and the word order is defined via {{msg-mw|wikibase-ui-pendingquantitycounter-nonpending}}. Parameters: diff --git a/repo/includes/ClaimHtmlGenerator.php b/repo/includes/ClaimHtmlGenerator.php index f2d7c5b..f8623b8 100644 --- a/repo/includes/ClaimHtmlGenerator.php +++ b/repo/includes/ClaimHtmlGenerator.php @@ -88,7 +88,8 @@ $serializedRank = ClaimSerializer::serializeRank( $claim->getRank() ); $rankHtml = wfTemplate( 'wb-rankselector', - 'wb-rankselector-' . $serializedRank + 'wb-rankselector-' . $serializedRank, + wfMessage( 'wikibase-statementview-rank-' . $serializedRank )->text() ); } -- To view, visit https://gerrit.wikimedia.org/r/98531 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I47b14dc24d6bb90e259d85e1c2a96d04aa106cc2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Henning Snater <henning.sna...@wikimedia.de> Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits