Bläddra i källkod

Fix: stamp data-col on JS-built task row cells

The server-rendered task rows in views/sprints/show.php tag every cell
that can be toggled by the Columns dropdown (Phase 10) or the Focus
auto-hide (Phase 13) with data-col="owner" / "prio" / "tot" / "sw-{id}".
buildTaskRow in sprint-planner.js (the code path that runs when a user
clicks "+ Add task") was missing those attributes, so for newly-created
tasks:

- toggling a column off via the Columns dropdown did not hide the new
  row's cell;
- the Phase 13 focus-column auto-hide could not collapse an sw column
  to nothing even when the new task had zero assignment for every
  visible worker.

Add data-col to all four cell types in buildTaskRow, and call
applyColumnVisibility() after the new row is appended so the user's
current hidden-columns selection applies to it immediately. applyFilters
already ran; it was the column-visibility pass that was skipped.

No schema / routes / audit changes. phpunit unchanged (88/88, 208
assertions). Syntax-check: node --check clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
achiappa 2 veckor sedan
förälder
incheckning
23ab365f1e
1 ändrade filer med 5 tillägg och 3 borttagningar
  1. 5 3
      public/assets/js/sprint-planner.js

+ 5 - 3
public/assets/js/sprint-planner.js

@@ -354,22 +354,23 @@
             if (Number(o.id) === Number(task.owner_worker_id)) { $opt.attr('selected', 'selected'); }
             $sel.append($opt);
         });
-        $tr.append($('<td class="px-2 py-1"></td>').append($sel));
+        $tr.append($('<td class="px-2 py-1" data-col="owner"></td>').append($sel));
 
         // priority
         const $prio = $('<select data-prio-select class="rounded border border-slate-200 px-2 py-1 bg-white font-mono focus:outline-none focus:ring-2 focus:ring-slate-400"><option value="1">1</option><option value="2">2</option></select>');
         $prio.val(String(task.priority));
-        $tr.append($('<td class="px-2 py-1 text-center"></td>').append($prio));
+        $tr.append($('<td class="px-2 py-1 text-center" data-col="prio"></td>').append($prio));
 
         // tot
         let tot = 0;
         Object.keys(assignments).forEach(function (k) { tot += Number(assignments[k]) || 0; });
-        $tr.append($('<td class="px-2 py-1 text-center font-mono font-semibold" data-task-tot>').text(fmtDays(tot)));
+        $tr.append($('<td class="px-2 py-1 text-center font-mono font-semibold" data-col="tot" data-task-tot>').text(fmtDays(tot)));
 
         // per-worker assignment cells
         sprintWorkerHeaders().forEach(function (sw) {
             const v = Number(assignments[sw.id] || 0);
             const $td = $('<td class="px-1 py-1 text-center"></td>')
+                .attr('data-col', 'sw-' + sw.id)
                 .attr('data-sort-value-sw-' + sw.id, v.toFixed(2));
             $td.append(
                 $('<input type="number" min="0" step="0.5" data-assign class="w-14 rounded border border-slate-200 px-1 py-1 text-center font-mono focus:outline-none focus:ring-2 focus:ring-slate-400">')
@@ -399,6 +400,7 @@
                 $taskTbody.append($row);
                 // Clear any active sort so the new row is actually visible at the end.
                 clearSort();
+                applyColumnVisibility();
                 applyFilters();
                 $row.find('[data-title]').trigger('focus').trigger('select');
                 flash('Task added');