From 1e2300bd706038b971f2d1b8ebaa8de96b6f4d08 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 15 Dec 2025 09:47:07 +0000 Subject: [PATCH] Add media preview functionality for resources with image or video support --- .../atlas/partials/resource_media.html | 146 ++++++++++++++++++ atlas/templates/atlas/resource_detail.html | 16 ++ 2 files changed, 162 insertions(+) create mode 100644 atlas/templates/atlas/partials/resource_media.html diff --git a/atlas/templates/atlas/partials/resource_media.html b/atlas/templates/atlas/partials/resource_media.html new file mode 100644 index 00000000..d64a2843 --- /dev/null +++ b/atlas/templates/atlas/partials/resource_media.html @@ -0,0 +1,146 @@ +
+ +
+ + + + diff --git a/atlas/templates/atlas/resource_detail.html b/atlas/templates/atlas/resource_detail.html index 43c7c563..8f604856 100755 --- a/atlas/templates/atlas/resource_detail.html +++ b/atlas/templates/atlas/resource_detail.html @@ -14,6 +14,22 @@ by {{ resource.get_authors|default:"Unknown" }}
+ {# Media preview: image or video autosized, clickable to open full-size modal #} + {% if resource.file or resource.url %} +
+ {% comment %}Prefer local file if present, otherwise try URL{% endcomment %} + {% if resource.file %} + {% with src=resource.file.url %} + {% include 'atlas/partials/resource_media.html' with src=src resource=resource %} + {% endwith %} + {% else %} + {% with src=resource.url %} + {% include 'atlas/partials/resource_media.html' with src=src resource=resource %} + {% endwith %} + {% endif %} +
+ {% endif %} + {% if resource.description %}

{{ resource.description|linebreaksbr }}

{% endif %}