Clean base template
This commit is contained in:
parent
8f112c1bb5
commit
f8533fc819
|
@ -27,10 +27,6 @@
|
|||
{% load django_bootstrap5 %}
|
||||
{% bootstrap_css %}
|
||||
|
||||
<!-- Select2 -->
|
||||
<link href="{% static 'main/css/libs/select2.min.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'main/css/libs/select2-bootstrap-5-theme.min.css' %}" rel="stylesheet">
|
||||
|
||||
<!-- Custom CSS -->
|
||||
<link href="{% static 'main/css/base.css' %}" rel="stylesheet">
|
||||
{% block css %}{% endblock %}
|
||||
|
@ -45,12 +41,6 @@
|
|||
<!-- Bootstrap -->
|
||||
{% bootstrap_javascript %}
|
||||
|
||||
<!-- Select2 -->
|
||||
<script src="{% static 'main/js/libs/select2.min.js' %}"></script>
|
||||
|
||||
<!-- Popper -->
|
||||
<script src="{% static 'main/js/libs/popper.min.js' %}"></script>
|
||||
|
||||
<!-- Custom JS -->
|
||||
{% block js %}{% endblock %}
|
||||
</head>
|
||||
|
@ -61,7 +51,9 @@
|
|||
{% endblock %}
|
||||
|
||||
<div id="content-wrapper" class="container-fluid">
|
||||
{% if messages %}
|
||||
<div id="bootstrapMessagesDiv" class="px-2 pt-3">{% bootstrap_messages %}</div>
|
||||
{% endif %}
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
@ -72,40 +64,6 @@
|
|||
target="_blank">Código fuente</a>
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
<!-- Enable popovers -->
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
const popoverTriggerList = $('[data-bs-toggle="popover"]').toArray()
|
||||
const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl))
|
||||
|
||||
|
||||
// For django alerts to not take space
|
||||
function checkIfAlertsEmpty() {
|
||||
if ($.trim($('#bootstrapMessagesDiv').text()) === '') { // Check if the div is empty
|
||||
$('#bootstrapMessagesDiv').css('display', 'none'); // Set height to 0 if empty
|
||||
}
|
||||
}
|
||||
|
||||
// Intial check
|
||||
checkIfAlertsEmpty();
|
||||
|
||||
const alertsDivObserver = new MutationObserver(checkIfAlertsEmpty);
|
||||
|
||||
// Start observing the target node for configured mutations
|
||||
alertsDivObserver.observe($('#bootstrapMessagesDiv')[0], {
|
||||
childList: true, // Observe direct children
|
||||
subtree: true // Observe all descendants
|
||||
});
|
||||
});
|
||||
|
||||
// Hide popovers when you open another one
|
||||
$('[data-bs-toggle="popover"]').click(function () {
|
||||
$('[data-bs-toggle="popover"]').not(this).popover('hide'); //all but this
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in a new issue