Refactored modal.html.j2

This commit is contained in:
Kevin Veen-Birkenbach 2025-01-17 01:13:39 +01:00
parent 0f8113974f
commit 9741da0495

View File

@ -1,3 +1,16 @@
{% macro alert_box(id, alert_class, icon_class, title, text_id) %}
<div id="{{ id }}" class="alert {{ alert_class }} d-none" role="alert">
<h5><i class="{{ icon_class }}"></i> {{ title }} </h5><span id="{{ text_id }}"></span>
</div>
{% endmacro %}
{% macro list_section(id, title, list_id) %}
<div id="{{ id }}" class="mt-4 d-none">
<h6>{{ title }}:</h6>
<ul class="list-group" id="{{ list_id }}"></ul>
</div>
{% endmacro %}
<div class="modal fade" id="dynamicModal" tabindex="-1" aria-labelledby="dynamicModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
@ -6,35 +19,31 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<!-- Warnbox mit Markdown -->
<div id="dynamicModalWarning" class="alert alert-warning d-none" role="alert">
<h5><i class="fa-solid fa-triangle-exclamation"></i> Warning </h5><span id="dynamicModalWarningText"></span>
</div>
<!-- Infobox mit Markdown -->
<div id="dynamicModalInfo" class="alert alert-info d-none" role="alert">
<h5><i class="fa-solid fa-circle-info"></i> Information</h5><span id="dynamicModalInfoText"></span>
</div>
<!-- Warning box with Markdown -->
{{ alert_box('dynamicModalWarning', 'alert-warning', 'fa-solid fa-triangle-exclamation', 'Warning', 'dynamicModalWarningText') }}
<!-- Info box with Markdown -->
{{ alert_box('dynamicModalInfo', 'alert-info', 'fa-solid fa-circle-info', 'Information', 'dynamicModalInfoText') }}
<!-- Description text -->
<div id="dynamicDescriptionText" class="mt-2 d-none"></div>
<!-- Eingabebox für Identifier -->
<!-- Input box for Identifier -->
<div id="dynamicIdentifierBox" class="input-group mt-2 d-none">
<input type="text" id="dynamicModalContent" class="form-control" readonly>
<button class="btn btn-outline-secondary" type="button" id="dynamicCopyButton">Copy</button>
</div>
<!-- Link -->
<div id="dynamicModalLink" class="mt-3 d-none">
<a href="#" target="_blank" class="btn btn-primary w-100" id="dynamicModalLinkHref"></a>
</div>
<!-- Options -->
<div id="dynamicChildrenSection" class="mt-4 d-none">
<h6>Options:</h6>
<ul class="list-group" id="dynamicChildrenList"></ul>
</div>
<!-- Alternativen -->
<div id="dynamicAlternativesSection" class="mt-4 d-none">
<h6>Alternatives:</h6>
<ul class="list-group" id="dynamicAlternativesList"></ul>
</div>
{{ list_section('dynamicChildrenSection', 'Options', 'dynamicChildrenList') }}
<!-- Alternatives -->
{{ list_section('dynamicAlternativesSection', 'Alternatives', 'dynamicAlternativesList') }}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" onclick="closeAllModals()">Close</button>