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
+1 -8
View File
@@ -1,7 +1,7 @@
{% import 'macro/table.html' as table %}
<div class="table-responsive-sm">
<table class="table table-striped align-middle {% if not all %}sortable mb-0{% endif %}" {% if all %}id="parts"{% endif %}>
<table data-table="{% if all %}true{% endif %}" class="table table-striped align-middle {% if not all %}sortable mb-0{% endif %}" {% if all %}id="parts"{% endif %}>
{{ table.header(color=true, quantity=not no_quantity, missing=not no_missing, sets=all, minifigures=all) }}
<tbody>
{% for item in table_collection %}
@@ -51,10 +51,3 @@
</tbody>
</table>
</div>
{% if all %}
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", () => {
new BrickTable('parts', {{ config['DEFAULT_TABLE_PER_PAGE'] }}, [0], [3, 4, 5, 6]);
});
</script>
{% endif %}