From c7b65417e1d46ec47a2cdcff9d409e3ace211a9b Mon Sep 17 00:00:00 2001 From: Jason Heppler Date: Fri, 26 Apr 2024 16:31:39 -0500 Subject: [PATCH] fix: Provide separate thumbnail handler for documents to resolve missing url completion --- postcards/tables.py | 2 +- theme/templates/postal/document_thumbnail.html | 8 ++++++++ theme/templates/postal/thumbnail.html | 18 ++++-------------- 3 files changed, 13 insertions(+), 15 deletions(-) create mode 100644 theme/templates/postal/document_thumbnail.html diff --git a/postcards/tables.py b/postcards/tables.py index db4f19c..2cf9b80 100644 --- a/postcards/tables.py +++ b/postcards/tables.py @@ -41,7 +41,7 @@ class Meta: class DocumentsHtmxTable(tables.Table): thumbnail = tables.TemplateColumn( - template_name="postal/thumbnail.html", orderable=False + template_name="postal/document_thumbnail.html", orderable=False ) title = tables.Column(accessor="title", verbose_name="Title") doc_type = tables.Column(accessor="document_type", verbose_name="Document Type") diff --git a/theme/templates/postal/document_thumbnail.html b/theme/templates/postal/document_thumbnail.html new file mode 100644 index 0000000..699bda2 --- /dev/null +++ b/theme/templates/postal/document_thumbnail.html @@ -0,0 +1,8 @@ +{% load static %} +{% if record.images.first %} + Thumbnail +

{{ record.item_id }}

+{% else %} + No image available +

{{ record.item_id }}

+{% endif %} \ No newline at end of file diff --git a/theme/templates/postal/thumbnail.html b/theme/templates/postal/thumbnail.html index 4a2a300..10e4359 100644 --- a/theme/templates/postal/thumbnail.html +++ b/theme/templates/postal/thumbnail.html @@ -1,18 +1,8 @@ {% load static %} {% if record.images.first %} - - Thumbnail - -

- - {{ record.item_id }} - -

+ Thumbnail +

{{ record.item_id }}

{% else %} No image available -

- - {{ record.item_id }} - -

-{% endif %} \ No newline at end of file +

{{ record.item_id }}

+{% endif %}