From 56c1a46b371ffc33509c1dbbee8c5644ed6c2fd2 Mon Sep 17 00:00:00 2001 From: Gregoo Date: Tue, 4 Feb 2025 19:55:34 +0100 Subject: [PATCH] Differentiate between no sort and no sort-and-filter in tables --- static/scripts/table.js | 13 +++++++++++-- templates/instructions/table.html | 4 ++-- templates/macro/table.html | 2 +- templates/wish/table.html | 4 ++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/static/scripts/table.js b/static/scripts/table.js index 669afc5..f96f10b 100644 --- a/static/scripts/table.js +++ b/static/scripts/table.js @@ -1,11 +1,16 @@ class BrickTable { constructor(table, per_page) { - const columns = [] + const columns = []; + const no_sort_and_filter = []; const no_sort = []; const number = []; // Read the table header for parameters table.querySelectorAll('th').forEach((th, index) => { + if (th.dataset.tableNoSortAndFilter) { + no_sort_and_filter.push(index); + } + if (th.dataset.tableNoSort) { no_sort.push(index); } @@ -15,8 +20,12 @@ class BrickTable { } }); + if (no_sort_and_filter.length) { + columns.push({ select: no_sort_and_filter, sortable: false, searchable: false }); + } + if (no_sort.length) { - columns.push({ select: no_sort, sortable: false, searchable: false }); + columns.push({ select: no_sort, sortable: false }); } if (number.length) { diff --git a/templates/instructions/table.html b/templates/instructions/table.html index 8ad9f3c..b2c8007 100644 --- a/templates/instructions/table.html +++ b/templates/instructions/table.html @@ -6,9 +6,9 @@ Filename Set - Image + Image {% if g.login.is_authenticated() %} - Actions + Actions {% endif %} diff --git a/templates/macro/table.html b/templates/macro/table.html index 0638380..32cc63c 100644 --- a/templates/macro/table.html +++ b/templates/macro/table.html @@ -2,7 +2,7 @@ {% if image %} - Image + Image {% endif %} Name {% if color %} diff --git a/templates/wish/table.html b/templates/wish/table.html index 3b03782..ca22242 100644 --- a/templates/wish/table.html +++ b/templates/wish/table.html @@ -5,7 +5,7 @@ - + @@ -13,7 +13,7 @@ {% if g.login.is_authenticated() %} - + {% endif %}
Image Image Set Name Theme Parts Retirement Actions Actions