fix: context-aware back button for cross-module admin navigation
All checks were successful
CI / ruff (push) Successful in 16s
CI / pytest (push) Successful in 2h40m11s
CI / validate (push) Successful in 32s
CI / dependency-scanning (push) Successful in 37s
CI / docs (push) Successful in 49s
CI / deploy (push) Successful in 1m10s

The tenancy merchant detail page now reads an optional ?back= query
parameter to determine the back button destination. Falls back to
/admin/merchants when no param is present (default behavior preserved).

The loyalty merchant detail "View Merchant" link now passes
?back=/admin/loyalty/merchants/{id} so clicking back from the tenancy
page returns to the loyalty context instead of the merchants list.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 16:37:28 +01:00
parent f3344b2859
commit edd55cd2fd
2 changed files with 2 additions and 4 deletions

View File

@@ -41,12 +41,10 @@
{{ _('loyalty.admin.merchant_detail.admin_policy') }} {{ _('loyalty.admin.merchant_detail.admin_policy') }}
</a> </a>
<a <a
:href="`/admin/merchants/${merchant?.id}`" :href="`/admin/merchants/${merchant?.id}?back=/admin/loyalty/merchants/${merchantId}`"
target="_blank"
class="flex items-center px-4 py-2 text-sm font-medium leading-5 text-gray-700 transition-colors duration-150 bg-gray-100 border border-gray-300 rounded-lg hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-600"> class="flex items-center px-4 py-2 text-sm font-medium leading-5 text-gray-700 transition-colors duration-150 bg-gray-100 border border-gray-300 rounded-lg hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-600">
<span x-html="$icon('building-office', 'w-4 h-4 mr-2')"></span> <span x-html="$icon('building-office', 'w-4 h-4 mr-2')"></span>
{{ _('loyalty.admin.merchant_detail.view_merchant') }} {{ _('loyalty.admin.merchant_detail.view_merchant') }}
<span x-html="$icon('arrow-top-right-on-square', 'w-3 h-3 ml-1 opacity-50')"></span>
</a> </a>
<a x-show="program" <a x-show="program"
:href="`/admin/loyalty/merchants/${merchantId}/cards`" :href="`/admin/loyalty/merchants/${merchantId}/cards`"

View File

@@ -11,7 +11,7 @@
{% block alpine_data %}adminMerchantDetail(){% endblock %} {% block alpine_data %}adminMerchantDetail(){% endblock %}
{% block content %} {% block content %}
{% call detail_page_header("merchant?.name || 'Merchant Details'", '/admin/merchants', subtitle_show='merchant') %} {% call detail_page_header("merchant?.name || 'Merchant Details'", request.query_params.get('back', '/admin/merchants'), subtitle_show='merchant') %}
ID: <span x-text="merchantId"></span> ID: <span x-text="merchantId"></span>
<span class="text-gray-400 mx-2">|</span> <span class="text-gray-400 mx-2">|</span>
<span x-text="merchant?.store_count || 0"></span> store(s) <span x-text="merchant?.store_count || 0"></span> store(s)