'use strict';
/**
* This function allows to show flash message using following parameters:
* @param {String} level - message state, 4 choices: success, info, warning, error
* @param {String} message - main content of flash message
* @param (optional) {String} title - title of flash message
*
* or using subfunctions :
*
* SUXESS.showMessage.success(message,(optional) title);
* SUXESS.showMessage.info(message,(optional) title);
* SUXESS.showMessage.warning(message,(optional) title);
* SUXESS.showMessage.error(message,(optional) title);
*/
SUXESS.showMessage = (function(toastr){
// SETUP TOASTR
toastr.options.closeButton = true;
toastr.options.positionClass = 'toast-top-right';
function showMessage(level, message, title) {
switch(level) {
case 'success':
toastr.success(message, title);
break;
case 'info':
toastr.info(message, title);
break;
case 'warning':
toastr.warning(message, title);
break;
case 'error':
toastr.error(message, title);
break;
}
}
showMessage.success = toastr.success;
showMessage.info = toastr.info;
showMessage.warning = toastr.warning;
showMessage.error = toastr.error;
return showMessage;
})(toastr);