Create notifications with Flash messenger and pnotify - remithomas/rt-extends GitHub Wiki
Requires
Add notifications
$flashMessage = new FlashMessage();
$flashMessage->setTitle("Notifications !");
$flashMessage->setMessages("Some data are not filled out correctly.");
$this->flashmessenger()->addErrorMessage($flashMessage);
Display in your layout
<?php echo $this->extendedFlashMessenger(true, true, array("class"=>"flashmessenger-hide")); ?>
application.js
var basicParamsNotifications = {
animation: "fade",
shadow: false,
delay: 4000,
width:"450px",
height:"100px",
sticker:false,
animate_speed:"normal",
icon: false,
history: false,
before_open: function(pnotify){
// Position this notice in the center of the screen.
pnotify.css({
"top":"50px",
"left": ($(window).width() / 2) - (pnotify.width() / 2)
});
}
}
$(".flashmessage-container.alert.alert-success").each(function(){
$.pnotify(
$.extend(basicParamsNotifications, {
title: $(this).children("h4.flashmessage-container-title").html(),
text: $(this).children(".flasmessage-container-messages").html(),
opacity: 0.95,
type: "success"
})
);
}).hide();
CSS
.flashmessenger-hide{display:none;}