From 18dbb27a3eea48b4b6ce2899e4c33feabb110075 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 15 Dec 2025 10:06:54 +0000 Subject: [PATCH] Enhance resource handling: add support for loading and displaying non-DICOM resources (images, videos, embeds) in viewer overlays --- atlas/templates/atlas/case_display_block.html | 76 ++++----- atlas/templates/atlas/collection_viva.html | 29 ++++ atlas/templates/atlas/viewer.html | 148 +++++++++++++++++- atlas/templates/atlas/viewer_local.html | 71 +++++++++ 4 files changed, 284 insertions(+), 40 deletions(-) diff --git a/atlas/templates/atlas/case_display_block.html b/atlas/templates/atlas/case_display_block.html index b10bb4da..08826e78 100755 --- a/atlas/templates/atlas/case_display_block.html +++ b/atlas/templates/atlas/case_display_block.html @@ -108,51 +108,51 @@ {% else %} - + {% endif %} -
-
- ID: {{ case.id }} - / - {{ case.created_date|date:"d/m/Y" }} -
+
+
+ ID: {{ case.id }} + / + {{ case.created_date|date:"d/m/Y" }} +
-
+
{# Subspecialty badges (preserve any anchor returned by get_link) #} - {% if case.subspecialty.all %} - {% for sub in case.subspecialty.all %} - {{ sub.get_link|safe }} - {% endfor %} - {% else %} - No subspecialty - {% endif %} + {% if case.subspecialty.all %} + {% for sub in case.subspecialty.all %} + {{ sub.get_link|safe }} + {% endfor %} + {% else %} + No subspecialty + {% endif %} {# Pathological process badges #} - {% if case.pathological_process.all %} - {% for p in case.pathological_process.all %} - {{ p.get_link|safe }} - {% endfor %} - {% endif %} + {% if case.pathological_process.all %} + {% for p in case.pathological_process.all %} + {{ p.get_link|safe }} + {% endfor %} + {% endif %} {# Diagnostic certainty as a badge #} - Diagnostic certainty: {{ case.get_diagnostic_certainty_display }} + Diagnostic certainty: {{ case.get_diagnostic_certainty_display }} {# Normal toggle HTMX block #} -
- {% include "atlas/partials/_normal_toggle.html" %} +
+ {% include "atlas/partials/_normal_toggle.html" %} +
-
Viewer @@ -175,7 +175,7 @@

-
+
History
@@ -492,12 +492,12 @@

- + {% if casedetail %} {% include 'atlas/partials/collection_question_block.html' with can_edit=can_edit %} - + {% endif %} - + diff --git a/atlas/templates/atlas/collection_viva.html b/atlas/templates/atlas/collection_viva.html index cb657ff7..616ff57d 100644 --- a/atlas/templates/atlas/collection_viva.html +++ b/atlas/templates/atlas/collection_viva.html @@ -71,6 +71,22 @@ + {# Attached resources for this case: allow loading into the shared viewer #} + {% if case.caseresource_set.exists %} +
+ Resources: +
+ {% for cr in case.caseresource_set.all %} + {% with res=cr.resource %} +
+ {{ res.name }} + +
+ {% endwith %} + {% endfor %} +
+
+ {% endif %} {% if case.display_sets.all %}
Display Sets: {% for ds in case.display_sets.all %} @@ -335,6 +351,19 @@ //} //win2 = openSecondaryWindow(url); }) + // Load resource into linked viewer + $('.open-resource').click(function() { + var src = $(this).data('src'); + var title = $(this).data('title') || 'Resource'; + $('#loading-case').show(); + $("#open-viewer-local").addClass("flash-button"); + $('#current-case-title').html("Resource: "+title); + $('#current-case-history').html(''); + $('#current-case-discussion').html(''); + $('#current-case-report').html(''); + + bc.postMessage({"type": "open", "url": src}); + }); $('.send-message').click(function() { var url = $(this).data('target'); bc.postMessage(url); diff --git a/atlas/templates/atlas/viewer.html b/atlas/templates/atlas/viewer.html index 01151d28..aed14352 100644 --- a/atlas/templates/atlas/viewer.html +++ b/atlas/templates/atlas/viewer.html @@ -18,7 +18,14 @@

Awating load request

This page will display series when loaded from other pages. - +
+ + +