From ec21ca4150fa14fea348f0aea3fe7df52008aefd Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 16 Jul 2019 18:53:26 +0200 Subject: [PATCH] Displaying the number of reactions + a11y --- .../templates/articleListItems.tpl | 8 +++++ com.woltlab.wcf/templates/boxArticleList.tpl | 2 +- .../templates/userInformationStatistics.tpl | 2 +- .../system/reaction/ReactionHandler.class.php | 4 +-- .../install/files/style/ui/reactions.scss | 30 ------------------- wcfsetup/install/lang/de.xml | 15 +++++----- wcfsetup/install/lang/en.xml | 5 ++-- 7 files changed, 21 insertions(+), 45 deletions(-) diff --git a/com.woltlab.wcf/templates/articleListItems.tpl b/com.woltlab.wcf/templates/articleListItems.tpl index c967515ace..e774711210 100644 --- a/com.woltlab.wcf/templates/articleListItems.tpl +++ b/com.woltlab.wcf/templates/articleListItems.tpl @@ -53,6 +53,14 @@
+ {if MODULE_LIKE && $__wcf->getSession()->getPermission('user.like.canViewLike') && $article->cumulativeLikes} +
+ + + {#$article->cumulativeLikes} + +
+ {/if}
diff --git a/com.woltlab.wcf/templates/boxArticleList.tpl b/com.woltlab.wcf/templates/boxArticleList.tpl index c639d38c59..8c2ac9e051 100644 --- a/com.woltlab.wcf/templates/boxArticleList.tpl +++ b/com.woltlab.wcf/templates/boxArticleList.tpl @@ -16,7 +16,7 @@ {$boxArticle->getDiscussionProvider()->getDiscussionCountPhrase()} {elseif $boxSortField == 'cumulativeLikes'} {if MODULE_LIKE && $__wcf->getSession()->getPermission('user.like.canViewLike') && ($boxArticle->likes || $boxArticle->dislikes)} - {if $boxArticle->cumulativeLikes > 0}+{elseif $boxArticle->cumulativeLikes == 0}±{/if}{#$boxArticle->cumulativeLikes} + {lang reactions=$boxArticle->cumulativeLikes}wcf.like.reaction.label{/lang} {/if} {/if} diff --git a/com.woltlab.wcf/templates/userInformationStatistics.tpl b/com.woltlab.wcf/templates/userInformationStatistics.tpl index df4d9a92cf..eb302b891b 100644 --- a/com.woltlab.wcf/templates/userInformationStatistics.tpl +++ b/com.woltlab.wcf/templates/userInformationStatistics.tpl @@ -3,7 +3,7 @@ {event name='statistics'} {if MODULE_LIKE && $user->cumulativeLikes} -
{if $__wcf->getSession()->getPermission('user.profile.canViewUserProfile') && !$user->isProtected()}{lang}wcf.like.reputation{/lang}{else}{lang}wcf.like.reputation{/lang}{/if}
+
{if $__wcf->getSession()->getPermission('user.profile.canViewUserProfile') && !$user->isProtected()}{lang}wcf.like.reactionsReceived{/lang}{else}{lang}wcf.like.reactionsReceived{/lang}{/if}
{#$user->cumulativeLikes}
{/if} diff --git a/wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php b/wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php index 3cca143be8..aa12a62491 100644 --- a/wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php +++ b/wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php @@ -322,7 +322,7 @@ class ReactionHandler extends SingletonFactory { 'objectUserID' => $likeable->getUserID() ?: null, 'userID' => $user->userID, 'time' => $time, - 'likeValue' => $reaction->type, + 'likeValue' => 1, 'reactionTypeID' => $reactionTypeID ]); @@ -334,7 +334,7 @@ class ReactionHandler extends SingletonFactory { $likeEditor = new LikeEditor($like); $likeEditor->update([ 'time' => $time, - 'likeValue' => $reaction->type, + 'likeValue' => 1, 'reactionTypeID' => $reactionTypeID ]); diff --git a/wcfsetup/install/files/style/ui/reactions.scss b/wcfsetup/install/files/style/ui/reactions.scss index c112d283fe..91bad0434b 100644 --- a/wcfsetup/install/files/style/ui/reactions.scss +++ b/wcfsetup/install/files/style/ui/reactions.scss @@ -135,36 +135,6 @@ } } -.reputationCounter { - color: $wcfContentDimmedText; - - &.positive { - color: #060 !important; - - &::before { - content: $fa-var-smile-o + "\00A0"; - } - } - - &.negative { - color: #900 !important; - - &::before { - content: $fa-var-frown-o + "\00A0"; - } - } - - &::before { - font-family: FontAwesome; - content: $fa-var-meh-o + "\00A0"; - display: inline-block; - } - - &:empty { - display: none; - } -} - @include screen-sm-down { .reactionStatusContainer { display: none; diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index c5d62f80ad..e0dd805a6f 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -3944,24 +3944,24 @@ Dateianhänge: - + - + username}]]> 1} und {/if}{@$users.slice(-1)[0]}{else}{@$users.join(", ")} und {if $others == 1}einem{else}{#$others}{/if} weiteren{/if} gefällt das.{/literal}]]> - + - - + + getReactionType()->getTitle()}" class="jsTooltip">{@$like->getReactionType()->renderIcon()}
auf den Kommentar {if $commentAuthor}von {$commentAuthor->username}{else}eines Gasts{/if} an der Pinnwand von {$user->username} reagiert.]]> @@ -3972,13 +3972,12 @@ Dateianhänge: getReactionType()->getTitle()}" class="jsTooltip">{@$like->getReactionType()->renderIcon()} auf die Antwort {if $responseAuthor}von {$responseAuthor->username}{else}eines Gasts{/if} zum Kommentar {if $commentAuthor}von {$commentAuthor->username}{else}eines Gasts{/if} zum Artikel {$articleContent->getTitle()} reagiert.]]> getReactionType()->getTitle()}" class="jsTooltip">{@$like->getReactionType()->renderIcon()} auf den Kommentar {if $commentAuthor}von {$commentAuthor->username}{else}eines Gasts{/if} zu der Seite {$page->getTitle()} reagiert.]]> getReactionType()->getTitle()}" class="jsTooltip">{@$like->getReactionType()->renderIcon()} auf die Antwort {if $responseAuthor}von {$responseAuthor->username}{else}eines Gasts{/if} zum Kommentar {if $commentAuthor}von {$commentAuthor->username}{else}eines Gasts{/if} zu der Seite {$page->getTitle()} reagiert.]]> - + + - - 0}+{elseif $cumulativeLikes == 0}±{/if}{#$cumulativeLikes}]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index d67517785a..c9da212a61 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -3918,13 +3918,12 @@ Attachments: getReactionType()->getTitle()}" class="jsTooltip">{@$like->getReactionType()->renderIcon()} to the response by {if $responseAuthor}{$responseAuthor->username}{else}a guest{/if} on the comment by {if $commentAuthor}{$commentAuthor->username}{else}a guest{/if} on the article {$articleContent->getTitle()}.]]> getReactionType()->getTitle()}" class="jsTooltip">{@$like->getReactionType()->renderIcon()} to the comment by {if $commentAuthor}{$commentAuthor->username}{else}a guest{/if} on the page {$page->getTitle()}.]]> getReactionType()->getTitle()}" class="jsTooltip">{@$like->getReactionType()->renderIcon()} to the response by {if $responseAuthor}{$responseAuthor->username}{else}a guest{/if} on the comment by {if $commentAuthor}{$commentAuthor->username}{else}a guest{/if} on the page {$page->getTitle()}.]]> - + + - - 0}+{elseif $cumulativeLikes == 0}±{/if}{#$cumulativeLikes}]]> -- 2.20.1