Add showTooltip option for trophies
authorJoshua Rüsweg <josh@bastelstu.be>
Tue, 1 Aug 2017 12:08:35 +0000 (14:08 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Tue, 1 Aug 2017 12:08:35 +0000 (14:08 +0200)
See #2315

com.woltlab.wcf/templates/messageSidebar.tpl
com.woltlab.wcf/templates/trophyBadge.tpl
com.woltlab.wcf/templates/trophyImage.tpl
com.woltlab.wcf/templates/user.tpl
com.woltlab.wcf/templates/userProfilePreview.tpl
wcfsetup/install/files/lib/data/trophy/Trophy.class.php

index f9ccc323b42d9f84cb2d65705a2adb2ea4ba4949..09603ed6d91553088621eeb817fc020a4e3d9f61 100644 (file)
@@ -49,7 +49,7 @@
                                <div class="specialTrophyContainer">
                                        <ul>
                                                {foreach from=$userProfile->getSpecialTrophies() item=trophy}
-                                                       <li><a href="{@$trophy->getLink()}">{@$trophy->renderTrophy(32)}</a></li>
+                                                       <li><a href="{@$trophy->getLink()}">{@$trophy->renderTrophy(32, true)}</a></li>
                                                {/foreach}
                                        </ul>
                                </div>
index 6e305d12409c922ad16c3fdcde8cd1f8244b31f0..884fa4fb8e6ff6c10016dbaf41f09ca3f33ad619 100644 (file)
@@ -1,6 +1,6 @@
 <span 
-       class="icon icon{$size} fa-{$trophy->iconName} trophyIcon jsTooltip
+       class="icon icon{$size} fa-{$trophy->iconName} trophyIcon{if $showTooltip} jsTooltip{/if}
        style="color: {$trophy->iconColor}; background-color: {$trophy->badgeColor}"
        data-trophy-id="{$trophy->trophyID}"
-       title="{$trophy->getTitle()}"
+       {if $showTooltip}title="{$trophy->getTitle()}"{/if}
 ></span>
index 38bc00fccb1641362ec4b349dfc2659724b95398..a5ca927d6184ad6770518353a75f3ec021d40523 100644 (file)
@@ -1,7 +1,7 @@
 <img
        src="{@$__wcf->getPath()}images/trophy/{$trophy->iconFile}"
        style="width:{$size}px;height:{$size}px"
-       title="{$trophy->getTitle()}"
-       class="jsTooltip trophyIcon"
+       {if $showTooltip}title="{$trophy->getTitle()}"{/if}
+       class="trophyIcon{if $showTooltip} jsTooltip{/if}"
        data-trophy-id="{$trophy->getObjectID()}"
 />
index 4d412e689603aa2378c942d6ee6601d16017636c..b8e45fb4b36e668526aecb03108a9badc16346eb 100644 (file)
                                        <div class="specialTrophyUserContainer">
                                                <ul>
                                                        {foreach from=$user->getSpecialTrophies() item=trophy}
-                                                               <li><a href="{@$trophy->getLink()}">{@$trophy->renderTrophy(32)}</a></li>
+                                                               <li><a href="{@$trophy->getLink()}">{@$trophy->renderTrophy(32, true)}</a></li>
                                                        {/foreach}
                                                </ul>
                                        </div>
index a115d092218f534ef547349d0e8451321cdd5cbc..c71da8221fb1e4ca366ba6abbbeb027b8270d1a2 100644 (file)
@@ -15,7 +15,7 @@
                                <div class="specialTrophyUserContainer">
                                        <ul>
                                                {foreach from=$user->getSpecialTrophies() item=trophy}
-                                                       <li><a href="{@$trophy->getLink()}">{@$trophy->renderTrophy(32)}</a></li>
+                                                       <li><a href="{@$trophy->getLink()}">{@$trophy->renderTrophy(32, true)}</a></li>
                                                {/foreach}
                                        </ul>
                                </div>
index 27a6281f79d86e6f149287f06e8f66b99e58a85e..ac86bbf9daccf41a2aee3f07649bfb0a6ab40a4f 100644 (file)
@@ -72,14 +72,16 @@ class Trophy extends DatabaseObject implements ITitledLinkObject, IRouteControll
         * Renders a trophy. 
         * 
         * @param       integer         $size
+        * @param       boolean         $showTooltip
         * @return      string
         */
-       public function renderTrophy($size = self::DEFAULT_SIZE) {
+       public function renderTrophy($size = self::DEFAULT_SIZE, $showTooltip = false) {
                switch ($this->type) {
                        case self::TYPE_IMAGE: {
                                return WCF::getTPL()->fetch('trophyImage', 'wcf', [
                                        'size' => $size,
-                                       'trophy' => $this
+                                       'trophy' => $this,
+                                       'showTooltip' => $showTooltip
                                ], true);
                                break;
                        }
@@ -87,14 +89,16 @@ class Trophy extends DatabaseObject implements ITitledLinkObject, IRouteControll
                        case self::TYPE_BADGE:
                                return WCF::getTPL()->fetch('trophyBadge', 'wcf', [
                                        'size' => $size,
-                                       'trophy' => $this
+                                       'trophy' => $this,
+                                       'showTooltip' => $showTooltip
                                ], true);
                        break;
                        
                        default: 
                                $parameters = [
                                        'renderedTemplate' => null, 
-                                       'size' => $size
+                                       'size' => $size,
+                                       'showTooltip' => $showTooltip
                                ];
                                
                                EventHandler::getInstance()->fireAction($this, 'renderTrophy', $parameters);