diff --git a/app/templates/admin/billing-history.html b/app/templates/admin/billing-history.html index 21048f6c..3ce8261e 100644 --- a/app/templates/admin/billing-history.html +++ b/app/templates/admin/billing-history.html @@ -3,7 +3,7 @@ {% 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_custom, th_sortable %} -{% from 'shared/macros/pagination.html' import pagination_full %} +{% from 'shared/macros/pagination.html' import pagination %} {% block title %}Billing History{% endblock %} @@ -198,7 +198,7 @@ {% endcall %} -{{ pagination_full() }} +{{ pagination(show_condition="!loading && pagination.total > 0") }} {% endblock %} diff --git a/app/templates/shared/macros/pagination.html b/app/templates/shared/macros/pagination.html index 4b415ca7..43084850 100644 --- a/app/templates/shared/macros/pagination.html +++ b/app/templates/shared/macros/pagination.html @@ -96,11 +96,17 @@ {# Pagination Full Macro (First/Prev/Numbers/Next/Last) ===================================================== - A full pagination component with first, previous, page numbers, next, and last buttons. + ⚠️ DEPRECATED: Use the standard 'pagination' macro instead. - Usage: - {% from 'shared/macros/pagination.html' import pagination_full %} - {{ pagination_full() }} + This macro expects flat variables (total, skip, page, limit) but our Alpine.js + components use nested pagination objects (pagination.total, pagination.page, etc.). + + Use: + {% from 'shared/macros/pagination.html' import pagination %} + {{ pagination(show_condition="!loading && pagination.total > 0") }} + + --- + Legacy documentation (for reference only): Required Alpine.js data properties: - page: Current page number diff --git a/scripts/validate_architecture.py b/scripts/validate_architecture.py index 3cc7c8bf..951c83bf 100755 --- a/scripts/validate_architecture.py +++ b/scripts/validate_architecture.py @@ -1135,6 +1135,37 @@ class ArchitectureValidator: suggestion=f"Use '{{% block {invalid_blocks[block_name]} %}}' instead", ) + def _check_deprecated_macros( + self, file_path: Path, content: str, lines: list[str] + ): + """TPL-011: Check for usage of deprecated macros""" + if "noqa: tpl-011" in content.lower(): + return + + # Deprecated macros and their replacements + deprecated_macros = { + "pagination_full": { + "replacement": "pagination", + "reason": "pagination_full expects flat variables (total, skip, page, limit) but components use nested pagination object", + }, + } + + for i, line in enumerate(lines, 1): + for macro_name, info in deprecated_macros.items(): + if macro_name in line and "# deprecated" not in line.lower(): + # Check if it's an import or usage + if f"import {macro_name}" in line or f"{{ {macro_name}" in line or f"{{{macro_name}" in line: + self._add_violation( + rule_id="TPL-011", + rule_name="Avoid deprecated macros", + severity=Severity.WARNING, + file_path=file_path, + line_number=i, + message=f"Deprecated macro '{macro_name}' used - {info['reason']}", + context=line.strip()[:80], + suggestion=f"Use '{info['replacement']}' macro instead", + ) + def _check_alpine_template_vars( self, file_path: Path, content: str, lines: list[str], js_content: str ): @@ -2995,6 +3026,9 @@ class ArchitectureValidator: js_content = js_file.read_text() self._check_alpine_template_vars(file_path, content, lines, js_content) + # TPL-011: Check for deprecated macros + self._check_deprecated_macros(file_path, content, lines) + # Skip base/partials for TPL-001 check if is_base_or_partial: continue