js: add support for non modal dialogs (#10629)
This commit is contained in:
parent
d8c9a55a5d
commit
984acfdaea
|
@ -38,12 +38,19 @@ var gadjo_js = gadjo_js || {};
|
||||||
* Submit is done in place if the $anchor has a data-inplace-submit="true"
|
* Submit is done in place if the $anchor has a data-inplace-submit="true"
|
||||||
* attribute, a gadjo:dialog-done event is triggered on success, a
|
* attribute, a gadjo:dialog-done event is triggered on success, a
|
||||||
* gadjo:dialog-submit-error event is triggered on failure.
|
* gadjo:dialog-submit-error event is triggered on failure.
|
||||||
|
*
|
||||||
|
* Dialog is modal by default, set data-modal="false" for non-modal
|
||||||
|
* dialogs.
|
||||||
*/
|
*/
|
||||||
var $anchor = $(this);
|
var $anchor = $(this);
|
||||||
var url = $anchor.attr('href') || $anchor.data('url');
|
var url = $anchor.attr('href') || $anchor.data('url');
|
||||||
var selector = $anchor.data('selector') || 'form:not(.gadjo-popup-ignore)';
|
var selector = $anchor.data('selector') || 'form:not(.gadjo-popup-ignore)';
|
||||||
var title_selector = $anchor.data('title-selector') || '#appbar h2';
|
var title_selector = $anchor.data('title-selector') || '#appbar h2';
|
||||||
var inplace_submit = $anchor.data('inplace-submit');
|
var inplace_submit = $anchor.data('inplace-submit');
|
||||||
|
var modal = $anchor.data('modal');
|
||||||
|
if (modal === undefined) {
|
||||||
|
modal = true;
|
||||||
|
}
|
||||||
|
|
||||||
function show_error(message) {
|
function show_error(message) {
|
||||||
/* Add a div to body to show an error message and fade it out after 3
|
/* Add a div to body to show an error message and fade it out after 3
|
||||||
|
@ -112,7 +119,7 @@ var gadjo_js = gadjo_js || {};
|
||||||
var title = $html.find(title_selector).text();
|
var title = $html.find(title_selector).text();
|
||||||
|
|
||||||
$form.dialog({
|
$form.dialog({
|
||||||
modal: true,
|
modal: modal,
|
||||||
'title': title,
|
'title': title,
|
||||||
width: 'auto',
|
width: 'auto',
|
||||||
close: function (ev, ui) {
|
close: function (ev, ui) {
|
||||||
|
|
Loading…
Reference in New Issue