mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Modal form improvements
This commit is contained in:
parent
ecf47aa69d
commit
337223b8eb
@ -732,11 +732,31 @@ function handleFormSuccess(response, options) {
|
||||
|
||||
// Close the modal
|
||||
if (!options.preventClose) {
|
||||
// TODO: Actually just *delete* the modal,
|
||||
// rather than hiding it!!
|
||||
// Note: The modal will be deleted automatically after closing
|
||||
$(options.modal).modal('hide');
|
||||
}
|
||||
|
||||
// Display any required messages
|
||||
// Should we show alerts immediately or cache them?
|
||||
var cache = (options.follow && response.url) || options.redirect || options.reload;
|
||||
|
||||
// Display any messages
|
||||
if (response.success) {
|
||||
showAlertOrCache("alert-success", response.success, cache);
|
||||
}
|
||||
|
||||
if (response.info) {
|
||||
showAlertOrCache("alert-info", response.info, cache);
|
||||
}
|
||||
|
||||
if (response.warning) {
|
||||
showAlertOrCache("alert-warning", response.warning, cache);
|
||||
}
|
||||
|
||||
if (response.danger) {
|
||||
showAlertOrCache("alert-danger", response.danger, cache);
|
||||
}
|
||||
|
||||
if (options.onSuccess) {
|
||||
// Callback function
|
||||
options.onSuccess(response, options);
|
||||
|
@ -83,8 +83,6 @@ function createNewModal(options={}) {
|
||||
|
||||
// Capture "enter" key input
|
||||
$(modal_name).on('keydown', 'input', function(event) {
|
||||
|
||||
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
// Simulate a click on the 'Submit' button
|
||||
|
Loading…
Reference in New Issue
Block a user