Dante 10 years ago
parent
commit
f18c46bfd6
4 changed files with 26 additions and 19 deletions
  1. 1 0
      changelog.txt
  2. 12 9
      dist/js/bootstrap-dialog.js
  3. 1 1
      dist/js/bootstrap-dialog.min.js
  4. 12 9
      src/js/bootstrap-dialog.js

+ 1 - 0
changelog.txt

@@ -2,6 +2,7 @@ LASTEST NOT RELEASED
 ------------------------------
 * Set 'realized' status to false when closing a 'autodestroy' dialog. *
 * Merged #136 *
+* Refs #210 *
 
 V1.34.7
 ------------------------------

+ 12 - 9
dist/js/bootstrap-dialog.js

@@ -19,7 +19,7 @@
     if (typeof module !== 'undefined' && module.exports) {
         var isNode = (typeof process !== "undefined");
         var isElectron = isNode && ('electron' in process.versions);
-        if(isElectron) {
+        if (isElectron) {
             root.BootstrapDialog = factory(root.jQuery);
         } else {
             module.exports = factory(require('jquery'), require('bootstrap'));
@@ -862,8 +862,8 @@
             this.enhanceButton($button);
 
             //Initialize enabled or not
-            if(typeof button.enabled !== 'undefined') {
-              $button.toggleEnable(button.enabled);
+            if (typeof button.enabled !== 'undefined') {
+                $button.toggleEnable(button.enabled);
             }
 
             return $button;
@@ -1234,8 +1234,9 @@
                     label: options.buttonLabel,
                     action: function (dialog) {
                         dialog.setData('btnClicked', true);
-                        typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(true);
-                        dialog.close();
+                        if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, true) !== false) {
+                            dialog.close();
+                        }
                     }
                 }]
         }).open();
@@ -1285,15 +1286,17 @@
             buttons: [{
                     label: options.btnCancelLabel,
                     action: function (dialog) {
-                        typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(false);
-                        dialog.close();
+                        if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, false) !== false) {
+                            dialog.close();
+                        }
                     }
                 }, {
                     label: options.btnOKLabel,
                     cssClass: options.btnOKClass,
                     action: function (dialog) {
-                        typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(true);
-                        dialog.close();
+                        if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, true) !== false) {
+                            dialog.close();
+                        }
                     }
                 }]
         }).open();

File diff suppressed because it is too large
+ 1 - 1
dist/js/bootstrap-dialog.min.js


+ 12 - 9
src/js/bootstrap-dialog.js

@@ -19,7 +19,7 @@
     if (typeof module !== 'undefined' && module.exports) {
         var isNode = (typeof process !== "undefined");
         var isElectron = isNode && ('electron' in process.versions);
-        if(isElectron) {
+        if (isElectron) {
             root.BootstrapDialog = factory(root.jQuery);
         } else {
             module.exports = factory(require('jquery'), require('bootstrap'));
@@ -862,8 +862,8 @@
             this.enhanceButton($button);
 
             //Initialize enabled or not
-            if(typeof button.enabled !== 'undefined') {
-              $button.toggleEnable(button.enabled);
+            if (typeof button.enabled !== 'undefined') {
+                $button.toggleEnable(button.enabled);
             }
 
             return $button;
@@ -1234,8 +1234,9 @@
                     label: options.buttonLabel,
                     action: function (dialog) {
                         dialog.setData('btnClicked', true);
-                        typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(true);
-                        dialog.close();
+                        if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, true) !== false) {
+                            dialog.close();
+                        }
                     }
                 }]
         }).open();
@@ -1285,15 +1286,17 @@
             buttons: [{
                     label: options.btnCancelLabel,
                     action: function (dialog) {
-                        typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(false);
-                        dialog.close();
+                        if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, false) !== false) {
+                            dialog.close();
+                        }
                     }
                 }, {
                     label: options.btnOKLabel,
                     cssClass: options.btnOKClass,
                     action: function (dialog) {
-                        typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(true);
-                        dialog.close();
+                        if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, true) !== false) {
+                            dialog.close();
+                        }
                     }
                 }]
         }).open();