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

Change subject: Allowing on-site override of default logged-in/anon icons, 
cleanup
......................................................................

Allowing on-site override of default logged-in/anon icons, cleanup

This commit allows the default logged-in/anon icons to be overriden through two 
system messages (refreshed-icon-logged-in and refreshed-icon-logged-out). If 
the appropriate message for the current situation is not empty (and 
SocialProfile is not installed), the message's contents are placed in the src 
of the avatar img element, overriding the default WikiFont logged-in/anon 
icons. The avatar logic has also been cleaned up to reduce redundancy. Finally, 
the avatar img element no longer has a hard-coded width attribute as this is 
already handled with CSS (which allows for more on-site customization).

Bug: T163961
Change-Id: I7851c5f63282b951c6b0b5baa59f84f8fa088d48
---
M Refreshed.skin.php
M skin.json
2 files changed, 28 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Refreshed 
refs/changes/25/351125/1

diff --git a/Refreshed.skin.php b/Refreshed.skin.php
index 851aa06..37f30c0 100644
--- a/Refreshed.skin.php
+++ b/Refreshed.skin.php
@@ -296,35 +296,44 @@
 
                        <section id="user-info">
                                <a class="header-button collapse-trigger">
+                                       <span class="arrow wikiglyph 
wikiglyph-caret-down"></span>
                                        <?php
-                                       $avatarImage = '';
+                                       $avatarElement = '';
+                                       //display the user's username if logged 
in, otherwise display the "login" message
+                                       $usernameText = $this->data['loggedin'] 
? $user->getName() : $this->getMsg( 'login' )->text();
                                        // Show the user's avatar image in the 
top left drop-down
                                        // menu, but only if SocialProfile is 
installed
                                        if ( class_exists( 'wAvatar' ) ) {
                                                $avatar = new wAvatar( 
$user->getId(), 'l' );
-                                               $avatarImage = 
$avatar->getAvatarURL( array(
-                                                       'width' => 30,
+                                               $avatarElement = 
$avatar->getAvatarURL( array(
                                                        'class' => 'avatar'
                                                ) );
-                                               ?>
-                                               <span class="arrow wikiglyph 
wikiglyph-caret-down"></span>
-                                               <?php echo $avatarImage ?>
-                                               <span class="username"><?php 
echo $user->getName() ?></span>
-                                       <?php
                                        } elseif ( $this->data['loggedin'] ) { 
// if no SocialProfile but user is logged in
-                                               ?>
-                                               <span class="arrow wikiglyph 
wikiglyph-caret-down"></span>
-                                               <span 
class="avatar-no-socialprofile wikiglyph wikiglyph-user-smile"></span>
-                                               <span class="username 
username-nosocialprofile-registered"><?php echo $user->getName() ?></span>
-                                       <?php
+                                               if ( $this->getMsg( 
'refreshed-icon-logged-in' )->isBlank() ) { //if wiki has not set a custom 
image for logged in users
+                                                       $avatarElement = 
Html::element( 'span', array(
+                                                               'class' => 
'avatar-no-socialprofile wikiglyph wikiglyph-user-smile'
+                                                       ) );
+                                               } else { //if wiki has set 
custom image for logged in users
+                                                       $avatarElement = 
Html::element( 'img', array(
+                                                               'src' => 
$this->getMsg( 'refreshed-icon-logged-in' )->escaped(),
+                                                               'class' => 
'avatar'
+                                                       ) );
+                                               }
                                        } else { // if no SocialProfile but 
user is not logged in
-                                               ?>
-                                               <span class="arrow wikiglyph 
wikiglyph-caret-down"></span>
-                                               <span 
class="avatar-no-socialprofile wikiglyph wikiglyph-user-sleep"></span>
-                                               <span class="username 
username-nosocialprofile-anon"><?php echo $this->getMsg( 'login' )->text() 
?></span>
-                                               <?php
+                                               if ( $this->getMsg( 
'refreshed-icon-logged-out' )->isBlank() ) { //if wiki has not set a custom 
image for logged out users
+                                                       $avatarElement = 
Html::element( 'span', array(
+                                                               'class' => 
'avatar-no-socialprofile wikiglyph wikiglyph-user-sleep'
+                                                       ) );
+                                               } else { //if wiki has set 
custom image for logged in users
+                                                       $avatarElement = 
Html::element( 'img', array(
+                                                               'src' => 
$this->getMsg( 'refreshed-icon-logged-out' )->escaped(),
+                                                               'class' => 
'avatar'
+                                                       ) );
+                                               }
                                        }
+                                       echo $avatarElement;
                                        ?>
+                                       <span class="username"><?php echo 
$usernameText ?></span>
                                </a>
                                <ul class="header-menu collapsible collapsed">
                                        <?php
diff --git a/skin.json b/skin.json
index 2b3b139..a23bfcf 100644
--- a/skin.json
+++ b/skin.json
@@ -1,6 +1,6 @@
 {
        "name": "Refreshed",
-       "version": "3.1.7",
+       "version": "3.1.8",
        "author": [
                "Adam Carter",
                "Drew1200",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7851c5f63282b951c6b0b5baa59f84f8fa088d48
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Refreshed
Gerrit-Branch: master
Gerrit-Owner: MtMNC <[email protected]>

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

Reply via email to