From 542ed70c1a41896ead3e64c872c13b7619a2ab58 Mon Sep 17 00:00:00 2001 From: Spark Date: Sun, 11 Oct 2026 12:08:28 -0400 Subject: [PATCH] =?UTF-8?q?fix(board):=20l'indice=20=C2=AB=20Glissez=20une?= =?UTF-8?q?=20carte=20ici=20=C2=BB=20suit=20enfin=20le=20contenu=20des=20c?= =?UTF-8?q?olonnes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rendu par le serveur pour les colonnes vides au chargement, il n'était jamais retiré après un dépôt (signalé par Bruno). Nouvelle fonction refreshEmptyHints() appelée après chaque déplacement et après chaque retour arrière: indice retiré si la colonne contient une carte, rétabli si elle devient vide. SortableJS restreint aux cartes (draggable: '.kanban-card'). Logique vérifiée par mini-test DOM (4 scénarios) en plus de node --check. --- static/js/board.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/static/js/board.js b/static/js/board.js index b735cc9..5195854 100644 --- a/static/js/board.js +++ b/static/js/board.js @@ -28,12 +28,14 @@ document.addEventListener('DOMContentLoaded', () => { new Sortable(col, { group: 'kanban', animation: 200, + draggable: '.kanban-card', ghostClass: 'dragging', onStart: function () { window.__kanbanteDragging = true; }, dragClass: 'dragging', onEnd: function (evt) { window.__kanbanteDragging = false; if (evt.from === evt.to && evt.oldIndex === evt.newIndex) return; + refreshEmptyHints(); const card = evt.item; const formData = new FormData(); formData.append('repo_full_name', card.dataset.repo); @@ -69,6 +71,7 @@ document.addEventListener('DOMContentLoaded', () => { .catch(err => { console.error('Move failed:', err); revert(evt); + refreshEmptyHints(); showToast('❌ Échec du déplacement — carte replacée', true); }); } @@ -115,6 +118,25 @@ document.addEventListener('DOMContentLoaded', () => { } }); + // The "Glissez une carte ici" hint is rendered by the server only + // for columns empty at page load. After a drag, the DOM is the + // truth: remove the hint from columns that hold cards, restore it + // on columns that became empty. (Bug reported 2026-10-11: the + // hint stayed forever after dropping a card into an empty column.) + function refreshEmptyHints() { + document.querySelectorAll('.column-cards').forEach(list => { + const hint = list.querySelector('.column-empty'); + const hasCards = !!list.querySelector('.kanban-card'); + if (hasCards && hint) hint.remove(); + if (!hasCards && !hint) { + const p = document.createElement('p'); + p.className = 'column-empty'; + p.textContent = 'Glissez une carte ici'; + list.appendChild(p); + } + }); + } + function updateCounts() { document.querySelectorAll('.kanban-column').forEach(col => { const count = col.querySelectorAll('.kanban-card').length;