Browse Source

Correcting prevous fixes for #121, #102. Refs #121, #102.

Dante 10 years ago
parent
commit
99cb69b22c

+ 15 - 4
dist/js/bootstrap-dialog.js

@@ -959,8 +959,15 @@
         handleModalEvents: function() {
         handleModalEvents: function() {
             this.getModal().on('show.bs.modal', {dialog: this}, function(event) {
             this.getModal().on('show.bs.modal', {dialog: this}, function(event) {
                 var dialog = event.data.dialog;
                 var dialog = event.data.dialog;
+                dialog.setOpened(true);
                 if (dialog.isModalEvent(event) && typeof dialog.options.onshow === 'function') {
                 if (dialog.isModalEvent(event) && typeof dialog.options.onshow === 'function') {
-                    return dialog.options.onshow(dialog);
+                    var openIt = dialog.options.onshow(dialog);
+                    if (openIt === false) {
+                        alert('Stopped!');
+                        dialog.setOpened(false);
+                    }
+
+                    return openIt;
                 }
                 }
             });
             });
             this.getModal().on('shown.bs.modal', {dialog: this}, function(event) {
             this.getModal().on('shown.bs.modal', {dialog: this}, function(event) {
@@ -969,8 +976,14 @@
             });
             });
             this.getModal().on('hide.bs.modal', {dialog: this}, function(event) {
             this.getModal().on('hide.bs.modal', {dialog: this}, function(event) {
                 var dialog = event.data.dialog;
                 var dialog = event.data.dialog;
+                dialog.setOpened(false);
                 if (dialog.isModalEvent(event) && typeof dialog.options.onhide === 'function') {
                 if (dialog.isModalEvent(event) && typeof dialog.options.onhide === 'function') {
-                    return dialog.options.onhide(dialog);
+                    var hideIt = dialog.options.onhide(dialog);
+                    if (hideIt === false) {
+                        dialog.setOpened(true);
+                    }
+
+                    return hideIt;
                 }
                 }
             });
             });
             this.getModal().on('hidden.bs.modal', {dialog: this}, function(event) {
             this.getModal().on('hidden.bs.modal', {dialog: this}, function(event) {
@@ -1072,13 +1085,11 @@
         open: function() {
         open: function() {
             !this.isRealized() && this.realize();
             !this.isRealized() && this.realize();
             this.getModal().modal('show');
             this.getModal().modal('show');
-            this.setOpened(true);
 
 
             return this;
             return this;
         },
         },
         close: function() {
         close: function() {
             this.getModal().modal('hide');
             this.getModal().modal('hide');
-            this.setOpened(false);
 
 
             return this;
             return this;
         }
         }

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


+ 15 - 4
examples/assets/bootstrap-dialog/js/bootstrap-dialog.js

@@ -959,8 +959,15 @@
         handleModalEvents: function() {
         handleModalEvents: function() {
             this.getModal().on('show.bs.modal', {dialog: this}, function(event) {
             this.getModal().on('show.bs.modal', {dialog: this}, function(event) {
                 var dialog = event.data.dialog;
                 var dialog = event.data.dialog;
+                dialog.setOpened(true);
                 if (dialog.isModalEvent(event) && typeof dialog.options.onshow === 'function') {
                 if (dialog.isModalEvent(event) && typeof dialog.options.onshow === 'function') {
-                    return dialog.options.onshow(dialog);
+                    var openIt = dialog.options.onshow(dialog);
+                    if (openIt === false) {
+                        alert('Stopped!');
+                        dialog.setOpened(false);
+                    }
+
+                    return openIt;
                 }
                 }
             });
             });
             this.getModal().on('shown.bs.modal', {dialog: this}, function(event) {
             this.getModal().on('shown.bs.modal', {dialog: this}, function(event) {
@@ -969,8 +976,14 @@
             });
             });
             this.getModal().on('hide.bs.modal', {dialog: this}, function(event) {
             this.getModal().on('hide.bs.modal', {dialog: this}, function(event) {
                 var dialog = event.data.dialog;
                 var dialog = event.data.dialog;
+                dialog.setOpened(false);
                 if (dialog.isModalEvent(event) && typeof dialog.options.onhide === 'function') {
                 if (dialog.isModalEvent(event) && typeof dialog.options.onhide === 'function') {
-                    return dialog.options.onhide(dialog);
+                    var hideIt = dialog.options.onhide(dialog);
+                    if (hideIt === false) {
+                        dialog.setOpened(true);
+                    }
+
+                    return hideIt;
                 }
                 }
             });
             });
             this.getModal().on('hidden.bs.modal', {dialog: this}, function(event) {
             this.getModal().on('hidden.bs.modal', {dialog: this}, function(event) {
@@ -1072,13 +1085,11 @@
         open: function() {
         open: function() {
             !this.isRealized() && this.realize();
             !this.isRealized() && this.realize();
             this.getModal().modal('show');
             this.getModal().modal('show');
-            this.setOpened(true);
 
 
             return this;
             return this;
         },
         },
         close: function() {
         close: function() {
             this.getModal().modal('hide');
             this.getModal().modal('hide');
-            this.setOpened(false);
 
 
             return this;
             return this;
         }
         }

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


+ 15 - 4
src/js/bootstrap-dialog.js

@@ -959,8 +959,15 @@
         handleModalEvents: function() {
         handleModalEvents: function() {
             this.getModal().on('show.bs.modal', {dialog: this}, function(event) {
             this.getModal().on('show.bs.modal', {dialog: this}, function(event) {
                 var dialog = event.data.dialog;
                 var dialog = event.data.dialog;
+                dialog.setOpened(true);
                 if (dialog.isModalEvent(event) && typeof dialog.options.onshow === 'function') {
                 if (dialog.isModalEvent(event) && typeof dialog.options.onshow === 'function') {
-                    return dialog.options.onshow(dialog);
+                    var openIt = dialog.options.onshow(dialog);
+                    if (openIt === false) {
+                        alert('Stopped!');
+                        dialog.setOpened(false);
+                    }
+
+                    return openIt;
                 }
                 }
             });
             });
             this.getModal().on('shown.bs.modal', {dialog: this}, function(event) {
             this.getModal().on('shown.bs.modal', {dialog: this}, function(event) {
@@ -969,8 +976,14 @@
             });
             });
             this.getModal().on('hide.bs.modal', {dialog: this}, function(event) {
             this.getModal().on('hide.bs.modal', {dialog: this}, function(event) {
                 var dialog = event.data.dialog;
                 var dialog = event.data.dialog;
+                dialog.setOpened(false);
                 if (dialog.isModalEvent(event) && typeof dialog.options.onhide === 'function') {
                 if (dialog.isModalEvent(event) && typeof dialog.options.onhide === 'function') {
-                    return dialog.options.onhide(dialog);
+                    var hideIt = dialog.options.onhide(dialog);
+                    if (hideIt === false) {
+                        dialog.setOpened(true);
+                    }
+
+                    return hideIt;
                 }
                 }
             });
             });
             this.getModal().on('hidden.bs.modal', {dialog: this}, function(event) {
             this.getModal().on('hidden.bs.modal', {dialog: this}, function(event) {
@@ -1072,13 +1085,11 @@
         open: function() {
         open: function() {
             !this.isRealized() && this.realize();
             !this.isRealized() && this.realize();
             this.getModal().modal('show');
             this.getModal().modal('show');
-            this.setOpened(true);
 
 
             return this;
             return this;
         },
         },
         close: function() {
         close: function() {
             this.getModal().modal('hide');
             this.getModal().modal('hide');
-            this.setOpened(false);
 
 
             return this;
             return this;
         }
         }