xi / dialog-bundle
Xi Dialog bundle 是基于 xi/ajax-bundle 的基本 jQuery dialog,具有 Ajax 功能。
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-09-14 14:03:25 UTC
README
DialogBundle 提供了具有内部 Ajax 功能的基本 jQueryUI dialog。在打开时显示加载动画,向您的后端发送 Ajax 请求,并在收到响应后显示对话框中的内容。脚本将根据您的元素 href 属性加载其内容。
依赖项
xi-bundle-ajax
安装
composer.json
"require": { ... "xi/dialog-bundle": "2.3.x-dev" }
appKernel.php - 文件
<?php new Xi\Bundle\AjaxBundle\XiAjaxBundle(), new Xi\Bundle\DialogBundle\XiDialogBundle(), ?>
routing.yml - 文件
XiDialogBundle: resource: "@XiDialogBundle/Resources/config/routing.yml" prefix: /
Dialog
Dialog 是具有内部 Ajax 功能的基本 jQueryUI dialog。在打开时显示加载动画,发送 Ajax 请求到您的后端,并在收到响应后在对话框中显示内容。脚本将根据您的元素 href 属性加载其内容。
所有 jQueryUI dialog 选项都可用,还可以使用以下参数:
refreshDialogOnOpening: 如果您在关闭后再次打开它,是否刷新对话框内容。(布尔值)默认:false
headerAttribute: 应使用哪个属性作为对话框的标题。(字符串)默认:'title'
以下示例是用 CoffeeScript 编写的。
new App.Dialog('.dialog', { width: 600, position: [null, 100] headerAttribute: 'header' refreshDialogOnOpening: false }, optionalYourOwnLoaderClass, optionalYourOwnErrorizerClass)
Confirmdialog
Confirmdialog 是一个简单的 Ajax 对话框,用于接受用户所做的更改。Confirmdialog 由接受两个参数的 Twig 扩展渲染:目标 URL 和(数组)选项。选项作为启动确认对话框的元素的属性进行渲染。如果您想在默认配置中为对话框设置标题,请将 header
设置为选项之一。header
还会设置元素的标题,如果未设置 title
选项。linkText
是可选的,其值显示如下:linkText 确认按钮将其 href 属性复制自启动对话框的元素,并在单击时执行默认行为。
{{ 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 假设您已安装并运行 AjaxBundle:AjaxElement。基本上,您只需要在 coffeescrpit bootstrap 中放置以下行:new App.AjaxElement.Default '.ajax-link'
。有关更多信息,请参阅 xi-bundle-ajax https://github.com/xi-project/xi-bundle-ajax。