Simplify the way javascript is loaded (we don't have that many scripts running) and use data attribute to instantiate grid and tables

This commit is contained in:
2025-01-24 15:55:15 +01:00
parent 623b205733
commit 982a1fa8db
25 changed files with 71 additions and 152 deletions

View File

@@ -58,7 +58,7 @@
</div>
</div>
<div class="row" id="grid">
<div class="row" data-grid="true" id="grid">
{% for item in collection %}
<div class="col-md-6 col-xl-3 d-flex align-items-stretch">
{% with index=loop.index0 %}
@@ -67,19 +67,8 @@
</div>
{% endfor %}
</div>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", () => {
new BrickGrid("grid");
setup_changers();
});
</script>
</div>
{% else %}
{% include 'set/empty.html' %}
{% endif %}
{% endblock %}
{% block scripts %}
<script src="{{ url_for('static', filename='scripts/grid.js') }}"></script>
<script src="{{ url_for('static', filename='scripts/changer.js') }}"></script>
{% endblock %}