[BUGFIX] EXT:beuser: Fix action icon (compare user) 60/52660/3
authorDaniel Windloff <daniel.jc.windloff@googlemail.com>
Sat, 29 Apr 2017 10:17:13 +0000 (12:17 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 17 May 2017 15:27:07 +0000 (17:27 +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/52660
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
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 0551f2e..99e7287 100644 (file)
@@ -162,6 +162,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