Clean base template

This commit is contained in:
Pedro Rey Anca 2024-12-02 23:46:42 +01:00
parent 8f112c1bb5
commit f8533fc819
Signed by: peprolinbot
GPG key ID: 053EA6E00116533A

View file

@ -27,10 +27,6 @@
{% load django_bootstrap5 %} {% load django_bootstrap5 %}
{% bootstrap_css %} {% 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 --> <!-- Custom CSS -->
<link href="{% static 'main/css/base.css' %}" rel="stylesheet"> <link href="{% static 'main/css/base.css' %}" rel="stylesheet">
{% block css %}{% endblock %} {% block css %}{% endblock %}
@ -45,12 +41,6 @@
<!-- Bootstrap --> <!-- Bootstrap -->
{% bootstrap_javascript %} {% 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 --> <!-- Custom JS -->
{% block js %}{% endblock %} {% block js %}{% endblock %}
</head> </head>
@ -61,7 +51,9 @@
{% endblock %} {% endblock %}
<div id="content-wrapper" class="container-fluid"> <div id="content-wrapper" class="container-fluid">
{% if messages %}
<div id="bootstrapMessagesDiv" class="px-2 pt-3">{% bootstrap_messages %}</div> <div id="bootstrapMessagesDiv" class="px-2 pt-3">{% bootstrap_messages %}</div>
{% endif %}
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
@ -72,40 +64,6 @@
target="_blank">Código fuente</a> target="_blank">Código fuente</a>
</p> </p>
</footer> </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> </body>
</html> </html>