[BUGFIX] Update hide/unhide action title after AJAX call 62/43262/5
authorMathias Brodala <mbrodala@pagemachine.de>
Sun, 13 Sep 2015 10:35:32 +0000 (12:35 +0200)
committerNicole Cordes <typo3@cordes.co>
Sun, 13 Sep 2015 15:20:09 +0000 (17:20 +0200)
The title of the hide/unhide action in the record list module
must be updated after a toggle via AJAX similarly to the icon.

Resolves: #69205
Releases: master
Change-Id: Ic8fa7f72631af3a3f94e0f3d08de0a2c2de6ab9f
Reviewed-on: http://review.typo3.org/43262
Reviewed-by: Alexander Stehlik <alexander.stehlik@gmail.com>
Tested-by: Alexander Stehlik <alexander.stehlik@gmail.com>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index e837709..44582d3 100644 (file)
@@ -111,6 +111,16 @@ define('TYPO3/CMS/Backend/AjaxDataHandler', ['jquery', 'TYPO3/CMS/Backend/Notifi
                }
                $anchorElement.data('state', nextState).data('params', nextParams);
 
+               // Update tooltip title
+               $anchorElement.tooltip('hide').one('hidden.bs.tooltip', function() {
+                       var nextTitle = $anchorElement.data('toggleTitle');
+                       // Bootstrap Tooltip internally uses only .attr('data-original-title')
+                       $anchorElement
+                               .data('toggleTitle', $anchorElement.attr('data-original-title'))
+                               .attr('data-original-title', nextTitle)
+                               .tooltip('show');
+               });
+
                var $iconElement = $anchorElement.find('i');
                $iconElement.addClass(className);
 
index dbb44d4..03ef3a0 100644 (file)
@@ -1345,17 +1345,21 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
                                if ($this->isRecordCurrentBackendUser($table, $row)) {
                                        $hideAction = $this->spaceIcon;
                                } else {
+                                       $hideTitle = $this->getLanguageService()->getLL('hide' . ($table == 'pages' ? 'Page' : ''), TRUE);
+                                       $unhideTitle = $this->getLanguageService()->getLL('unHide' . ($table == 'pages' ? 'Page' : ''), TRUE);
                                        if ($row[$hiddenField]) {
                                                $params = 'data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=0';
                                                $hideAction = '<a class="btn btn-default t3js-record-hide" data-state="hidden" href="#"'
                                                                          . ' data-params="' . htmlspecialchars($params) . '"'
-                                                                         . ' title="' . $this->getLanguageService()->getLL(('unHide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">'
+                                                                         . ' title="' . $unhideTitle . '"'
+                                                                         . ' data-toggle-title="' . $hideTitle . '">'
                                                                          . $this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL) . '</a>';
                                        } else {
                                                $params = 'data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1';
                                                $hideAction = '<a class="btn btn-default t3js-record-hide" data-state="visible" href="#"'
                                                                          . ' data-params="' . htmlspecialchars($params) . '"'
-                                                                         . ' title="' . $this->getLanguageService()->getLL(('hide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">'
+                                                                         . ' title="' . $hideTitle . '"'
+                                                                         . ' data-toggle-title="' . $unhideTitle . '">'
                                                                          . $this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL) . '</a>';
                                        }
                                }