Pastakhov has uploaded a new change for review.
https://gerrit.wikimedia.org/r/249979
Change subject: Fix getting username for the top right menu button
......................................................................
Fix getting username for the top right menu button
data['username'] is:
* Name for logged in users
* IP for anonymous users
* text "Anonymous user" for anonymous users when $wgShowIPinHeader is false
Bug: T116130
Change-Id: I503a21bf7e7d2cfd1f7a4a41d1cb32ee7a4d0579
---
M i18n/en.json
M i18n/qqq.json
M src/BlueprintSkinTemplate.php
M templates/Skin.mustache
4 files changed, 14 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Blueprint
refs/changes/79/249979/1
diff --git a/i18n/en.json b/i18n/en.json
index 59dceee..a2a5f59 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -7,5 +7,6 @@
},
"skinname-blueprint": "Blueprint",
"blueprint-skin-desc": "Blueprint combines page actions, site
navigation, and the current page's Table of Contents into a navigation bar that
is only shown on-demand",
- "blueprint-left-nav": "* [[Main Page]]\n"
+ "blueprint-left-nav": "* [[Main Page]]\n",
+ "blueprint-anon-user-name": "Anonymous user"
}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 41123da..795b1d5 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -8,5 +8,6 @@
},
"skinname-blueprint": "{{optional}}",
"blueprint-skin-desc":
"{{desc|what=skin|name=Blueprint|url=https://www.mediawiki.org/wiki/Skin:Blueprint}}",
- "blueprint-left-nav": "List of links to show in the left navigation for
the skin\n\nTo translate the Main Page link, add your translation like this:
<code><nowiki>[[Main Page|Your Translation]]</nowiki></code>"
+ "blueprint-left-nav": "List of links to show in the left navigation for
the skin\n\nTo translate the Main Page link, add your translation like this:
<code><nowiki>[[Main Page|Your Translation]]</nowiki></code>",
+ "blueprint-anon-user-name": "Text of the top right menu button for
anonymous users when $wgShowIPinHeader is false"
}
diff --git a/src/BlueprintSkinTemplate.php b/src/BlueprintSkinTemplate.php
index e368bdc..bf12397 100644
--- a/src/BlueprintSkinTemplate.php
+++ b/src/BlueprintSkinTemplate.php
@@ -4,7 +4,15 @@
public function execute() {
$this->data['getdebughtml'] = MWDebug::getDebugHTML(
$this->getSkin()->getContext() );
$this->data['left_nav_sections'] = $this->getLeftNav();
- $this->data['username'] =
$this->data['personal_urls']['userpage'];
+ // Get username for the top right menu button
+ $personal_urls = $this->data['personal_urls'];
+ if ( isset( $personal_urls['userpage'] ) ) {
+ $this->data['username'] =
$personal_urls['userpage']['text'];
+ } elseif ( isset( $personal_urls['anonuserpage'] ) ) {
+ $this->data['username'] =
$personal_urls['anonuserpage']['text'];
+ } else {
+ $this->data['username'] = wfMessage(
'blueprint-anon-user-name' )->text();
+ }
// Make HTML for page status indicators, copied from
BaseTemplate::getIndicators().
$tmp = "<div class=\"mw-indicators\">\n";
foreach ( $this->data['indicators'] as $id => $content ) {
diff --git a/templates/Skin.mustache b/templates/Skin.mustache
index f260893..7fa4c9b 100644
--- a/templates/Skin.mustache
+++ b/templates/Skin.mustache
@@ -17,7 +17,7 @@
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="account-menu
dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
- {{ username.text }}
+ {{username}}
</a>
<ul class="dropdown-menu"
role="menu">
{{#each personal_urls}}
--
To view, visit https://gerrit.wikimedia.org/r/249979
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I503a21bf7e7d2cfd1f7a4a41d1cb32ee7a4d0579
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Blueprint
Gerrit-Branch: master
Gerrit-Owner: Pastakhov <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits