This commit is contained in:
Ross
2025-12-06 18:47:08 +00:00
parent f33a7705d1
commit 09922d7019
10 changed files with 294 additions and 3 deletions
+13 -2
View File
@@ -276,9 +276,20 @@ def preview_card(request, pk):
"""Render a full preview of a card. HTMX loads the modal fragment into #modal-root."""
card = get_object_or_404(Dinosaur, pk=pk)
background = BackgroundImage.get_active() if BackgroundImage.objects.exists() else None
# Support multiple visual designs selectable via `?design=1..5`.
try:
design = int(request.GET.get('design', '1'))
except Exception:
design = 1
if design < 1 or design > 5:
design = 1
template_name = f'cards/_card_preview_design{design}.html'
template_name = f'cards/_card_preview_design{design}.html'
context = {'card': card, 'background': background, 'design': design, 'fragment_template': template_name}
if is_htmx(request):
return render(request, 'cards/_card_preview.html', {'card': card, 'background': background})
return render(request, 'cards/preview.html', {'card': card, 'background': background})
return render(request, template_name, context)
# For non-HTMX full page preview, render the generic preview which can accept design too
return render(request, 'cards/preview.html', context)
def cards_overview(request):