Ladsgroup has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403358 )

Change subject: Show EntityId in diff page too
......................................................................

Show EntityId in diff page too

Bug: T181077
Change-Id: I6ba5c76c0812818915110fba2167025a6a7e4ae2
---
M repo/includes/Actions/ViewEntityAction.php
M view/resources/wikibase/wikibase.less
2 files changed, 20 insertions(+), 5 deletions(-)


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

diff --git a/repo/includes/Actions/ViewEntityAction.php 
b/repo/includes/Actions/ViewEntityAction.php
index 515b0b0..62aa0da 100644
--- a/repo/includes/Actions/ViewEntityAction.php
+++ b/repo/includes/Actions/ViewEntityAction.php
@@ -3,6 +3,7 @@
 namespace Wikibase;
 
 use Article;
+use Html;
 use MWException;
 use OutputPage;
 use ViewAction;
@@ -91,7 +92,11 @@
 
                if ( $this->isDiff() ) {
                        if ( isset( $meta['title'] ) ) {
-                               $this->setPageTitle( $outputPage, 
$meta['title'] );
+                               $this->setDiffPageTitle(
+                                       $outputPage,
+                                       $meta['title'],
+                                       
$outputPage->getJsConfigVars()['wbEntityId']
+                               );
                        }
 
                        // No description, social media tags, or any search 
engine optimization for diffs
@@ -116,8 +121,18 @@
        /**
         * @param OutputPage $outputPage
         * @param string $titleText
+        * @param string $entityIdSerialization
         */
-       private function setPageTitle( OutputPage $outputPage, $titleText ) {
+       private function setDiffPageTitle(
+               OutputPage $outputPage,
+               $titleText,
+               $entityIdSerialization
+       ) {
+               $id = Html::element(
+                       'span',
+                       [ 'class' => 'wikibase-title-id' ],
+                       $this->msg( 'parentheses' )->plaintextParams( 
$entityIdSerialization )
+               );
                // Escaping HTML characters in order to retain original label 
that may contain HTML
                // characters. This prevents having characters evaluated or 
stripped via
                // OutputPage::setPageTitle:
@@ -129,7 +144,7 @@
                                // or should set the attribute of the h1 to 
correct direction.
                                // Still note that the direction is "auto" so 
guessing should
                                // give the right direction in most cases.
-                       )->plaintextParams( htmlspecialchars( $titleText ) )
+                       )->plaintextParams( htmlspecialchars( $titleText ) . ' 
' . $id )
                );
        }
 
diff --git a/view/resources/wikibase/wikibase.less 
b/view/resources/wikibase/wikibase.less
index bbbdeaf..c268b06 100644
--- a/view/resources/wikibase/wikibase.less
+++ b/view/resources/wikibase/wikibase.less
@@ -11,7 +11,7 @@
        position: fixed;
 }
 
-h1 .wikibase-title .wikibase-title-id {
+h1 .wikibase-title-id {
        color: #72777d;
        font-size: 0.6em;
        margin-left: 0.4em;
@@ -30,7 +30,7 @@
        color: #222;
 }
 
-h1 .wikibase-title .wikibase-title-id:before {
+h1 .wikibase-title-id:before {
        /* Prevent id being hidden in ellipsis on very long labels: */
        content: ' ';
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ba5c76c0812818915110fba2167025a6a7e4ae2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to