--- /dev/null
+{assign var='topReaction' value=$__wcf->getReactionHandler()->getTopReaction($cachedReactions)}
+{if $topReaction}
+ {if $render === 'icon'}
+ <span class="jsTooltip" title="{lang reaction=$topReaction[reaction] count=$topReaction[count]}wcf.like.reaction.topReaction{/lang}">{@$topReaction[reaction]->renderIcon()}</span>
+ {elseif $render === 'tiny'}
+ <span class="topReactionTiny jsTooltip" title="{lang reaction=$topReaction[reaction] count=$topReaction[count]}wcf.like.reaction.topReaction{/lang}">
+ {@$topReaction[reaction]->renderIcon()} {#$topReaction[count]}
+ </span>
+ {elseif $render === 'short'}
+ <span class="topReactionShort jsTooltip" title="{lang reaction=$topReaction[reaction] count=$topReaction[count]}wcf.like.reaction.topReaction{/lang}">
+ {@$topReaction[reaction]->renderIcon()} × {#$topReaction[count]}
+ </span>
+ {elseif $render === 'full'}
+ <span class="topReactionFull">
+ {@$topReaction[reaction]->renderIcon()} {lang reaction=$topReaction[reaction] count=$topReaction[count]}wcf.like.reaction.topReaction{/lang}
+ </span>
+ {/if}
+{/if}
<div class="contentItemMetaIcons">
{if MODULE_LIKE && $__wcf->getSession()->getPermission('user.like.canViewLike') && $article->cumulativeLikes}
<div class="contentItemMetaIcon">
- <span class="icon icon16 fa-smile-o"></span>
- <span aria-label="{lang reactions=$article->cumulativeLikes}wcf.like.reaction.label{/lang}">
- {#$article->cumulativeLikes}
- </span>
+ {include file='__topReaction' cachedReactions=$article->cachedReactions render='short'}
</div>
{/if}
<div class="contentItemMetaIcon">
{elseif $boxSortField == 'comments'}
{$boxArticle->getDiscussionProvider()->getDiscussionCountPhrase()}
{elseif $boxSortField == 'cumulativeLikes'}
- {if MODULE_LIKE && $__wcf->getSession()->getPermission('user.like.canViewLike') && ($boxArticle->likes || $boxArticle->dislikes)}
- {lang reactions=$boxArticle->cumulativeLikes}wcf.like.reaction.label{/lang}
+ {if MODULE_LIKE && $__wcf->getSession()->getPermission('user.like.canViewLike') && $boxArticle->cachedReactions}
+ {include file='__topReaction' cachedReactions=$boxArticle->cachedReactions render='full'}
{/if}
{/if}
</small>
"__tabTabMenuFormContainer",
"__tagFormField",
"__textFormField",
+ "__topReaction",
"__uploadFormField",
"__userFormField",
"__usernameFormField",
"wysiwyg",
"wysiwygToolbar"
]
-}
+}
\ No newline at end of file
--- /dev/null
+{assign var='topReaction' value=$__wcf->getReactionHandler()->getTopReaction($cachedReactions)}
+{if $topReaction}
+ {if $render === 'icon'}
+ <span class="jsTooltip" title="{lang reaction=$topReaction[reaction] count=$topReaction[count]}wcf.like.reaction.topReaction{/lang}">{@$topReaction[reaction]->renderIcon()}</span>
+ {elseif $render === 'tiny'}
+ <span class="topReactionTiny jsTooltip" title="{lang reaction=$topReaction[reaction] count=$topReaction[count]}wcf.like.reaction.topReaction{/lang}">
+ {@$topReaction[reaction]->renderIcon()} {#$topReaction[count]}
+ </span>
+ {elseif $render === 'short'}
+ <span class="topReactionShort jsTooltip" title="{lang reaction=$topReaction[reaction] count=$topReaction[count]}wcf.like.reaction.topReaction{/lang}">
+ {@$topReaction[reaction]->renderIcon()} × {#$topReaction[count]}
+ </span>
+ {elseif $render === 'full'}
+ <span class="topReactionFull">
+ {@$topReaction[reaction]->renderIcon()} {lang reaction=$topReaction[reaction] count=$topReaction[count]}wcf.like.reaction.topReaction{/lang}
+ </span>
+ {/if}
+{/if}
use wcf\data\article\content\ViewableArticleContentList;
use wcf\system\cache\runtime\UserProfileRuntimeCache;
use wcf\system\label\object\ArticleLabelObjectHandler;
+use wcf\system\reaction\ReactionHandler;
use wcf\system\visitTracker\VisitTracker;
use wcf\system\WCF;
$this->sqlSelects .= 'tracked_visit.visitTime';
$this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_tracked_visit tracked_visit ON (tracked_visit.objectTypeID = ".VisitTracker::getInstance()->getObjectTypeID('com.woltlab.wcf.article')." AND tracked_visit.objectID = article.articleID AND tracked_visit.userID = ".WCF::getUser()->userID.")";
}
+
+ if (!empty($this->sqlSelects)) $this->sqlSelects .= ',';
+ $this->sqlSelects .= "like_object.cachedReactions";
+ $this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_like_object like_object ON (like_object.objectTypeID = ".ReactionHandler::getInstance()->getObjectType('com.woltlab.wcf.likeableArticle')->objectTypeID." AND like_object.objectID = article.articleID)";
}
/**
return $firstReactionType ? $firstReactionType->reactionTypeID : null;
}
+
+ /**
+ * @param string|null $cachedReactions
+ * @return array|null
+ * @since 5.2
+ */
+ public function getTopReaction($cachedReactions) {
+ if ($cachedReactions) {
+ $cachedReactions = @unserialize($cachedReactions);
+
+ if (is_array($cachedReactions) && !empty($cachedReactions)) {
+ asort($cachedReactions, SORT_NUMERIC);
+
+ return [
+ 'count' => current($cachedReactions),
+ 'reaction' => ReactionTypeCache::getInstance()->getReactionTypeByID(key($cachedReactions)),
+ ];
+ }
+ }
+
+ return null;
+ }
}
flex-wrap: wrap;
margin: -5px -5px 0 0;
- .reactionCount{
- @include wcfFontSmall;
-
- &::before {
- content: ' × ';
- }
- }
-
&.reactionSummaryListTiny .reactionType {
width: 16px;
height: 16px;
}
}
+.reactionCount{
+ @include wcfFontSmall;
+
+ &::before {
+ content: ' × ';
+ }
+}
+
.reactCountButton {
color: $wcfContentDimmedText;
flex: 0 0 auto;
}
}
}
+
+.topReactionFull,
+.topReactionShort {
+ > .reactionType {
+ vertical-align: bottom;
+ }
+}
+
+.topReactionTiny > .reactionType {
+ height: 16px;
+ vertical-align: top;
+ width: 16px;
+}
<item name="wcf.article.comment"><![CDATA[Artikel-Kommentar]]></item>
<item name="wcf.article.commentResponse"><![CDATA[Antwort auf Artikel-Kommentar]]></item>
<item name="wcf.article.sortField.comments"><![CDATA[Kommentare]]></item>
- <item name="wcf.article.sortField.cumulativeLikes"><![CDATA[Likes]]></item>
+ <item name="wcf.article.sortField.cumulativeLikes"><![CDATA[Reaktionen]]></item>
<item name="wcf.article.sortField.random"><![CDATA[Zufällig]]></item>
<item name="wcf.article.sortField.time"><![CDATA[Datum]]></item>
<item name="wcf.article.sortField.views"><![CDATA[Zugriffe]]></item>
<item name="wcf.like.reaction.label"><![CDATA[{#$reactions} Reaktion{if $reactions != 1}en{/if}]]></item>
<item name="wcf.like.reaction.more"><![CDATA[Weitere Reaktionen]]></item>
<item name="wcf.like.reaction.noMoreEntries"><![CDATA[Keine weiteren Reaktionen]]></item>
+ <item name="wcf.like.reaction.topReaction"><![CDATA[{$reaction->getTitle()} × {#$count}]]></item>
<item name="wcf.like.reactionsReceived"><![CDATA[Erhaltene Reaktionen]]></item>
<item name="wcf.like.reactionsGiven"><![CDATA[Vergebene Reaktionen]]></item>
</category>
<item name="wcf.article.comment"><![CDATA[Article Comment]]></item>
<item name="wcf.article.commentResponse"><![CDATA[Reply to Article Comment]]></item>
<item name="wcf.article.sortField.comments"><![CDATA[Comments]]></item>
- <item name="wcf.article.sortField.cumulativeLikes"><![CDATA[Likes]]></item>
+ <item name="wcf.article.sortField.cumulativeLikes"><![CDATA[Reactions]]></item>
<item name="wcf.article.sortField.random"><![CDATA[Random]]></item>
<item name="wcf.article.sortField.time"><![CDATA[Date]]></item>
<item name="wcf.article.sortField.views"><![CDATA[Views]]></item>
<item name="wcf.like.reaction.label"><![CDATA[{#$reactions} reaction{if $reactions != 1}s{/if}]]></item>
<item name="wcf.like.reaction.more"><![CDATA[More Reactions]]></item>
<item name="wcf.like.reaction.noMoreEntries"><![CDATA[There are no new reactions at the moment.]]></item>
+ <item name="wcf.like.reaction.topReaction"><![CDATA[{$reaction->getTitle()} × {#$count}]]></item>
<item name="wcf.like.reactionsReceived"><![CDATA[Reactions Received]]></item>
<item name="wcf.like.reactionsGiven"><![CDATA[Reactions Given]]></item>
</category>