mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-05 23:08:48 +00:00
Refactor "showAlertDialog" function
This commit is contained in:
parent
e9bf4b4cef
commit
a1579eecfd
@ -103,6 +103,14 @@ function createNewModal(options={}) {
|
|||||||
modalSetSubmitText(modal_name, options.submitText || '{% trans "Submit" %}');
|
modalSetSubmitText(modal_name, options.submitText || '{% trans "Submit" %}');
|
||||||
modalSetCloseText(modal_name, options.cancelText || '{% trans "Cancel" %}');
|
modalSetCloseText(modal_name, options.cancelText || '{% trans "Cancel" %}');
|
||||||
|
|
||||||
|
if (options.hideSubmitButton) {
|
||||||
|
$(modal_name).find('#modal-form-submit').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.hideCloseButton) {
|
||||||
|
$(modal_name).find('#modal-form-cancel').hide();
|
||||||
|
}
|
||||||
|
|
||||||
// Return the "name" of the modal
|
// Return the "name" of the modal
|
||||||
return modal_name;
|
return modal_name;
|
||||||
}
|
}
|
||||||
@ -552,25 +560,18 @@ function showAlertDialog(title, content, options={}) {
|
|||||||
*
|
*
|
||||||
* title - Title text
|
* title - Title text
|
||||||
* content - HTML content of the dialog window
|
* content - HTML content of the dialog window
|
||||||
* options:
|
|
||||||
* modal - modal form to use (default = '#modal-alert-dialog')
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var modal = options.modal || '#modal-alert-dialog';
|
|
||||||
|
|
||||||
$(modal).on('shown.bs.modal', function() {
|
var modal = createNewModal({
|
||||||
$(modal + ' .modal-form-content').scrollTop(0);
|
title: title,
|
||||||
|
cancelText: '{% trans "Close" %}',
|
||||||
|
hideSubmitButton: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
modalSetTitle(modal, title);
|
modalSetContent(modal, content);
|
||||||
modalSetContent(modal, content);
|
|
||||||
|
|
||||||
$(modal).modal({
|
$(modal).modal('show');
|
||||||
backdrop: 'static',
|
|
||||||
keyboard: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
$(modal).modal('show');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,25 +77,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='modal fade modal-fixed-footer' role='dialog' id='modal-alert-dialog'>
|
|
||||||
<div class='modal-dialog'>
|
|
||||||
<div class='modal-content'>
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
<h3 id='modal-title'>Alert Information</h3>
|
|
||||||
</div>
|
|
||||||
<div class='modal-form-content-wrapper'>
|
|
||||||
<div class='modal-form-content'>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class='modal-footer'>
|
|
||||||
<div id='modal-footer-buttons'></div>
|
|
||||||
<button type='button' class='btn btn-default' data-dismiss='modal'>{% trans "Close" %}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
Loading…
x
Reference in New Issue
Block a user