[BUGFIX] Icon state toggling in record list 81/42681/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Mon, 17 Aug 2015 12:44:59 +0000 (14:44 +0200)
committerAlexander Opitz <opitz.alexander@googlemail.com>
Mon, 17 Aug 2015 16:11:05 +0000 (18:11 +0200)
When the toggle icon is clicked, the state icon class gets removed,
but the called toggleClass() methods add both icon state classes
again. Change the JavaScript to only add the required icon state
class to the button.

Resolves: #69128
Releases: master
Change-Id: I192163ba35ca0a11fb6c8621af8be04796c82b61
Reviewed-on: http://review.typo3.org/42681
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js

index 8f7a01b..d3fd9cc 100644 (file)
@@ -99,19 +99,21 @@ define('TYPO3/CMS/Backend/AjaxDataHandler', ['jquery', 'TYPO3/CMS/Backend/Notifi
                var $anchorElement = $rowElement.find('.t3js-record-hide');
                var table = $anchorElement.closest('table[data-table]').data('table');
                var params = $anchorElement.data('params');
-               var nextParams, nextState;
+               var nextParams, nextState, className;
 
                if ($anchorElement.data('state') === 'hidden') {
                        nextState = 'visible';
                        nextParams = params.replace('=0', '=1');
+                       className = 'fa-toggle-on';
                } else {
                        nextState = 'hidden';
                        nextParams = params.replace('=1', '=0');
+                       className = 'fa-toggle-off';
                }
                $anchorElement.data('state', nextState).data('params', nextParams);
 
                var $iconElement = $anchorElement.find('span');
-               $iconElement.toggleClass('fa-toggle-on').toggleClass('fa-toggle-off');
+               $iconElement.addClass(className);
 
                var $icon = $rowElement.find('td.col-icon span.t3-icon');
                var $overlayIcon = $icon.find('span.t3-icon');