PHP Classes

File: templates/jalert/alert.js

Recommend this page to a friend!
  Classes of Thierry Feuzeu  >  Modals, alerts and confirmation dialogs for Jaxon  >  templates/jalert/alert.js  >  Download  
File: templates/jalert/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: Fixed button labels in Bootstrap and jAlert plugins.
Date: 4 years ago
Size: 1,620 bytes
 

Contents

Class file image Download
jaxon.dialogs.jalert = {
    success: function(content, title) {
        if(title == undefined) title = 'Success';
        $.jAlert({content: content, title: title, theme: 'green'});
    },
    info: function(content, title) {
        if(title == undefined) title = 'Information';
        $.jAlert({content: content, title: title, theme: 'blue'});
    },
    warning: function(content, title) {
        if(title == undefined) title = 'Warning';
        $.jAlert({content: content, title: title, theme: 'yellow'});
    },
    error: function(content, title) {
        if(title == undefined) title = 'Error';
        $.jAlert({content: content, title: title, theme: 'red'});
    },
    confirm: function(question, title, yesCallback, noCallback) {
        if(noCallback == undefined)
            noCallback = function(){};
        $.jAlert({
            title: title,
            type: "confirm",
            confirmQuestion: question,
            confirmBtnText: "<?php echo $this->yes ?>",
            denyBtnText: "<?php echo $this->no ?>",
            onConfirm: yesCallback,
            onDeny: noCallback
        });
    }
};

jaxon.command.handler.register("jalert.alert", function(args) {
    $.jAlert(args.data);
});

<?php if(($this->defaultForAlert)): ?>
jaxon.ajax.message.success = jaxon.dialogs.jalert.success;
jaxon.ajax.message.info = jaxon.dialogs.jalert.info;
jaxon.ajax.message.warning = jaxon.dialogs.jalert.warning;
jaxon.ajax.message.error = jaxon.dialogs.jalert.error;
<?php endif ?>
<?php if(($this->defaultForConfirm)): ?>
jaxon.ajax.message.confirm = jaxon.dialogs.jalert.confirm;
<?php endif ?>
For more information send a message to info at phpclasses dot org.