jenkins-bot has submitted this change and it was merged. (
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, 33 insertions(+), 5 deletions(-)
Approvals:
jenkins-bot: Verified
Thiemo Kreuz (WMDE): Looks good to me, approved
diff --git a/repo/includes/Actions/ViewEntityAction.php
b/repo/includes/Actions/ViewEntityAction.php
index 515b0b0..b13a12c 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,19 @@
if ( $this->isDiff() ) {
if ( isset( $meta['title'] ) ) {
- $this->setPageTitle( $outputPage,
$meta['title'] );
+ $configVars = $outputPage->getJsConfigVars();
+ if ( !isset( $configVars['wbEntityId'] ) ) {
+ wfLogWarning( "'wbEntityId' has not
been found." );
+ $entityId = null;
+ } else {
+ $entityId = $configVars['wbEntityId'];
+ }
+
+ $this->setDiffPageTitle(
+ $outputPage,
+ $meta['title'],
+ $entityId
+ );
}
// No description, social media tags, or any search
engine optimization for diffs
@@ -116,8 +129,23 @@
/**
* @param OutputPage $outputPage
* @param string $titleText
+ * @param string $entityIdSerialization
*/
- private function setPageTitle( OutputPage $outputPage, $titleText ) {
+ private function setDiffPageTitle(
+ OutputPage $outputPage,
+ $titleText,
+ $entityIdSerialization
+ ) {
+ if ( $entityIdSerialization !== null ) {
+ $id = ' ' . Html::element(
+ 'span',
+ [ 'class' => 'wikibase-title-id' ],
+ $this->msg( 'parentheses' )->plaintextParams(
$entityIdSerialization )
+ );
+ } else {
+ $id = '';
+ }
+
// 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 +157,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: merged
Gerrit-Change-Id: I6ba5c76c0812818915110fba2167025a6a7e4ae2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: Thiemo Kreuz (WMDE) <[email protected]>
Gerrit-Reviewer: WMDE-leszek <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits