Improve UI of reaction overview list
authorJoshua Rüsweg <ruesweg@woltlab.com>
Mon, 13 May 2019 19:28:54 +0000 (21:28 +0200)
committerJoshua Rüsweg <ruesweg@woltlab.com>
Mon, 13 May 2019 19:29:12 +0000 (21:29 +0200)
See #2508

com.woltlab.wcf/templates/groupedUserReactionList.tpl [new file with mode: 0644]
wcfsetup/install/files/lib/data/reaction/ReactionAction.class.php

diff --git a/com.woltlab.wcf/templates/groupedUserReactionList.tpl b/com.woltlab.wcf/templates/groupedUserReactionList.tpl
new file mode 100644 (file)
index 0000000..25a5a5d
--- /dev/null
@@ -0,0 +1,36 @@
+{foreach from=$groupedUsers item=group}
+       {if $group}
+               <section class="section sectionContainerList">
+                       <h2 class="sectionTitle">{@$group}</h2>
+       {/if}
+       
+       {if $group|count}
+               <ol class="containerList jsGroupedUserList">
+                       {foreach from=$group item=user}
+                               {include file='userListItem'}
+                       {/foreach}
+               </ol>
+       {else}
+               <p>{$group->getNoUsersMessage()}</p>
+       {/if}
+       
+       {if $group}
+               </section>
+       {/if}
+{/foreach}
+
+<div class="paginationBottom jsPagination"></div>
+
+<script data-relocate="true">
+               $(function() {
+                       WCF.Language.addObject({
+                               'wcf.user.button.follow': '{lang}wcf.user.button.follow{/lang}',
+                               'wcf.user.button.ignore': '{lang}wcf.user.button.ignore{/lang}',
+                               'wcf.user.button.unfollow': '{lang}wcf.user.button.unfollow{/lang}',
+                               'wcf.user.button.unignore': '{lang}wcf.user.button.unignore{/lang}'
+                       });
+                       
+                       new WCF.User.Action.Follow($('.jsGroupedUserList > li'));
+                       new WCF.User.Action.Ignore($('.jsGroupedUserList > li'));
+               });
+</script>
\ No newline at end of file
index d950f3b7c085286f7267bbbf7e095aa02da4ed48..b6b946fa84a0e492c65a745f0dd103202c6ed66b 100644 (file)
@@ -21,6 +21,7 @@ use wcf\system\reaction\ReactionHandler;
 use wcf\system\user\activity\point\UserActivityPointHandler;
 use wcf\system\user\GroupedUserList;
 use wcf\system\WCF;
+use wcf\util\StringUtil;
 
 /**
  * Executes reaction-related actions.
@@ -99,7 +100,7 @@ class ReactionAction extends AbstractDatabaseObjectAction {
                        
                        // we cast the reactionTypeID to a string, so that we can sort the array
                        if (!isset($data[(string)$item->getReactionType()->reactionTypeID])) {
-                               $data[(string)$item->getReactionType()->reactionTypeID] = new GroupedUserList($item->getReactionType()->getTitle());
+                               $data[(string)$item->getReactionType()->reactionTypeID] = new GroupedUserList($item->getReactionType()->renderIcon() . ' ' . StringUtil::encodeHTML($item->getReactionType()->getTitle()));
                        }
                        
                        $data[(string)$item->getReactionType()->reactionTypeID]->addUserIDs([$item->userID]);
@@ -116,7 +117,7 @@ class ReactionAction extends AbstractDatabaseObjectAction {
                });
                
                return [
-                       'template' => WCF::getTPL()->fetch('groupedUserList', 'wcf', ['groupedUsers' => $data]),
+                       'template' => WCF::getTPL()->fetch('groupedUserReactionList', 'wcf', ['groupedUsers' => $data]),
                        'title' => WCF::getLanguage()->get('wcf.reactions.summary.title')
                ];
        }