mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
More work on dynamic modal template
This commit is contained in:
parent
3ff19f8c75
commit
00e921f505
@ -304,8 +304,6 @@ function constructFormBody(fields, options) {
|
|||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
html += `<div id='non-field-errors'><!-- Empty div for displaying errors --></div>`;
|
|
||||||
|
|
||||||
// Client must provide set of fields to be displayed,
|
// Client must provide set of fields to be displayed,
|
||||||
// otherwise *all* fields will be displayed
|
// otherwise *all* fields will be displayed
|
||||||
var displayed_fields = options.fields || fields;
|
var displayed_fields = options.fields || fields;
|
||||||
@ -684,7 +682,7 @@ function clearFormErrors(options) {
|
|||||||
// Remove the "has error" class
|
// Remove the "has error" class
|
||||||
$(options.modal).find('.has-error').removeClass('has-error');
|
$(options.modal).find('.has-error').removeClass('has-error');
|
||||||
|
|
||||||
// Clear the 'non field errors'
|
// Hide the 'non field errors'
|
||||||
$(options.modal).find('#non-field-errors').html('');
|
$(options.modal).find('#non-field-errors').html('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,18 +19,28 @@ function createNewModal(options={}) {
|
|||||||
<button type="button" class="close" data-dismiss="modal" aria-label='{% trans "Close" %}'>
|
<button type="button" class="close" data-dismiss="modal" aria-label='{% trans "Close" %}'>
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
<h3 id='modal-title'><i>Form Title Here</i></h3>
|
<h3 id='modal-title'>
|
||||||
|
<!-- Form title to be injected here -->
|
||||||
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class='modal-form-content-wrapper'>
|
<div class='modal-form-content-wrapper'>
|
||||||
<div class='alert alert-block alert-danger' id='form-validation-warning' style='display: none;'>
|
<div id='pre-form-content'>
|
||||||
{% trans "Form errors exist" %}
|
<!-- Content can be inserted here *before* the form fields -->
|
||||||
</div>
|
</div>
|
||||||
<div class='modal-form-content'>
|
<div id='non-field-errors'>
|
||||||
|
<!-- Form error messages go here -->
|
||||||
|
</div>
|
||||||
|
<div id='form-content' class='modal-form-content'>
|
||||||
<!-- Form content will be injected here-->
|
<!-- Form content will be injected here-->
|
||||||
</div>
|
</div>
|
||||||
|
<div id='post-form-content'>
|
||||||
|
<!-- Content can be inserted here *after* the form fields -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='modal-footer'>
|
<div class='modal-footer'>
|
||||||
<div id='modal-footer-buttons'></div>
|
<div id='modal-footer-buttons'>
|
||||||
|
<!-- Extra buttons can be inserted here -->
|
||||||
|
</div>
|
||||||
<button type='button' class='btn btn-default' id='modal-form-close' data-dismiss='modal'>{% trans "Cancel" %}</button>
|
<button type='button' class='btn btn-default' id='modal-form-close' data-dismiss='modal'>{% trans "Cancel" %}</button>
|
||||||
<button type='button' class='btn btn-primary' id='modal-form-submit'>{% trans "Submit" %}</button>
|
<button type='button' class='btn btn-primary' id='modal-form-submit'>{% trans "Submit" %}</button>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user