PHP Classes

File: templates/noty/alert.js

Recommend this page to a friend!
  Classes of Thierry Feuzeu  >  Modals, alerts and confirmation dialogs for Jaxon  >  templates/noty/alert.js  >  Download  
File: templates/noty/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,895 bytes
 

Contents

Class file image Download
jaxon.dialogs.noty = {
    success: function(content, title) {
        noty({text: content, type: 'success', layout: 'topCenter', timeout: 5000});
    },
    info: function(content, title) {
        noty({text: content, type: 'information', layout: 'topCenter', timeout: 5000});
    },
    warning: function(content, title) {
        noty({text: content, type: 'warning', layout: 'topCenter', timeout: 5000});
    },
    error: function(content, title) {
        noty({text: content, type: 'error', layout: 'topCenter', timeout: 5000});
    },
    confirm: function(question, title, yesCallback, noCallback) {
        noty({
            text: question,
            layout: 'topCenter',
            buttons: [
                {
                    addClass: 'btn btn-primary',
                    text: "<?php echo $this->yes ?>",
                    onClick: function($noty){
                        $noty.close();
                        yesCallback();
                    }
                },{
                    addClass: 'btn btn-danger',
                    text: "<?php echo $this->no ?>",
                    onClick: function($noty){
                        $noty.close();
                        if(noCallback != undefined)
                            noCallback();
                    }
                }
            ]
        });
    }
};
jaxon.command.handler.register('noty.alert', function(args) {
    noty({text: args.data.text, type: args.data.type, layout: 'topCenter', timeout: 5000});
});

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