mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
commit
b6e3df4e6b
@ -776,7 +776,8 @@ function handleModalForm(url, options) {
|
||||
// Form was returned, invalid!
|
||||
else {
|
||||
|
||||
if (!options.hideErrorMessage) {
|
||||
// Disable error message with option or response
|
||||
if (!options.hideErrorMessage && !response.hideErrorMessage) {
|
||||
var warningDiv = $(modal).find('#form-validation-warning');
|
||||
warningDiv.css('display', 'block');
|
||||
}
|
||||
@ -791,6 +792,19 @@ function handleModalForm(url, options) {
|
||||
if (options.secondary) {
|
||||
attachSecondaries(modal, options.secondary);
|
||||
}
|
||||
|
||||
// Set modal title with response
|
||||
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');
|
||||
@ -837,6 +851,7 @@ function launchModalForm(url, options = {}) {
|
||||
* secondary - List of secondary modals to attach
|
||||
* callback - List of callback functions to attach to inputs
|
||||
* focus - Select which field to focus on by default
|
||||
* buttons - additional buttons that should be added as array with [name, title]
|
||||
*/
|
||||
|
||||
var modal = options.modal || '#modal-form';
|
||||
@ -896,6 +911,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" %}');
|
||||
|
Loading…
Reference in New Issue
Block a user