[TASK] Replace confirm for delete shortcut 82/41482/2
authorFrank Nägler <typo3@naegler.net>
Thu, 16 Jul 2015 15:55:00 +0000 (17:55 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 16 Jul 2015 16:10:35 +0000 (18:10 +0200)
Resolves: #68238
Releases: master
Change-Id: Iddcc5a7cb29c929377c414441585be5b46e6dacb
Reviewed-on: http://review.typo3.org/41482
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js

index db307e7..24b25df 100644 (file)
@@ -76,21 +76,26 @@ define('TYPO3/CMS/Backend/Toolbar/ShortcutMenu', ['jquery'], function($) {
         */
        ShortcutMenu.deleteShortcut = function($shortcutRecord) {
                // @todo: translations
-               if (confirm('Do you really want to remove this bookmark?')) {
-                       $.ajax({
-                               url: TYPO3.settings.ajaxUrls['ShortcutMenu::delete'],
-                               data: {
-                                       shortcutId: $shortcutRecord.data('shortcutid')
-                               },
-                               type: 'post',
-                               cache: false
-                       }).done(function() {
-                               // a reload is used in order to restore the original behaviour
-                               // e.g. remove groups that are now empty because the last one in the group
-                               // was removed
-                               ShortcutMenu.refreshMenu();
+               top.TYPO3.Modal.confirm('Delete bookmark', 'Do you really want to remove this bookmark?')
+                       .on('confirm.button.ok', function() {
+                               $.ajax({
+                                       url: TYPO3.settings.ajaxUrls['ShortcutMenu::delete'],
+                                       data: {
+                                               shortcutId: $shortcutRecord.data('shortcutid')
+                                       },
+                                       type: 'post',
+                                       cache: false
+                               }).done(function() {
+                                       // a reload is used in order to restore the original behaviour
+                                       // e.g. remove groups that are now empty because the last one in the group
+                                       // was removed
+                                       ShortcutMenu.refreshMenu();
+                               });
+                               $(this).trigger('modal-dismiss');
+                       })
+                       .on('confirm.button.cancel', function() {
+                               $(this).trigger('modal-dismiss');
                        });
-               }
        };
 
        /**
@@ -167,4 +172,4 @@ define('TYPO3/CMS/Backend/Toolbar/ShortcutMenu', ['jquery'], function($) {
                TYPO3.ShortcutMenu = ShortcutMenu;
                return ShortcutMenu;
        }();
-});
\ No newline at end of file
+});