fix: use table_header_custom for custom headers in subscription pages

The table_header() macro doesn't support caller() - it takes a columns list.
Using {% call table_header() %} caused a Jinja2 error:
  "macro 'table_header' was invoked with two values for the special caller argument"

Changes:
- Add table_header_custom() macro that supports caller() for custom headers
- Update subscriptions.html, subscription-tiers.html, billing-history.html
- Add TPL-008 architecture rule to detect this pattern
- Renumber TPL-009 (block names) and TPL-010 (Alpine vars)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-25 22:25:33 +01:00
parent e21abd4c32
commit 6bd4b71588
6 changed files with 103 additions and 15 deletions

View File

@@ -381,6 +381,37 @@ template_rules:
recommended_pattern: '<template x-if="items.length === 0">No items</template>'
- id: "TPL-008"
name: "Use table_header_custom for custom headers, not table_header"
severity: "error"
description: |
When using {% call %} to create custom table headers with th_sortable
or custom <th> elements, you MUST use table_header_custom(), not table_header().
The table_header() macro takes a columns list and does NOT support caller().
Using {% call table_header() %} causes a Jinja2 error:
"macro 'table_header' was invoked with two values for the special caller argument"
WRONG (causes 500 error):
{% call table_header() %}
{{ th_sortable('name', 'Name', 'sortBy', 'sortOrder') }}
<th class="px-4 py-3">Actions</th>
{% endcall %}
RIGHT (supports caller):
{% call table_header_custom() %}
{{ th_sortable('name', 'Name', 'sortBy', 'sortOrder') }}
<th class="px-4 py-3">Actions</th>
{% endcall %}
OR for simple headers (list of column names):
{{ table_header(['Name', 'Email', 'Status', 'Actions']) }}
pattern:
file_pattern: "app/templates/**/*.html"
anti_patterns:
- "{%\\s*call\\s+table_header\\s*\\(\\s*\\)\\s*%}"
required_alternative: "table_header_custom"
- id: "TPL-009"
name: "Use valid block names from base templates"
severity: "error"
description: |