dev-master
9999999-devSymfony ManuelAjaxFlashBundle
MIT
The Requires
javascript bundle ajax flash
1.0.1
1.0.1.0Symfony ManuelAjaxFlashBundle
MIT
The Requires
javascript bundle ajax flash
Wallogit.com
2017 © Pedro Peláez
Symfony ManuelAjaxFlashBundle
This Bundle Allow the Process of Flashes in ajax request via Javascript. Require jQuery., (*1)
Add to composer.json:, (*2)
{
"require": {
"manuelj555/ajax-flash-bundle": "1.0.*@dev"
}
}
Execute composer update., (*3)
Register the bundle:, (*4)
<?php
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Manuelj555\Bundle\AjaxFlashBundle\ManuelAjaxFlashBundle(),
// ...
);
}
In the config.yml (All config is Optional):, (*5)
manuel_ajax_flash:
auto_assets:
pnotify: ~
# sticky: ~
mapping:
# success:
# title: Información
# icon: my-icon
# info:
# title: Información
auto_assets, (*6)
Auto add the javascript and css in the html content. You have select the plugin to use, the available options are:, (*7)
mapping, (*8)
Allow set the title, icon and type for use in javascript, for each setted mapping type., (*9)
Example:, (*10)
manuel_ajax_flash:
mapping:
success:
type: success
title: Información
icon: my-icon
info:
type: info
title: Información
error:
type: danger
title: Error
If you no enable the auto_assets config, you can use the twig view located in the bundle:, (*11)
Example of use:, (*12)
{% use 'ManuelAjaxFlashBundle::pnotify.html.twig' %}
{#{% use 'ManuelAjaxFlashBundle::sticky.html.twig' %}#}
<!DOCTYPE html>
<html>
<head>
...
{{ block('ajax_flash_css') }}
</head>
<body>
...
{{ block('ajax_flash_js') }}
{{ block('ajax_flash_plugin') }}
</body>
</html>
Usage:, (*13)
$.ajaxFlash('*', function (message, type, title, icon) {
//call on all flash types. this function is called for each flash message
//the message parameter is a string
});
$.ajaxFlash('success info', function (message, type, title, icon) {
//call on success and info flash types. this function is called for each flash message
//the message parameter is a string
});
$.ajaxFlash('error', function (message, type, title, icon) {
//call on error flash type. this function is called for each flash message
//the message parameter is a string
});
// Working with array messages:
$.ajaxFlash(function (messages, type, title, icon) {
//call in all flash types, this function is called one time for each message type.
//the messages parameter is an array.
});
$.ajaxFlash(function (messages, type, title, icon) {
//call success and info flash types, this function is called one time for each message type.
//the messages parameter is an array.
}, 'success info');
Symfony ManuelAjaxFlashBundle
MIT
javascript bundle ajax flash
Symfony ManuelAjaxFlashBundle
MIT
javascript bundle ajax flash