[BUGFIX] Refresh page tree after context menu actions are completed 33/55233/3
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Fri, 29 Dec 2017 22:52:53 +0000 (23:52 +0100)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Wed, 10 Jan 2018 12:49:17 +0000 (13:49 +0100)
Instead of hardcoded 500ms delay, context menu actions refresh page tree
as soon as the operation is completed.

Releases: 8.7
Resolves: #82970
Change-Id: I697a35a6152bd7c58a4702ab1288ab55c32f9029
Reviewed-on: https://review.typo3.org/55233
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/backend/Resources/Public/JavaScript/ContextMenuActions.js
typo3/sysext/backend/Resources/Public/JavaScript/Viewport.js

index dd9b962..a10da29 100644 (file)
@@ -98,15 +98,17 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity'], func
     ContextMenuActions.disableRecord = function (table, uid) {
         top.TYPO3.Backend.ContentContainer.setUrl(
             top.TYPO3.settings.RecordCommit.moduleUrl + '&data[' + table + '][' + uid + '][hidden]=1&prErr=1&redirect=' + ContextMenuActions.getReturnUrl()
-        );
-        top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree.defer(500);
+        ).on('load', function () {
+            top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree();
+        });
     };
 
     ContextMenuActions.enableRecord = function (table, uid) {
         top.TYPO3.Backend.ContentContainer.setUrl(
             top.TYPO3.settings.RecordCommit.moduleUrl + '&data[' + table + '][' + uid + '][hidden]=0&prErr=1&redirect=' + ContextMenuActions.getReturnUrl()
-        );
-        top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree.defer(500);
+        ).on('load', function () {
+            top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree();
+        });
     };
 
     ContextMenuActions.deleteRecord = function (table, uid) {
@@ -132,10 +134,11 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity'], func
             if (e.target.name === 'delete') {
                 top.TYPO3.Backend.ContentContainer.setUrl(
                     top.TYPO3.settings.RecordCommit.moduleUrl + '&redirect=' + ContextMenuActions.getReturnUrl() + '&cmd[' + table + '][' + uid + '][delete]=1&prErr=1'
-                );
-                if (table === 'pages' && top.TYPO3.Backend.NavigationContainer.PageTree) {
-                    top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree.defer(500);
-                }
+                ).on('load', function () {
+                    if (table === 'pages' && top.TYPO3.Backend.NavigationContainer.PageTree) {
+                        top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree();
+                    }
+                });
             }
             Modal.dismiss();
         });
@@ -203,10 +206,11 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity'], func
 
             top.TYPO3.Backend.ContentContainer.setUrl(
                 top.TYPO3.settings.RecordCommit.moduleUrl + url
-            );
-            if (table === 'pages' && top.TYPO3.Backend.NavigationContainer.PageTree) {
-                top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree.defer(500);
-            }
+            ).on('load', function () {
+                if (table === 'pages' && top.TYPO3.Backend.NavigationContainer.PageTree) {
+                    top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree();
+                }
+            });
         };
         if (!$anchorElement.data('title')) {
             performPaste();
@@ -239,4 +243,4 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity'], func
     };
 
     return ContextMenuActions;
-});
\ No newline at end of file
+});
index 8b68224..e68202b 100644 (file)
@@ -130,7 +130,7 @@ define(
                                },
                                setUrl: function (urlToLoad) {
                                        TYPO3.Backend.Loader.start();
-                                       $('.t3js-scaffold-content-module-iframe')
+                                       return $('.t3js-scaffold-content-module-iframe')
                                                .attr('src', urlToLoad)
                                                .one('load', function() {
                                                        TYPO3.Backend.Loader.finish();