Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 espaco 1
var UIAlertDialogApi = function () {
2
 
3
    var handleDialogs = function() {
4
 
5
        $('#demo_1').click(function(){
6
                bootbox.alert("Hello world!");    
7
            });
8
            //end #demo_1
9
 
10
            $('#demo_2').click(function(){
11
                bootbox.alert("Hello world!", function() {
12
                    alert("Hello world callback");
13
                });  
14
            });
15
            //end #demo_2
16
 
17
            $('#demo_3').click(function(){
18
                bootbox.confirm("Are you sure?", function(result) {
19
                   alert("Confirm result: "+result);
20
                });
21
            });
22
            //end #demo_3
23
 
24
            $('#demo_4').click(function(){
25
                bootbox.prompt("What is your name?", function(result) {
26
                    if (result === null) {
27
                        alert("Prompt dismissed");
28
                    } else {
29
                        alert("Hi <b>"+result+"</b>");
30
                    }
31
                });
32
            });
33
            //end #demo_6
34
 
35
            $('#demo_5').click(function(){
36
                bootbox.dialog({
37
                    message: "I am a custom dialog",
38
                    title: "Custom title",
39
                    buttons: {
40
                      success: {
41
                        label: "Success!",
42
                        className: "green",
43
                        callback: function() {
44
                          alert("great success");
45
                        }
46
                      },
47
                      danger: {
48
                        label: "Danger!",
49
                        className: "red",
50
                        callback: function() {
51
                          alert("uh oh, look out!");
52
                        }
53
                      },
54
                      main: {
55
                        label: "Click ME!",
56
                        className: "blue",
57
                        callback: function() {
58
                          alert("Primary button");
59
                        }
60
                      }
61
                    }
62
                });
63
            });
64
            //end #demo_7
65
 
66
    }
67
 
68
    var handleAlerts = function() {
69
 
70
        $('#alert_show').click(function(){
71
 
72
            Metronic.alert({
73
                container: $('#alert_container').val(), // alerts parent container(by default placed after the page breadcrumbs)
74
                place: $('#alert_place').val(), // append or prepent in container 
75
                type: $('#alert_type').val(),  // alert's type
76
                message: $('#alert_message').val(),  // alert's message
77
                close: $('#alert_close').is(":checked"), // make alert closable
78
                reset: $('#alert_reset').is(":checked"), // close all previouse alerts first
79
                focus: $('#alert_focus').is(":checked"), // auto scroll to the alert after shown
80
                closeInSeconds: $('#alert_close_in_seconds').val(), // auto close after defined seconds
81
                icon: $('#alert_icon').val() // put icon before the message
82
            });
83
 
84
        });
85
 
86
    }
87
 
88
    return {
89
 
90
        //main function to initiate the module
91
        init: function () {
92
            handleDialogs();
93
            handleAlerts();
94
        }
95
    };
96
 
97
}();