Browse Source

added danger, warning and success shortcut functions

andrew 11 years ago
parent
commit
457ce7ac9f
1 changed files with 40 additions and 0 deletions
  1. 40 0
      js/bootstrap-dialog.js

+ 40 - 0
js/bootstrap-dialog.js

@@ -779,6 +779,46 @@
         }).open();
     };
 
+    /**
+     * Warning window
+     * 
+     * @param {type} message
+     * @returns the created dialog instance
+     */
+    BootstrapDialog.warning = function(message, callback) {
+        return new BootstrapDialog({
+            type: BootstrapDialog.TYPE_WARNING,
+            message: message
+        }).open();
+    };
+
+    /**
+     * Danger window
+     * 
+     * @param {type} message
+     * @returns the created dialog instance
+     */
+    BootstrapDialog.danger = function(message, callback) {
+        return new BootstrapDialog({
+            type: BootstrapDialog.TYPE_DANGER,
+            message: message
+        }).open();
+    };
+
+
+    /**
+     * Success window
+     * 
+     * @param {type} message
+     * @returns the created dialog instance
+     */
+    BootstrapDialog.success = function(message, callback) {
+        return new BootstrapDialog({
+            type: BootstrapDialog.TYPE_SUCCESS,
+            message: message
+        }).open();
+    };
+
     // check for nodeJS
     var hasModule = (typeof module !== 'undefined' && module.exports);