PHP Classes

File: templates/bootbox/alert.js

Recommend this page to a friend!
  Classes of Thierry Feuzeu  >  Modals, alerts and confirmation dialogs for Jaxon  >  templates/bootbox/alert.js  >  Download  
File: templates/bootbox/alert.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Modals, alerts and confirmation dialogs for Jaxon
Display Ajax modal, alert and confirmation dialogs
Author: By
Last change:
Date: 4 years ago
Size: 1,979 bytes
 

Contents

Class file image Download
jaxon.dialogs.bootbox = {
    alert: function(type, content, title) {
        var html = '<div class="alert alert-' + type + '" style="margin-top:15px;margin-bottom:-15px;">';
        if(title != undefined && title != '')
            html += '<strong>' + title + '</strong><br/>';
        html += content + '</div>';
        bootbox.alert(html);
    },
    success: function(content, title) {
        jaxon.dialogs.bootbox.alert('success', content, title);
    },
    info: function(content, title) {
        jaxon.dialogs.bootbox.alert('info', content, title);
    },
    warning: function(content, title) {
        jaxon.dialogs.bootbox.alert('warning', content, title);
    },
    error: function(content, title) {
        jaxon.dialogs.bootbox.alert('danger', content, title);
    },
    confirm: function(question, title, yesCallback, noCallback) {
        bootbox.confirm({
            title: title,
            message: question,
            buttons: {
                cancel: {label: "<?php echo $this->no ?>"},
                confirm: {label: "<?php echo $this->yes ?>"}
            },
            callback: function(res){
                if(res)
                    yesCallback();
                else if(typeof noCallback == 'function')
                    noCallback();
            }
        });
    }
};

if(!$('#<?php echo $this->container ?>').length)
{
    $('body').append('<div id="<?php echo $this->container ?>"></div>');
}
jaxon.command.handler.register("bootbox", function(args) {
    bootbox.alert(args.data.type, args.data.content, args.data.title);
});
<?php if(($this->defaultForAlert)): ?>
jaxon.ajax.message.success = jaxon.dialogs.bootbox.success;
jaxon.ajax.message.info = jaxon.dialogs.bootbox.info;
jaxon.ajax.message.warning = jaxon.dialogs.bootbox.warning;
jaxon.ajax.message.error = jaxon.dialogs.bootbox.error;
<?php endif ?>
<?php if(($this->defaultForConfirm)): ?>
jaxon.ajax.message.confirm = jaxon.dialogs.bootbox.confirm;
<?php endif ?>
For more information send a message to info at phpclasses dot org.