[TASK] Replace confirm in FormEngine->Flex->Section remove 21/44821/3
authorFrank Nägler <frank.naegler@typo3.org>
Fri, 20 Nov 2015 12:46:08 +0000 (13:46 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 20 Nov 2015 13:30:06 +0000 (14:30 +0100)
Resolves: #71723
Releases: master
Change-Id: Iee94e6609f813b96111ce251b426c5f0ae76453b
Reviewed-on: https://review.typo3.org/44821
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
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/FormEngineFlexForm.js
typo3/sysext/backend/Resources/Public/JavaScript/Modal.js

index 1d97b3e..9c4dbc5 100644 (file)
@@ -90,12 +90,18 @@ define(['jquery', 'TYPO3/CMS/Backend/FormEngine'], function ($) {
                                me.$el.off('click').on('click', opts.deleteIconSelector, function(evt) {
                                        evt.preventDefault();
 
-                                       // @todo: make this text localizable
-                                       if (window.confirm('Are you sure?')) {
-                                               $(this).closest(opts.sectionSelector).hide().addClass(opts.sectionDeletedClass);
+                                       var confirmTitle = TYPO3.lang['flexform.section.delete.title'] || 'Are you sure?';
+                                       var confirmMessage = TYPO3.lang['flexform.section.delete.message'] || 'Are you sure you want to delete this section?';
+                                       var $confirm = top.TYPO3.Modal.confirm(confirmTitle, confirmMessage);
+                                       $confirm.on('confirm.button.cancel', function() {
+                                               top.TYPO3.Modal.currentModal.trigger('modal-dismiss');
+                                       });
+                                       $confirm.on('confirm.button.ok', function(event) {
+                                               $(evt.target).closest(opts.sectionSelector).hide().addClass(opts.sectionDeletedClass);
                                                me.setActionStatus();
                                                TYPO3.FormEngine.Validation.validate();
-                                       }
+                                               top.TYPO3.Modal.currentModal.trigger('modal-dismiss');
+                                       });
                                });
 
                                // allow the toggle open/close of the main selection
index 8c7f0e7..fec6a10 100644 (file)
@@ -100,9 +100,9 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) {
         *
         * @param {String} title the title for the confirm modal
         * @param {String} content the content for the conform modal, e.g. the main question
-        * @param {int} severity default top.TYPO3.Severity.warning
-        * @param {array} buttons an array with buttons, default no buttons
-        * @param {array} additionalCssClasses additional css classes to add to the modal
+        * @param {int} [severity=top.TYPO3.Severity.warning] severity default top.TYPO3.Severity.warning
+        * @param {array} [buttons] an array with buttons, default no buttons
+        * @param {array} [additionalCssClasses=''] additional css classes to add to the modal
         */
        Modal.confirm = function(title, content, severity, buttons, additionalCssClasses) {
                severity = (typeof severity !== 'undefined' ? severity : top.TYPO3.Severity.warning);