fix: replace all native confirm() dialogs with styled modal macros
Some checks failed
CI / ruff (push) Successful in 9s
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled

Migrated ~68 native browser confirm() calls across 74 files to use the
project's confirm_modal/confirm_modal_dynamic Jinja2 macros, providing
consistent styled confirmation dialogs instead of plain browser popups.

Modules updated: core, tenancy, cms, marketplace, messaging, billing,
customers, orders, cart. Uses danger/warning/info variants and
double-confirm pattern for destructive delete operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 16:56:25 +01:00
parent 182610283d
commit 167bb50f4f
74 changed files with 939 additions and 436 deletions

View File

@@ -1,5 +1,6 @@
{# app/templates/storefront/cart.html #}
{% extends "storefront/base.html" %}
{% from 'shared/macros/modals.html' import confirm_modal %}
{% block title %}Shopping Cart{% endblock %}
@@ -107,7 +108,7 @@
</div>
<button
@click="removeItem(item.product_id)"
@click="pendingRemoveProductId = item.product_id; showRemoveItemConfirm = true"
:disabled="updating"
class="w-10 h-10 flex items-center justify-center border border-gray-300 dark:border-gray-600 rounded hover:bg-red-600 hover:border-red-600 hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
title="Remove from cart"
@@ -165,6 +166,9 @@
</div>
</div>
<!-- Remove Cart Item Confirm Modal -->
{{ confirm_modal('removeItemConfirm', 'Remove Item', 'Remove this item from your cart?', 'removeItem(pendingRemoveProductId)', 'showRemoveItemConfirm', 'Remove', 'Cancel', 'danger') }}
{% endblock %}
{% block extra_scripts %}
@@ -179,6 +183,8 @@ document.addEventListener('alpine:init', () => {
items: [],
loading: false,
updating: false,
showRemoveItemConfirm: false,
pendingRemoveProductId: null,
// Computed properties
get totalItems() {
@@ -271,10 +277,6 @@ document.addEventListener('alpine:init', () => {
// Remove item from cart
async removeItem(productId) {
if (!confirm('Remove this item from your cart?')) {
return;
}
this.updating = true;
try {