[BUGFIX] EXT:beuser: Fix action icon (compare user) 28/52828/2
authorDaniel Windloff <daniel.jc.windloff@googlemail.com>
Sat, 29 Apr 2017 10:17:13 +0000 (12:17 +0200)
committerJigal van Hemert <jigal.van.hemert@typo3.org>
Wed, 17 May 2017 21:02:31 +0000 (23:02 +0200)
In EXT:beuser -> Backend User Listing there is the
possibility to add an user to the compare list.

If the user is already in the compare user list,
the user is removed from this list.

Resolves: #81079
Releases: master, 8.7
Change-Id: If0d6c132cdb2dbbd524890c3c90f92877240a284
Reviewed-on: https://review.typo3.org/52828
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
typo3/sysext/beuser/Classes/Controller/BackendUserController.php
typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html
typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html

index 56c1793..1e0178f 100644 (file)
@@ -157,6 +157,9 @@ class BackendUserController extends BackendUserActionController
         $this->view->assign('timeFormat', $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm']);
         $this->view->assign('backendUsers', $this->backendUserRepository->findDemanded($demand));
         $this->view->assign('backendUserGroups', array_merge([''], $this->backendUserGroupRepository->findAll()->toArray()));
+        $this->view->assign('compareUserUidList', array_map(function ($item) {
+            return true;
+        }, array_flip((array)$compareUserList)));
         $this->view->assign('compareUserList', !empty($compareUserList) ? $this->backendUserRepository->findByUidList($compareUserList) : '');
     }
 
index 7d68e03..d01a69a 100644 (file)
                        <a class="btn btn-default" href="#" onclick="top.launchView('be_users', '{backendUser.uid}'); return false;"><core:icon identifier="actions-document-info" /></a>
                </div>
                <div class="btn-group" role="group">
-                       <f:link.action action="addToCompareList" arguments="{uid: backendUser.uid}" class="btn btn-default"><core:icon identifier="actions-add" size="small"/> <f:translate key="compare" /></f:link.action>
+                       <f:if condition="{compareUserUidList.{backendUser.uid}}">
+                               <f:then>
+                                       <f:link.action action="removeFromCompareList" arguments="{uid: backendUser.uid}" class="btn btn-default">
+                                               <core:icon identifier="actions-remove" size="small"/>
+                                               <f:translate key="compare" />
+                                       </f:link.action>
+                               </f:then>
+                               <f:else>
+                                       <f:link.action action="addToCompareList" arguments="{uid: backendUser.uid}" class="btn btn-default"><core:icon identifier="actions-add" size="small"/> <f:translate key="compare" /></f:link.action>
+                               </f:else>
+                       </f:if>
                        <bu:SwitchUser backendUser="{backendUser}" />
                </div>
        </td>
index 706b384..e53cf75 100644 (file)
@@ -64,7 +64,7 @@
                                </thead>
                                <tbody>
                                        <f:for each="{paginatedBackendUsers}" as="backendUser">
-                                               <f:render partial="BackendUser/IndexListRow" arguments="{demand: demand, backendUser: backendUser, onlineBackendUsers: onlineBackendUsers, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl}" />
+                                               <f:render partial="BackendUser/IndexListRow" arguments="{demand: demand, backendUser: backendUser, onlineBackendUsers: onlineBackendUsers, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl, compareUserUidList: compareUserUidList}" />
                                        </f:for>
                                        <f:comment>
                                                Footer row: no officially defined style yet