xi / dialog-bundle
Xi Dialog bundle is basic jQuery dialog with ajax features from xi/ajax-bundle
Installs: 3 251
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 2
Language:CoffeeScript
Type:symfony-bundle
Requires
- symfony/dependency-injection: >= 2.4.0
- symfony/form: >= 2.4.0
- symfony/framework-bundle: >= 2.4.0
- twig/twig: >=1.11.0,<2.0
- xi/ajax-bundle: >= 2.3.0
This package is not auto-updated.
Last update: 2024-11-09 14:52:58 UTC
README
DialogBundle provides basic jQueryUI dialog with internal ajax functionality. It has dependency on xi-bundle-ajax that provides ajax interface and error handling. Dialogbundle dialogs can gracefully handle backend errors thanks to xi-bundle-ajax.
Dependencies
xi-bundle-ajax
Installing
composer.json
"require": { ... "xi/dialog-bundle": "2.3.x-dev" }
appKernel.php -file
<?php new Xi\Bundle\AjaxBundle\XiAjaxBundle(), new Xi\Bundle\DialogBundle\XiDialogBundle(), ?>
routing.yml -file
XiDialogBundle: resource: "@XiDialogBundle/Resources/config/routing.yml" prefix: /
Dialog
Dialog is basic jQueryUI dialog with internal ajax functionality. On opening it displays loading animation, sends ajax request to your backend and displays content in dialog after receiving response. Script will load its content according to your element href attribute.
All jQueryUI dialog options are available and also there are also following parameters that you can use:
refreshDialogOnOpening: Should dialog content be refreshed if you open it again after you have closed it. (boolean) Default: false
headerAttribute: what attribute should be used as header for your dialog. (string) Default: 'title'
The following example is written in Coffeescript.
new App.Dialog('.dialog', { width: 600, position: [null, 100] headerAttribute: 'header' refreshDialogOnOpening: false }, optionalYourOwnLoaderClass, optionalYourOwnErrorizerClass)
Confirmdialog
Confirmdialog is a simple ajax dialog for accepting changes that user has made.
Confirmdialog is rendered by Twig extension that accept two arguments: url to target and (array) options.
Options are rendered as attributes of element that launches confirmation dialog.
If you want to set header for your dialog in default configuration please set header
as one of the options.
header
also sets elements title if title
option is not set.
linkText
is optional, the value is shown like this: linkText
Confirm button copies it's href attribure from the element that launches the dialog, and executes the default behaviour when clicked.
{{ sba_confirmdialog_render('url_to_what_shoud_be_deleted), {'header': 'header_of_yours', 'linkText': 'text_for_link' 'some_attribute': 'some_attribute_of_yours'}}
Confirm dialog assumes that you have AjaxBundle:AjaxElement up and running. Basically you just need to put following line
in your coffeescrpit bootstrap: new App.AjaxElement.Default '.ajax-link'
.
Check xi-bundle-ajax https://github.com/xi-project/xi-bundle-ajax for more information.