From 6614b04dbddde63e27fc70cba6abc6b93c767f1a Mon Sep 17 00:00:00 2001 From: Pontoporeia Date: Sat, 9 May 2026 20:42:58 +0200 Subject: [PATCH] Fix bulk form nesting, remove count bar, stopPropagation on actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove admin-bulk-meta__default (TFE count bar) — only bulk actions on selection - Move #bulk-form out of table wrapper to avoid nested forms (was breaking per-row publish/unpublish which submitted to bulk form instead) - execBulk() now populates #bulk-checkboxes with hidden inputs from checked boxes - Add event.stopPropagation() to edit link and delete+publish forms so clicking actions doesn't navigate the row to recapitulatif - Delete button: only opens confirm modal, no row nav --- TODO.md | 3 ++ app/templates/admin/acces.php | 4 --- app/templates/admin/index-table.php | 49 ++++++++++------------------- app/templates/admin/index.php | 2 +- 4 files changed, 20 insertions(+), 38 deletions(-) diff --git a/TODO.md b/TODO.md index 5b5961c..08ba51f 100644 --- a/TODO.md +++ b/TODO.md @@ -58,3 +58,6 @@ - [x] Row click opens link in new tab, remove Visiter button - [x] Add update action to acces-etudiante.php controller - [x] Add ShareLink::update() method +- [x] Remove admin-bulk-meta__default (count bar), clean up layout +- [x] Fix nested form issue: per-row publish/unpublish buttons now submit correctly +- [x] Fix delete button: stopPropagation prevents row nav on confirm diff --git a/app/templates/admin/acces.php b/app/templates/admin/acces.php index 63879f4..3b09d79 100644 --- a/app/templates/admin/acces.php +++ b/app/templates/admin/acces.php @@ -45,10 +45,6 @@ $linkName = $link['name'] ?? ''; $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; $linkLockedYear = $link['locked_year'] ?? null; -%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) -\\\\\\\ to: vumvtlyz 95fdf9fe "Rename Liens étudiant·e, add link name + edit dialog" (rebased revision) -+ $linkName = $link['name'] ?? ''; -+ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; ?> diff --git a/app/templates/admin/index-table.php b/app/templates/admin/index-table.php index 3d305da..79f4f71 100644 --- a/app/templates/admin/index-table.php +++ b/app/templates/admin/index-table.php @@ -21,27 +21,22 @@ $sortArrow = function(string $col) use ($sortCol, $sortDir): string {
+ + +
- - -
-
- TFE -
- -
- - +
+
@@ -85,10 +80,10 @@ $sortArrow = function(string $col) use ($sortCol, $sortDir): string {
- + -
+ @@ -103,11 +98,11 @@ $sortArrow = function(string $col) use ($sortCol, $sortDir): string {
-
+
@@ -119,18 +114,6 @@ $sortArrow = function(string $col) use ($sortCol, $sortDir): string {
- - - - - diff --git a/app/templates/admin/index.php b/app/templates/admin/index.php index bea0099..ffcae82 100644 --- a/app/templates/admin/index.php +++ b/app/templates/admin/index.php @@ -2,7 +2,7 @@ function toggleAll(src){document.querySelectorAll('input[name="selected_theses[]"]').forEach(cb=>cb.checked=src.checked);updateBulk();} function updateBulk(){const n=document.querySelectorAll('input[name="selected_theses[]"]:checked').length;const b=document.getElementById('bulk-actions');document.getElementById('selected-count').textContent=n;b.style.display=n>0?'flex':'none';} function confirmBulk(act){const n=document.querySelectorAll('input[name="selected_theses[]"]:checked').length;if(!n){document.getElementById('no-selection-dialog').showModal();return;}document.getElementById('bulk-action-input').value=act;if(act==='delete'){document.getElementById('bulk-delete-count').textContent=n;document.getElementById('bulk-delete-dialog').showModal();}else{document.getElementById('bulk-confirm-word').textContent=act==='publish'?'Publier':'Dépublier';document.getElementById('bulk-confirm-count').textContent=n;document.getElementById('bulk-confirm-dialog').showModal();}} -function execBulk(){const a=document.getElementById('bulk-action-input').value;const f=document.getElementById('bulk-form');f.action = a==='delete' ? 'actions/delete.php' : 'actions/publish.php';f.submit();} +function execBulk(){const a=document.getElementById('bulk-action-input').value;const f=document.getElementById('bulk-form');f.action = a==='delete' ? 'actions/delete.php' : 'actions/publish.php';const c=document.getElementById('bulk-checkboxes');c.innerHTML='';document.querySelectorAll('input[name="selected_theses[]"]:checked').forEach(cb=>{const inp=document.createElement('input');inp.type='hidden';inp.name='selected_theses[]';inp.value=cb.value;c.appendChild(inp);});f.submit();} function confirmDelete(id,title){document.getElementById('delete-thesis-title').textContent=title;document.getElementById('delete-thesis-dialog').showModal();document.getElementById('delete-dialog-confirm').onclick=function(){document.getElementById('delete-form-'+id).submit();};} document.addEventListener('DOMContentLoaded',()=>{document.querySelectorAll('input[name="selected_theses[]"]').forEach(cb=>cb.addEventListener('change',updateBulk));}); document.addEventListener('htmx:afterSwap',()=>{document.querySelectorAll('input[name="selected_theses[]"]').forEach(cb=>cb.addEventListener('change',updateBulk));updateBulk();});