add custom buttons with response

This commit is contained in:
Matthias 2021-06-17 19:23:30 +02:00
parent 3d17388b48
commit 96c29847e1

View File

@ -797,6 +797,14 @@ function handleModalForm(url, options) {
if (response.title) {
modalSetTitle(modal, response.title);
}
// Clean custom action buttons
$(modal).find('#modal-footer-buttons').html('');
// Add custom action buttons with response
if (response.buttons) {
attachButtons(modal, response.buttons);
}
}
else {
$(modal).modal('hide');
@ -902,6 +910,11 @@ function launchModalForm(url, options = {}) {
attachButtons(modal, options.buttons);
}
// Add custom buttons from response
if (response.buttons) {
attachButtons(modal, response.buttons);
}
} else {
$(modal).modal('hide');
showAlertDialog('{% trans "Invalid server response" %}', '{% trans "JSON response missing form data" %}');