[BUGFIX] Async broken dialog message for adding new shortcut entry 49/42349/2
authorSascha Wilking <sascha.wilking@hmmh.de>
Fri, 7 Aug 2015 09:10:56 +0000 (11:10 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 7 Aug 2015 09:55:52 +0000 (11:55 +0200)
With adding a new entry to the shortcut list the new fancy dialog
window stuff will open. but your choice cannot be "respected"
because the adding action was already done before the dialog
window is open.

Resolves: #68824
Releases: master
Change-Id: I13192f08b110226a563db200209e8d7ea0b3c600
Reviewed-on: http://review.typo3.org/42349
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js

index 3e83ba0..d2e8cd8 100644 (file)
@@ -103,12 +103,27 @@ define('TYPO3/CMS/Backend/Toolbar/ShortcutMenu', ['jquery'], function($) {
         * when finished it reloads the menu
         */
        ShortcutMenu.createShortcut = function(moduleName, url, confirmationText, motherModule) {
-               var shouldCreateShortcut = true;
                if (typeof confirmationText !== 'undefined') {
                        // @todo: translations
                        top.TYPO3.Modal.confirm('Create bookmark', confirmationText)
                                .on('confirm.button.ok', function() {
-                                       shouldCreateShortcut = true;
+                                       var $toolbarItemIcon = $(ShortcutMenu.options.toolbarIconSelector, ShortcutMenu.options.containerSelector);
+                                       var $spinner = ShortcutMenu.$spinnerElement.clone();
+                                       var $existingItem = $toolbarItemIcon.replaceWith($spinner);
+
+                                       $.ajax({
+                                               url: TYPO3.settings.ajaxUrls['ShortcutMenu::create'],
+                                               type: 'post',
+                                               data: {
+                                                       module: moduleName,
+                                                       url: url,
+                                                       motherModName: motherModule
+                                               },
+                                               cache: false
+                                       }).done(function() {
+                                               ShortcutMenu.refreshMenu();
+                                               $spinner.replaceWith($existingItem);
+                                       });
                                        $(this).trigger('modal-dismiss');
                                })
                                .on('confirm.button.cancel', function() {
@@ -116,25 +131,6 @@ define('TYPO3/CMS/Backend/Toolbar/ShortcutMenu', ['jquery'], function($) {
                                });
                }
 
-               if (shouldCreateShortcut) {
-                       var $toolbarItemIcon = $(ShortcutMenu.options.toolbarIconSelector, ShortcutMenu.options.containerSelector);
-                       var $spinner = ShortcutMenu.$spinnerElement.clone();
-                       var $existingItem = $toolbarItemIcon.replaceWith($spinner);
-
-                       $.ajax({
-                               url: TYPO3.settings.ajaxUrls['ShortcutMenu::create'],
-                               type: 'post',
-                               data: {
-                                       module: moduleName,
-                                       url: url,
-                                       motherModName: motherModule
-                               },
-                               cache: false
-                       }).done(function() {
-                               ShortcutMenu.refreshMenu();
-                               $spinner.replaceWith($existingItem);
-                       });
-               }
        };
 
        /**