From e08819210370fa2cde2a4592e531f7c1697b6cae Mon Sep 17 00:00:00 2001 From: Konrad du Plessis Date: Thu, 23 Apr 2026 16:19:38 +0200 Subject: [PATCH] fix(adjustments): convert multi-line {# #} comments to {% comment %} blocks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Checkpoint-1 bug: the row partial's docstring used a multi-line {# ... #} block. Django's single-line comment syntax doesn't match across newlines, so the opening {# and closing #} were treated as literal text and spilled into every rendered row — flooding the table body with the raw comment. Worse, the browser partially parsed the literal inside the comment text as an HTML tag, breaking the table layout entirely. Fix: moved the multi-line docstring into a {% comment %}...{% endcomment %} block and compressed three other multi-line {# #} blocks to single lines. Also tripped on a second foot-gun: you can't put literal {# or #} inside a {% comment %} block — Django's tokenizer still sees them as a nested comment marker. Removed the meta-note about "{# ... #} is single-line only" from inside the comment block. All 58 tests pass. Table renders correctly with all 10 columns + type badges + row actions visible. --- core/templates/core/_adjustment_row.html | 33 +++++++++------------- core/templates/core/payroll_dashboard.html | 7 +---- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/core/templates/core/_adjustment_row.html b/core/templates/core/_adjustment_row.html index 95606ec..b9ab93c 100644 --- a/core/templates/core/_adjustment_row.html +++ b/core/templates/core/_adjustment_row.html @@ -1,14 +1,15 @@ -{# === _adjustment_row.html === - Single used by BOTH the flat Adjustments view and (later) the grouped view. - Context: - - `adj` — a PayrollAdjustment instance - - `additive_types` — list of type labels that are additive (used to decide - whether the amount should be prefixed with + or - in the display) - Row actions differ based on whether the adjustment has already been paid: - - Paid -> single [View Payslip] icon button - - Unpaid -> three buttons: [Preview][Edit][x] - (these reuse the existing modals on the dashboard — no new JS) -#} +{# === _adjustment_row.html — row partial for the Adjustments tab === #} +{% comment %} +Single table row used by BOTH the flat Adjustments view and (later) the grouped view. +Context: + - adj a PayrollAdjustment instance + - additive_types list of type labels that are additive (used to decide + whether the amount should be prefixed with + or - in the display) +Row actions differ by paid status: + - Paid -> single View Payslip icon button + - Unpaid -> three buttons: Preview, Edit, Delete + (these reuse the existing modals on the dashboard -- no new JS) +{% endcomment %} {% load format_tags %} @@ -95,9 +96,8 @@ {% else %} - {# UNPAID: preview + edit + delete #} - {# Preview button — class .preview-payslip-btn is already wired up in the - main dashboard JS (opens the preview modal for this worker). #} + {# UNPAID row: Preview (reuses .preview-payslip-btn handler), #} + {# Edit (reuses .adjustment-badge handler), Delete (opens #deleteConfirmModal). #} - {# Edit button — class .adjustment-badge is already wired up in the - main dashboard JS (populates + opens #editAdjustmentModal). We reuse - it here so no new JS is needed for editing. #} - {# Delete button — opens the existing #deleteConfirmModal directly - (short-circuits the edit modal's usual two-step flow). #}