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:
@@ -2,7 +2,7 @@
|
||||
{% extends "admin/base.html" %}
|
||||
{% from 'shared/macros/alerts.html' import alert_dynamic, error_state %}
|
||||
{% from 'shared/macros/headers.html' import page_header_refresh %}
|
||||
{% from 'shared/macros/tables.html' import table_wrapper, table_header, th_sortable %}
|
||||
{% from 'shared/macros/tables.html' import table_wrapper, table_header_custom, th_sortable %}
|
||||
{% from 'shared/macros/pagination.html' import pagination_full %}
|
||||
|
||||
{% block title %}Billing History{% endblock %}
|
||||
@@ -107,7 +107,7 @@
|
||||
<!-- Invoices Table -->
|
||||
{% call table_wrapper() %}
|
||||
<table class="w-full whitespace-nowrap">
|
||||
{% call table_header() %}
|
||||
{% call table_header_custom() %}
|
||||
{{ th_sortable('invoice_date', 'Date', 'sortBy', 'sortOrder') }}
|
||||
<th class="px-4 py-3">Invoice #</th>
|
||||
{{ th_sortable('vendor_name', 'Vendor', 'sortBy', 'sortOrder') }}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{% extends "admin/base.html" %}
|
||||
{% from 'shared/macros/alerts.html' import alert_dynamic, error_state %}
|
||||
{% from 'shared/macros/headers.html' import page_header_refresh %}
|
||||
{% from 'shared/macros/tables.html' import table_wrapper, table_header, th_sortable, empty_state %}
|
||||
{% from 'shared/macros/tables.html' import table_wrapper, table_header_custom, th_sortable, empty_state %}
|
||||
{% from 'shared/macros/modals.html' import modal_confirm %}
|
||||
|
||||
{% block title %}Subscription Tiers{% endblock %}
|
||||
@@ -85,7 +85,7 @@
|
||||
<!-- Tiers Table -->
|
||||
{% call table_wrapper() %}
|
||||
<table class="w-full whitespace-nowrap">
|
||||
{% call table_header() %}
|
||||
{% call table_header_custom() %}
|
||||
<th class="px-4 py-3">#</th>
|
||||
{{ th_sortable('code', 'Code', 'sortBy', 'sortOrder') }}
|
||||
{{ th_sortable('name', 'Name', 'sortBy', 'sortOrder') }}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{% extends "admin/base.html" %}
|
||||
{% from 'shared/macros/alerts.html' import alert_dynamic, error_state %}
|
||||
{% from 'shared/macros/headers.html' import page_header_refresh %}
|
||||
{% from 'shared/macros/tables.html' import table_wrapper, table_header, th_sortable %}
|
||||
{% from 'shared/macros/tables.html' import table_wrapper, table_header_custom, th_sortable %}
|
||||
{% from 'shared/macros/pagination.html' import pagination_full %}
|
||||
|
||||
{% block title %}Vendor Subscriptions{% endblock %}
|
||||
@@ -139,7 +139,7 @@
|
||||
<!-- Subscriptions Table -->
|
||||
{% call table_wrapper() %}
|
||||
<table class="w-full whitespace-nowrap">
|
||||
{% call table_header() %}
|
||||
{% call table_header_custom() %}
|
||||
{{ th_sortable('vendor_name', 'Vendor', 'sortBy', 'sortOrder') }}
|
||||
{{ th_sortable('tier', 'Tier', 'sortBy', 'sortOrder') }}
|
||||
{{ th_sortable('status', 'Status', 'sortBy', 'sortOrder') }}
|
||||
|
||||
@@ -48,6 +48,27 @@
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{#
|
||||
Custom Table Header
|
||||
===================
|
||||
Renders a table header with custom content via caller().
|
||||
Use this when you need th_sortable or custom th elements.
|
||||
|
||||
Usage:
|
||||
{% call table_header_custom() %}
|
||||
{{ th_sortable('name', 'Name', 'sortBy', 'sortOrder') }}
|
||||
<th class="px-4 py-3">Actions</th>
|
||||
{% endcall %}
|
||||
#}
|
||||
{% macro table_header_custom() %}
|
||||
<thead>
|
||||
<tr class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800">
|
||||
{{ caller() }}
|
||||
</tr>
|
||||
</thead>
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{#
|
||||
Sortable Table Header
|
||||
=====================
|
||||
|
||||
Reference in New Issue
Block a user