refactor: remove backward compatibility code for pre-launch baseline
Clean up accumulated backward-compat shims, deprecated wrappers, unused aliases, and legacy code across the codebase. Since the platform is not live yet, this establishes a clean baseline. Changes: - Delete deprecated middleware/context.py (RequestContext, get_request_context) - Remove unused factory get_store_email_settings_service() - Remove deprecated pagination_full macro, /admin/platform-homepage route - Remove ConversationResponse, InvoiceSettings* unprefixed aliases - Simplify celery_config.py (remove empty LEGACY_TASK_MODULES) - Standardize billing exceptions: *Error aliases → *Exception names - Consolidate duplicate TierNotFoundError/FeatureNotFoundError classes - Remove deprecated is_admin_request() from Store/PlatformContextManager - Remove is_platform_default field, MediaUploadResponse legacy flat fields - Remove MediaItemResponse.url alias, update JS to use file_url - Update all affected tests and documentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -93,92 +93,6 @@
|
||||
{{ pagination_simple() }}
|
||||
#}
|
||||
|
||||
{#
|
||||
Pagination Full Macro (First/Prev/Numbers/Next/Last)
|
||||
=====================================================
|
||||
⚠️ DEPRECATED: Use the standard 'pagination' macro instead.
|
||||
|
||||
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
|
||||
- total: Total number of items
|
||||
- limit: Items per page
|
||||
- skip: Current skip value (page - 1) * limit
|
||||
- totalPages: Computed total pages (Math.ceil(total / limit))
|
||||
|
||||
Required Alpine.js methods:
|
||||
- getPageNumbers(): Returns array of page numbers to display
|
||||
- goToPage(pageNum): Go to specific page
|
||||
- loadData(): Function to reload data (called internally as loadFn parameter)
|
||||
#}
|
||||
|
||||
{% macro pagination_full(show_condition="total > limit", load_fn="loadData()", item_label="items") %}
|
||||
<div x-show="{{ show_condition }}" class="flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t dark:border-gray-700">
|
||||
<span class="text-sm text-gray-600 dark:text-gray-400">
|
||||
Showing <span x-text="skip + 1"></span>-<span x-text="Math.min(skip + limit, total)"></span> of <span x-text="total"></span> {{ item_label }}
|
||||
</span>
|
||||
<div class="flex items-center gap-1">
|
||||
{# First Page #}
|
||||
<button
|
||||
@click="page = 1; {{ load_fn }}"
|
||||
:disabled="page <= 1"
|
||||
class="px-2 py-1 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
title="First page"
|
||||
>
|
||||
<span x-html="$icon('chevron-double-left', 'w-4 h-4')"></span>
|
||||
</button>
|
||||
{# Previous Page #}
|
||||
<button
|
||||
@click="page--; {{ load_fn }}"
|
||||
:disabled="page <= 1"
|
||||
class="px-2 py-1 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
title="Previous page"
|
||||
>
|
||||
<span x-html="$icon('chevron-left', 'w-4 h-4')"></span>
|
||||
</button>
|
||||
{# Page Numbers #}
|
||||
<template x-for="p in getPageNumbers()" :key="p">
|
||||
<button
|
||||
@click="goToPage(p)"
|
||||
class="px-3 py-1 text-sm font-medium rounded-md border transition-colors"
|
||||
:class="p === page
|
||||
? 'bg-purple-600 text-white border-purple-600 dark:bg-purple-500 dark:border-purple-500'
|
||||
: 'text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600'"
|
||||
x-text="p"
|
||||
></button>
|
||||
</template>
|
||||
{# Next Page #}
|
||||
<button
|
||||
@click="page++; {{ load_fn }}"
|
||||
:disabled="page >= totalPages"
|
||||
class="px-2 py-1 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
title="Next page"
|
||||
>
|
||||
<span x-html="$icon('chevron-right', 'w-4 h-4')"></span>
|
||||
</button>
|
||||
{# Last Page #}
|
||||
<button
|
||||
@click="page = totalPages; {{ load_fn }}"
|
||||
:disabled="page >= totalPages"
|
||||
class="px-2 py-1 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
title="Last page"
|
||||
>
|
||||
<span x-html="$icon('chevron-double-right', 'w-4 h-4')"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro pagination_simple(show_condition="true") %}
|
||||
<div x-show="{{ show_condition }}" class="flex items-center justify-between px-4 py-3 bg-white border-t border-gray-200 dark:border-gray-700 dark:bg-gray-800">
|
||||
<div class="flex items-center">
|
||||
|
||||
Reference in New Issue
Block a user