Thiemo Mättig (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370811 )

Change subject: Drop the "+1" in both "(5+1 references/sitelinks)" messages
......................................................................

Drop the "+1" in both "(5+1 references/sitelinks)" messages

We think this was overengeneered and want to remove this additional
blue number for a while now. Instead, the counter always shows the
total number now, no matter what item was already saved and what was
not.

Note that this counter is broken anyway. It gets confused when you
start removing and adding multiple items the same time.

Change-Id: Ieed4c65ff7000aab09e74aa152fd0a7968af3e33
---
M repo/i18n/en.json
M repo/i18n/qqq.json
M view/resources/jquery/wikibase/jquery.wikibase.sitelinklistview.js
M view/resources/jquery/wikibase/jquery.wikibase.statementview.js
M view/resources/jquery/wikibase/resources.php
M view/resources/wikibase/utilities/resources.php
M view/resources/wikibase/utilities/wikibase.utilities.ui.css
M view/resources/wikibase/utilities/wikibase.utilities.ui.js
M view/src/SiteLinksView.php
M view/src/StatementHtmlGenerator.php
M view/tests/phpunit/SiteLinksViewTest.php
11 files changed, 30 insertions(+), 94 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/11/370811/1

diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index dd5bd26..9ab1fd6 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -72,7 +72,7 @@
        "wikibase-statementsection-statements": "Statements",
        "wikibase-sitelinks": "Sitelinks",
        "wikibase-sitelinkgroupview-input-help-message": "Add a sitelink by 
specifying a site and a page of that site, edit or remove existing sitelinks.",
-       "wikibase-sitelinks-counter": "$1{{PLURAL:$2|0=|$3+$2$4}} 
{{PLURAL:$1|entry|entries}}",
+       "wikibase-sitelinks-counter": "$1 {{PLURAL:$1|entry|entries}}",
        "wikibase-sitelinks-empty": "No page is linked to this item.",
        "wikibase-sitelinks-special": "Other sites",
        "wikibase-badgeselector-badge-placeholder-title": "Click to assign a 
badge.",
@@ -90,7 +90,6 @@
        "wikibase-undo-firstrev": "Cannot undo the page's creation",
        "wikibase-undo-nocontent": "Cannot load content of revision $2 of page 
$1",
        "wikibase-summary-generated": "Summary (will be appended to an 
automatically generated summary):",
-       "wikibase-propertyedittool-counter-pending-tooltip": "{{PLURAL:$1|One 
value|$1 values}} not saved yet",
        "wikibase-disambiguation-title": "Disambiguation for \"$1\"",
        "wb-special-newitem-new-item-notification": "New item $1 created and 
redirected to its page. Back to $2.",
        "wikibase-aliases-input-help-message": "To make this entity easier to 
find, you can enter alternative names.",
@@ -105,8 +104,7 @@
        "wikibase-statementview-rank-tooltip-normal": "Valid value, though 
possibly historic",
        "wikibase-statementview-rank-deprecated": "Deprecated rank",
        "wikibase-statementview-rank-tooltip-deprecated": "Value is known to be 
wrong but (used to be) commonly believed",
-       "wikibase-statementview-references-counter": 
"$1{{PLURAL:$2|0=|$3+$2$4}} {{PLURAL:$1|reference|references}}",
-       "wikibase-statementview-referencesheading-pendingcountertooltip": 
"{{PLURAL:$1|One reference|$1 references}} not saved yet",
+       "wikibase-statementview-references-counter": "$1 
{{PLURAL:$1|reference|references}}",
        "wikibase-snakview-property-input-placeholder": "property",
        "wikibase-snakview-unsupportedsnaktype": "Snak of type \"$1\". Handling 
for this kind of Snak is not yet supported.",
        "wikibase-snakview-choosesnaktype": "Choose a value type.",
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index dea91a0..0b270c2 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -105,7 +105,7 @@
        "wikibase-statementsection-statements": "Heading for the list of 
statements giving specific information about the currently viewed item. See 
also the Wikidata glossary for [[m:d:Wikidata:Glossary#Statement|statements]] 
and [[m:d:Wikidata:Glossary#Item|item]].\n{{Identical|Statement}}",
        "wikibase-sitelinks": "Heading for the list of sitelinks to Wikipedia 
and other sister projects. This heading is only shown on mobile 
devices.\n{{Identical|Sitelink}}",
        "wikibase-sitelinkgroupview-input-help-message": "Bubble help message 
for editing a group of sitelinks which involves simultaneous editing and 
removing of existing sitelinks as well as adding new sitelinks to the group. 
See also the Wikidata glossary for 
[[d:Wikidata:Glossary#Sitelinks|sitelinks]].",
-       "wikibase-sitelinks-counter": "Used in the heading for a sitelink group 
(see [[d:Wikidata:Glossary]]). The heading is giving information about how many 
sitelinks exist in that sitelink group. This is the counter part of the heading 
without the parentheses. The number of unsaved sitelinks should only be 
displayed if it's not zero. In that case, it is wrapped by $3 and $4 to add an 
HTML tooltip.\n\nParameters:\n* $1 - the number of saved sitelinks\n* $2 - the 
number of unsaved sitelinks\n* $3 - placeholder for HTML wrapping the number of 
unsaved sitelinks, if displayed (beginning)\n* $4 - placeholder for HTML 
wrapping the number of unsaved sitelinks, if displayed 
(end)\n{{Identical|Entry}}",
+       "wikibase-sitelinks-counter": "Used in the heading for a sitelink group 
(see [[d:Wikidata:Glossary]]). The heading is giving information about how many 
sitelinks exist in that sitelink group. This is the counter part of the heading 
without the parentheses.\n\nParameters:\n* $1 - the number of saved 
sitelinks\n{{Identical|Entry}}",
        "wikibase-sitelinks-empty": "There are no sitelinks for any of the 
language specific pages on the given cluster.  See also the Wikidata glossary 
for [[d:Wikidata:Glossary#sitelinks|sitelinks]] and 
[[d:Wikidata:Glossary#sitelinks-title|title]].",
        "wikibase-sitelinks-special": "Section header for a section containing 
links to various sites being arbitrary 
grouped.\n{{related|Wikibase-sitelinks}}",
        "wikibase-badgeselector-badge-placeholder-title": "Text displayed when 
hovering the placeholder for an actual badge (HTML title attribute). The badge 
placeholder is visible when editing a sitelink that has no badge assigned. As 
soon as a badge is assigned, the placeholder is replaced by the badge. The 
placeholder is not visible while not editing a sitelink. See also the Wikidata 
glossary for [[d:Wikidata:Glossary#Sitelinks|sitelinks]] and 
[[d:Wikidata:Glossary#Badges|badges]] in particular.",
@@ -123,7 +123,6 @@
        "wikibase-undo-firstrev": "Message shown when the user attempts to undo 
the very first revision of a page, that is, the page's creation.",
        "wikibase-undo-nocontent": "Message shown when the content of one of 
the revisions needed for undo could not be loaded.\nThis may happen if there is 
an error in the storage backend, or if the respective revision has been hidden 
(oversighted) or deleted.\n* $1 - the title of the page\n* $2 - the revision 
ID",
        "wikibase-summary-generated": "Label of the field for the edit summary, 
shown when undoing an edit/restoring a revision of a Wikibase entity",
-       "wikibase-propertyedittool-counter-pending-tooltip": "Parameters:\n* $1 
is the number of elements not saved yet.",
        "wikibase-disambiguation-title": "Disambiguation page title. 
Parameters:\n* $1 - the label of the item being disambiguated",
        "wb-special-newitem-new-item-notification": "Message displayed when a 
new item was created on [[d:Special:NewItem]] and the user has been redirected 
to the new items page.\n\nParameters:\n* $1 - the new items id\n* $2 - a link 
back to the special page with \"special-newitem\" as label",
        "wikibase-aliases-input-help-message": "Bubble help message for 
entering the aliases of the data set used for a specific 
item.\n\nParameters:\n* $1 - (Unused) language 
name\n{{Related|Wikibase-input-help-message}}",
@@ -138,8 +137,7 @@
        "wikibase-statementview-rank-tooltip-normal": "Tooltip 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-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-rank-tooltip-deprecated": "Tooltip 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-references-counter": "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 the whole heading. The number of unsaved references should 
only be displayed if it's not zero. In that case, it is wrapped by $3 and $4 to 
add an HTML tooltip.\n\nParameters:\n* $1 - the number of saved references\n* 
$2 - the number of unsaved references\n* $3 - placeholder for HTML wrapping the 
number of unsaved references, if displayed (beginning)\n* $4 - placeholder for 
HTML wrapping the number of unsaved references, if displayed 
(end)\n{{Identical|Reference}}",
-       "wikibase-statementview-referencesheading-pendingcountertooltip": 
"Tooltip displayed in the references heading when there are references (see 
[[d:Wikidata:Glossary]]) in edit mode which are not saved 
yet.\n\nParameters:\n* $1 - the number of elements not saved yet",
+       "wikibase-statementview-references-counter": "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 the whole heading.\n\nParameters:\n* $1 - the number of 
saved references\n{{Identical|Reference}}",
        "wikibase-snakview-property-input-placeholder": "Placeholder message 
that is initially displayed within the property input element when adding a new 
snak. See also [[d:Wikidata:Glossary]].\n{{Identical|Property}}",
        "wikibase-snakview-unsupportedsnaktype": "Parameters:\n* $1 - snak 
type\nSee [[d:Wikidata:Glossary#Snak]].\n\nSnaks are the basic information 
structures used to describe Entities in Wikidata. They are an integral part of 
each Statement (which can be viewed as collection of Snaks about an Entity, 
together with a list of references).\n\nEx:\n*Berlin (subject) has a population 
(property) of 3499879 (value).\n*Georgia (subject) has the capital (property) 
Tbilisi (value).\n*Gandhi (subject) was born on (property) 2 October 1869 
(value).",
        "wikibase-snakview-choosesnaktype": "Message prompting the user to 
select a Snak type (see [[d:Wikidata:Glossary]]) when adding or editing a 
Snak.\n\nSince a default Snak type should always be selected when adding a 
Snak, the message is visible on rare occasions only.\n\nSince \"Snak\" or 
\"Snak type\" does not express any meaning for the user, these phrases should 
be avoided in the message.",
diff --git a/view/resources/jquery/wikibase/jquery.wikibase.sitelinklistview.js 
b/view/resources/jquery/wikibase/jquery.wikibase.sitelinklistview.js
index c9d6f4f..73e8e2e 100644
--- a/view/resources/jquery/wikibase/jquery.wikibase.sitelinklistview.js
+++ b/view/resources/jquery/wikibase/jquery.wikibase.sitelinklistview.js
@@ -282,14 +282,11 @@
                                $items = listview.items().filter( function () {
                                        var sitelinkview = lia.liInstance( $( 
this ) );
                                        return !sitelinkview.isEmpty();
-                               } ),
-                               $pendingItems = $items.filter( '.wb-new' );
+                               } );
 
-                       var $counterMsg = wb.utilities.ui.buildPendingCounter(
-                               $items.length - $pendingItems.length,
-                               $pendingItems.length,
+                       var $counterMsg = wb.utilities.ui.buildCounter(
                                'wikibase-sitelinks-counter',
-                               
'wikibase-propertyedittool-counter-pending-tooltip'
+                               $items.length
                        );
 
                        // Counter result should be wrapped in parentheses, 
which is another message. Since the
diff --git a/view/resources/jquery/wikibase/jquery.wikibase.statementview.js 
b/view/resources/jquery/wikibase/jquery.wikibase.statementview.js
index 5a78332..08f4f82 100644
--- a/view/resources/jquery/wikibase/jquery.wikibase.statementview.js
+++ b/view/resources/jquery/wikibase/jquery.wikibase.statementview.js
@@ -577,20 +577,17 @@
                 * @private
                 */
                _drawReferencesCounter: function () {
-                       var numberOfValues = 0,
-                               numberOfPendingValues = 0;
+                       var numberOfValues = 0;
 
                        if ( this._referencesListview ) {
-                               numberOfPendingValues = 
this._referencesListview.items().filter( '.wb-reference-new' ).length;
-                               numberOfValues = 
this._referencesListview.items().length - numberOfPendingValues;
+                               numberOfValues = 
this._referencesListview.items().length;
                        }
 
                        // build a nice counter, displaying fixed and pending 
values:
-                       var $counterMsg = wb.utilities.ui.buildPendingCounter(
-                               numberOfValues,
-                               numberOfPendingValues,
+                       var $counterMsg = wb.utilities.ui.buildCounter(
                                'wikibase-statementview-references-counter',
-                               
'wikibase-statementview-referencesheading-pendingcountertooltip' );
+                               numberOfValues
+                       );
 
                        // update counter, don't touch the toggle!
                        this.$refsHeading.find( '.ui-toggler-label' 
).empty().append( $counterMsg );
diff --git a/view/resources/jquery/wikibase/resources.php 
b/view/resources/jquery/wikibase/resources.php
index 4e7e2e9..05a3893 100644
--- a/view/resources/jquery/wikibase/resources.php
+++ b/view/resources/jquery/wikibase/resources.php
@@ -356,7 +356,6 @@
                        'messages' => [
                                'parentheses',
                                'wikibase-sitelinks-counter',
-                               
'wikibase-propertyedittool-counter-pending-tooltip',
                        ],
                ],
 
@@ -433,7 +432,6 @@
                                'wikibase-statementview-rank-deprecated',
                                
'wikibase-statementview-rank-tooltip-deprecated',
                                'wikibase-statementview-references-counter',
-                               
'wikibase-statementview-referencesheading-pendingcountertooltip',
                        ],
                ],
 
diff --git a/view/resources/wikibase/utilities/resources.php 
b/view/resources/wikibase/utilities/resources.php
index b73b522..4966c12 100644
--- a/view/resources/wikibase/utilities/resources.php
+++ b/view/resources/wikibase/utilities/resources.php
@@ -46,7 +46,6 @@
                        ],
                        'dependencies' => [
                                'wikibase',
-                               'jquery.tipsy',
                                'mediawiki.language',
                                'mediawiki.jqueryMsg'
                        ],
diff --git a/view/resources/wikibase/utilities/wikibase.utilities.ui.css 
b/view/resources/wikibase/utilities/wikibase.utilities.ui.css
index bc07d9e..851a78f 100644
--- a/view/resources/wikibase/utilities/wikibase.utilities.ui.css
+++ b/view/resources/wikibase/utilities/wikibase.utilities.ui.css
@@ -48,15 +48,7 @@
 
 /****** /TOGGLE ******/
 
-/****** PENDING-COUNTER: wb.utilities.ui.buildPendingCounter ******/
-
+/* TODO: Legacy name kept for compatibility reasons. It's not "pending" any 
more. */
 .wb-ui-pendingcounter {
        white-space: nowrap;
 }
-.wb-ui-pendingcounter span { /* the +1 part in the counter */
-       margin-left: 0.25em;
-       color: #36c;
-       font-weight: bold;
-}
-
-/****** /PENDING-COUNTER ******/
diff --git a/view/resources/wikibase/utilities/wikibase.utilities.ui.js 
b/view/resources/wikibase/utilities/wikibase.utilities.ui.js
index b8accbe..f80ee62 100644
--- a/view/resources/wikibase/utilities/wikibase.utilities.ui.js
+++ b/view/resources/wikibase/utilities/wikibase.utilities.ui.js
@@ -6,64 +6,27 @@
        'use strict';
 
        /**
-        * Whether page has rtl context.
-        * @type {boolean}
-        */
-       var IS_RTL = false;
-
-       $( function () {
-               // have to wait for document to be loaded for this, otherwise 
'rtl' might not yet be there!
-               IS_RTL = $( 'body' ).hasClass( 'rtl' );
-       } );
-
-       /**
         * UI related utilities required by 'Wikibase' extension.
         * @type {Object}
         */
-       wb.utilities.ui = {};
+       wb.utilities.ui = wb.utilities.ui || {};
 
        /**
-        * Creates a counter suited for displaying a number of a fixed quantity 
plus a number of a
-        * pending quantity whereas the quantity can be 0 or higher. If the 
pending quantity is 0, it
-        * will not be shown and only the fixed quantity will be displayed, 
otherwise it will be
-        * displayed as "fixedQuantity +pendingQuantity kindOfQuantity", e.g. 
"32 +2"
-        *
-        * @param {number} fixedQuantity
-        * @param {number} pendingQuantity
-        * @param {string} mainMessage Message name of a message for the whole 
counter. The message
-        *        will receive as parameter $1 the fixed quantity, and as 
parameter $2 the number of
-        *        pending items.
-        * @param {string} pendingQuantityTooltipMessage Message string of a 
message which will be
-        *        displayed in the tooltip which will be appended to the number 
of pending quantity.
-        *        Parameter $1 will be the number of pending quantity.
-        * @return {jQuery} The formatted counter output. Does not have a root 
node, collection of
-        *         multiple DOM elements.
+        * @param {string} messageKey Name of a message for the counter. The 
message will receive the
+        *  quantity as parameter $1.
+        * @param {number} quantity
+        * @return {jQuery} The formatted counter output.
         */
-       wb.utilities.ui.buildPendingCounter = function (
-               fixedQuantity, pendingQuantity, mainMessage, 
pendingQuantityTooltipMessage
-       ) {
-               var fqNumMsg = mw.language.convertNumber( fixedQuantity ),
-                       pqNumMsg = mw.language.convertNumber( pendingQuantity );
-
-               var $msg = $( '<span/>' ).html(
-                       mw.message( mainMessage, fqNumMsg, pqNumMsg, 
'<tooltip>', '</tooltip>' )
-                               .escaped()
-                               .replace( 
/&lt;tooltip&gt;(.*?)&lt;\/tooltip&gt;/g, '<span>$1</span>' )
-               );
-               var $msgSpan = $msg.children( 'span' );
-
-               if ( $msgSpan.length > 0 ) {
-                       $msgSpan.attr(
-                               'title', // the message displayed in the tooltip
-                               mw.msg( pendingQuantityTooltipMessage, pqNumMsg 
)
+       wb.utilities.ui.buildCounter = function ( messageKey, quantity ) {
+               return $( '<span/>' )
+                       // TODO: Legacy name kept for compatibility reasons. 
It's not "pending" any more.
+                       .addClass( 'wb-ui-pendingcounter' )
+                       .text(
+                               // Messages:
+                               // wikibase-sitelinks-counter
+                               // wikibase-statementview-references-counter
+                               mw.msg( messageKey, mw.language.convertNumber( 
quantity ) )
                        );
-                       $msgSpan.tipsy( {
-                               gravity: ( IS_RTL ? 'ne' : 'nw' )
-                       } );
-               }
-
-               $msg.addClass( 'wb-ui-pendingcounter' );
-               return $msg;
        };
 
 }( mediaWiki, wikibase, jQuery ) );
diff --git a/view/src/SiteLinksView.php b/view/src/SiteLinksView.php
index cb6b864..5f535c8 100644
--- a/view/src/SiteLinksView.php
+++ b/view/src/SiteLinksView.php
@@ -173,9 +173,6 @@
                                        'wikibase-sitelinks-counter',
                                        [
                                                
$this->numberLocalizer->localizeNumber( $count ),
-                                               
$this->numberLocalizer->localizeNumber( 0 ),
-                                               '',
-                                               ''
                                        ]
                                )
                        ] ) ),
diff --git a/view/src/StatementHtmlGenerator.php 
b/view/src/StatementHtmlGenerator.php
index c880169..40c119b 100644
--- a/view/src/StatementHtmlGenerator.php
+++ b/view/src/StatementHtmlGenerator.php
@@ -198,9 +198,6 @@
                                'wikibase-statementview-references-counter',
                                [
                                        $this->numberLocalizer->localizeNumber( 
$referenceCount ),
-                                       $this->numberLocalizer->localizeNumber( 
0 ),
-                                       '',
-                                       ''
                                ]
                        ) );
                }
diff --git a/view/tests/phpunit/SiteLinksViewTest.php 
b/view/tests/phpunit/SiteLinksViewTest.php
index 115af48..8a6a824 100644
--- a/view/tests/phpunit/SiteLinksViewTest.php
+++ b/view/tests/phpunit/SiteLinksViewTest.php
@@ -47,7 +47,7 @@
                        '<h2 id="sitelinks" 
class="wikibase-sitelinks">(wikibase-sitelinks)</h2>'
                        . '<GROUP data="wikipedia" class="">'
                        . '<h3 
id="sitelinks-wikipedia">(wikibase-sitelinks-wikipedia)'
-                       . '(parentheses: (wikibase-sitelinks-counter: 0, 0, , 
))</h3>'
+                       . '(parentheses: (wikibase-sitelinks-counter: 0))</h3>'
                        . '</GROUP>',
                        $html
                );
@@ -63,7 +63,7 @@
                        '<h2 id="sitelinks" 
class="wikibase-sitelinks">(wikibase-sitelinks)</h2>'
                        . '<GROUP data="wikipedia" class="">'
                        . '<h3 
id="sitelinks-wikipedia">(wikibase-sitelinks-wikipedia)'
-                       . '(parentheses: (wikibase-sitelinks-counter: 1, 0, , 
))</h3>'
+                       . '(parentheses: (wikibase-sitelinks-counter: 1))</h3>'
                        . '<LINK id="enwiki" title="&lt;LANG&gt;">'
                        . 'enwiki: <PAGE href="#enwiki" lang="en" 
dir="auto">Title</PAGE>'
                        . '</LINK>'
@@ -82,7 +82,7 @@
                        '<h2 id="sitelinks" 
class="wikibase-sitelinks">(wikibase-sitelinks)</h2>'
                        . '<GROUP data="special" class="">'
                        . '<h3 
id="sitelinks-special">(wikibase-sitelinks-special)'
-                       . '(parentheses: (wikibase-sitelinks-counter: 1, 0, , 
))</h3>'
+                       . '(parentheses: (wikibase-sitelinks-counter: 1))</h3>'
                        . '<LINK id="specialwiki" 
title="(wikibase-sitelinks-sitename-specialwiki)">'
                        . 'specialwiki: <PAGE href="#specialwiki" lang="en" 
dir="auto">Title</PAGE>'
                        . '</LINK>'

-- 
To view, visit https://gerrit.wikimedia.org/r/370811
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieed4c65ff7000aab09e74aa152fd0a7968af3e33
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
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

Reply via email to