From 6e3c5554aa041d694b51c84a41e35a643eac2190 Mon Sep 17 00:00:00 2001 From: Deeman Date: Thu, 5 Mar 2026 09:48:54 +0100 Subject: [PATCH] fix(admin): enable bulk actions in grouped articles view - dev_run.sh: also remove app.db-shm and app.db-wal on reset to fix SQLite disk I/O error from stale WAL/SHM files - articles bulk: add checkboxes to grouped rows (data-ids holds all variant IDs); checking a group selects EN+DE together - restore select-all checkbox in grouped - add toggleArticleGroupSelect() JS function - fix htmx:afterSwap to re-check group checkboxes correctly Co-Authored-By: Claude Sonnet 4.6 --- web/scripts/dev_run.sh | 2 +- .../admin/templates/admin/articles.html | 16 +++++++++++++++- .../admin/partials/article_group_row.html | 6 +++++- .../admin/partials/article_results.html | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/web/scripts/dev_run.sh b/web/scripts/dev_run.sh index 8aa8a8f..5a1ec1d 100755 --- a/web/scripts/dev_run.sh +++ b/web/scripts/dev_run.sh @@ -48,7 +48,7 @@ PADDLE_ENVIRONMENT=${PADDLE_ENVIRONMENT:-sandbox} # -- Preparation ------------------------------------------------------------- info "Resetting database" -rm -f "$DATABASE_PATH" +rm -f "$DATABASE_PATH" "${DATABASE_PATH}-shm" "${DATABASE_PATH}-wal" ok "Removed $DATABASE_PATH" info "Running migrations" diff --git a/web/src/padelnomics/admin/templates/admin/articles.html b/web/src/padelnomics/admin/templates/admin/articles.html index 5d744ca..bf9990d 100644 --- a/web/src/padelnomics/admin/templates/admin/articles.html +++ b/web/src/padelnomics/admin/templates/admin/articles.html @@ -108,6 +108,15 @@ function toggleArticleSelect(id, checked) { updateArticleBulkBar(); } +function toggleArticleGroupSelect(checkbox) { + var ids = (checkbox.dataset.ids || '').split(',').map(Number).filter(Boolean); + ids.forEach(function(id) { + if (checkbox.checked) articleSelectedIds.add(id); + else articleSelectedIds.delete(id); + }); + updateArticleBulkBar(); +} + function clearArticleSelection() { articleSelectedIds.clear(); document.querySelectorAll('.article-checkbox').forEach(function(cb) { cb.checked = false; }); @@ -152,7 +161,12 @@ function submitArticleBulk() { document.body.addEventListener('htmx:afterSwap', function(evt) { if (evt.detail.target.id === 'article-results') { document.querySelectorAll('.article-checkbox').forEach(function(cb) { - if (articleSelectedIds.has(Number(cb.dataset.id))) cb.checked = true; + if (cb.dataset.ids) { + var ids = cb.dataset.ids.split(',').map(Number).filter(Boolean); + cb.checked = ids.length > 0 && ids.every(function(id) { return articleSelectedIds.has(id); }); + } else { + cb.checked = articleSelectedIds.has(Number(cb.dataset.id)); + } }); } }); diff --git a/web/src/padelnomics/admin/templates/admin/partials/article_group_row.html b/web/src/padelnomics/admin/templates/admin/partials/article_group_row.html index c4f3c5f..1110395 100644 --- a/web/src/padelnomics/admin/templates/admin/partials/article_group_row.html +++ b/web/src/padelnomics/admin/templates/admin/partials/article_group_row.html @@ -1,5 +1,9 @@ - + + +
{{ g.title }}
{{ g.url_path }}
diff --git a/web/src/padelnomics/admin/templates/admin/partials/article_results.html b/web/src/padelnomics/admin/templates/admin/partials/article_results.html index 4f8a14a..3aa1048 100644 --- a/web/src/padelnomics/admin/templates/admin/partials/article_results.html +++ b/web/src/padelnomics/admin/templates/admin/partials/article_results.html @@ -57,7 +57,7 @@ {% if not grouped %} {% else %} - + {% endif %} Title {% if grouped %}Variants{% else %}Status{% endif %}