Skip to content

Commit 0186d28

Browse files
committed
Use a different template for the sidebar to display the user's trophies
1 parent 9d0a378 commit 0186d28

File tree

3 files changed

+43
-42
lines changed

3 files changed

+43
-42
lines changed
Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,12 @@
1-
{if $boxPosition == 'sidebarLeft' || $boxPosition == 'sidebarRight'}
2-
<ol class="sidebarList">
3-
{foreach from=$boxUserTrophyList item=boxUserTrophy}
4-
<li class="sidebarListItem">
5-
<div class="sidebarListItem__avatar">
6-
{unsafe:$boxUserTrophy->getTrophy()->renderTrophy(32)}
7-
</div>
1+
<ol class="containerBoxList trophyCategoryList tripleColumned">
2+
{foreach from=$boxUserTrophyList item=boxUserTrophy}
3+
<li class="box64">
4+
<div>{unsafe:$boxUserTrophy->getTrophy()->renderTrophy(64)}</div>
85

9-
<div class="sidebarListItem__content">
10-
<h3 class="sidebarListItem__title">
11-
<a href="{$boxUserTrophy->getTrophy()->getLink()}" class="sidebarListItem__link">
12-
{$boxUserTrophy->getTrophy()->getTitle()}
13-
</a>
14-
</h3>
15-
</div>
16-
17-
<div class="sidebarListItem__meta">
18-
<div class="sidebarListItem__meta__author">
19-
{user object=$boxUserTrophy->getUserProfile() tabindex='-1'}
20-
</div>
21-
<div class="sidebarListItem__meta__time">
22-
{time time=$boxUserTrophy->time}
23-
</div>
24-
</div>
25-
</li>
26-
{/foreach}
27-
</ol>
28-
{else}
29-
<ol class="containerBoxList trophyCategoryList tripleColumned">
30-
{foreach from=$boxUserTrophyList item=boxUserTrophy}
31-
<li class="box64">
32-
<div>{@$boxUserTrophy->getTrophy()->renderTrophy(64)}</div>
33-
34-
<div class="sidebarItemTitle">
35-
<h3><a href="{$boxUserTrophy->getTrophy()->getLink()}">{$boxUserTrophy->getTrophy()->getTitle()}</a></h3>
36-
<small>{if !$boxUserTrophy->getDescription()|empty}<p>{@$boxUserTrophy->getDescription()}</p>{/if}<p>{user object=$boxUserTrophy->getUserProfile()} <span class="separatorLeft">{@$boxUserTrophy->time|time}</span></p></small>
37-
</div>
38-
</li>
39-
{/foreach}
40-
</ol>
41-
{/if}
6+
<div class="sidebarItemTitle">
7+
<h3><a href="{$boxUserTrophy->getTrophy()->getLink()}">{$boxUserTrophy->getTrophy()->getTitle()}</a></h3>
8+
<small>{if !$boxUserTrophy->getDescription()|empty}<p>{unsafe:$boxUserTrophy->getDescription()}</p>{/if}<p>{user object=$boxUserTrophy->getUserProfile()} <span class="separatorLeft">{time time=$boxUserTrophy->time}</span></p></small>
9+
</div>
10+
</li>
11+
{/foreach}
12+
</ol>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<ol class="sidebarList">
2+
{foreach from=$boxUserTrophyList item=boxUserTrophy}
3+
<li class="sidebarListItem">
4+
<div class="sidebarListItem__avatar">
5+
{unsafe:$boxUserTrophy->getTrophy()->renderTrophy(32)}
6+
</div>
7+
8+
<div class="sidebarListItem__content">
9+
<h3 class="sidebarListItem__title">
10+
<a href="{$boxUserTrophy->getTrophy()->getLink()}" class="sidebarListItem__link">
11+
{$boxUserTrophy->getTrophy()->getTitle()}
12+
</a>
13+
</h3>
14+
</div>
15+
16+
<div class="sidebarListItem__meta">
17+
<div class="sidebarListItem__meta__author">
18+
{user object=$boxUserTrophy->getUserProfile() tabindex='-1'}
19+
</div>
20+
<div class="sidebarListItem__meta__time">
21+
{time time=$boxUserTrophy->time}
22+
</div>
23+
</div>
24+
</li>
25+
{/foreach}
26+
</ol>

wcfsetup/install/files/lib/system/box/UserTrophyListBoxController.class.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,13 @@ public function getTemplate()
150150

151151
UserProfileRuntimeCache::getInstance()->cacheObjectIDs(\array_unique($userIDs));
152152

153-
return WCF::getTPL()->render('wcf', 'boxUserTrophyList', [
153+
$templateName = 'boxUserTrophyList';
154+
if ($this->getBox()->position == 'sidebarLeft' || $this->getBox()->position == 'sidebarRight') {
155+
$templateName = 'boxUserTrophyListSidebar';
156+
}
157+
158+
return WCF::getTPL()->render('wcf', $templateName, [
154159
'boxUserTrophyList' => $this->objectList,
155-
'boxPosition' => $this->box->position,
156160
]);
157161
}
158162
}

0 commit comments

Comments
 (0)