dialog: add data-autoclose-dialog option (#37253)
gitea/gadjo/pipeline/head Build started...
Details
gitea/gadjo/pipeline/head Build started...
Details
This commit is contained in:
parent
504c3c368c
commit
3339674f61
|
@ -47,6 +47,9 @@ var gadjo_js = gadjo_js || {};
|
|||
* attribute, a gadjo:dialog-done event is triggered on success, a
|
||||
* gadjo:dialog-submit-error event is triggered on failure.
|
||||
*
|
||||
* Set data-autoclose-dialog="true" to close the dialog box after the
|
||||
* submit.
|
||||
*
|
||||
* Dialog is modal by default, set data-modal="false" for non-modal
|
||||
* dialogs.
|
||||
*/
|
||||
|
@ -55,6 +58,7 @@ var gadjo_js = gadjo_js || {};
|
|||
var selector = $anchor.data('selector') || 'form:not(.gadjo-popup-ignore)';
|
||||
var title_selector = $anchor.data('title-selector') || '#appbar h2';
|
||||
var inplace_submit = $anchor.data('inplace-submit');
|
||||
var autoclose_dialog = $anchor.data('autoclose-dialog');
|
||||
var modal = $anchor.data('modal');
|
||||
if (url == '#') {
|
||||
return false;
|
||||
|
@ -217,6 +221,15 @@ var gadjo_js = gadjo_js || {};
|
|||
} else {
|
||||
$elem.click();
|
||||
}
|
||||
var validated = true;
|
||||
$form.find('input, textarea').each(function() {
|
||||
if ($(this)[0].checkValidity != undefined) {
|
||||
validated &= $(this)[0].checkValidity();
|
||||
}
|
||||
})
|
||||
if (autoclose_dialog & validated) {
|
||||
$content.dialog('destroy');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue