diff --git a/atlas/static/atlas/js/markup_inserter.js b/atlas/static/atlas/js/markup_inserter.js
index f60dfbfc..ab71813c 100644
--- a/atlas/static/atlas/js/markup_inserter.js
+++ b/atlas/static/atlas/js/markup_inserter.js
@@ -331,7 +331,32 @@
var popup = document.createElement('div'); popup.id = 'markup-popup'; popup.className = 'markup-popup';
popup.innerHTML = '
'+ (label||type+':'+pk) +'
';
var openBtn = document.createElement('button'); openBtn.type='button'; openBtn.className='btn btn-sm btn-outline-primary me-2'; openBtn.textContent='Open';
- openBtn.addEventListener('click', function(){ var url = getDetailUrl(type, pk); if(url) showModalForUrl(url, label); popup.remove(); });
+ openBtn.addEventListener('click', function(){
+ var url = getDetailUrl(type, pk);
+ try{
+ // Prefer page-specific modal loaders if present so we reuse existing Bootstrap modals/viewers
+ if(type === 'displayset'){
+ if(typeof window.loadDisplaysetModal === 'function'){
+ window.loadDisplaysetModal(url, pk);
+ popup.remove();
+ return;
+ }
+ var dsBtn = document.querySelector('.view-displayset-modal[data-ds-id="'+pk+'"]');
+ if(dsBtn){ dsBtn.click(); popup.remove(); return; }
+ }
+ if(type === 'seriesfinding' || type === 'finding'){
+ if(typeof window.loadFindingModal === 'function'){
+ window.loadFindingModal(pk, url);
+ popup.remove();
+ return;
+ }
+ var fBtn = document.querySelector('.view-finding-modal[data-finding-id="'+pk+'"]');
+ if(fBtn){ fBtn.click(); popup.remove(); return; }
+ }
+ }catch(e){ console.warn('error invoking page modal loader', e); }
+ if(url) showModalForUrl(url, label);
+ popup.remove();
+ });
var closeBtn = document.createElement('button'); closeBtn.type='button'; closeBtn.className='btn btn-sm btn-outline-secondary'; closeBtn.textContent='Close'; closeBtn.addEventListener('click', function(){ popup.remove(); });
popup.appendChild(openBtn); popup.appendChild(closeBtn);
document.body.appendChild(popup);
diff --git a/atlas/templates/atlas/case_display_block.html b/atlas/templates/atlas/case_display_block.html
index 4449701f..09c5ca31 100755
--- a/atlas/templates/atlas/case_display_block.html
+++ b/atlas/templates/atlas/case_display_block.html
@@ -868,53 +868,7 @@
{% include 'question_notes.html' %}
-
-
-
-
-
-
+{% include 'atlas/partials/_displayset_modals.html' %}
Checked by: {% for verified in case.verified.all %} {{verified}}, {% endfor %}
@@ -925,23 +879,7 @@
Case size: {{ case.get_total_series_images_size | filesizeformat }}
-
+{% include 'atlas/partials/_finding_modal.html' %}
diff --git a/atlas/templates/atlas/partials/_displayset_modals.html b/atlas/templates/atlas/partials/_displayset_modals.html
new file mode 100644
index 00000000..ca380d4c
--- /dev/null
+++ b/atlas/templates/atlas/partials/_displayset_modals.html
@@ -0,0 +1,47 @@
+
+
+
+
+
+
diff --git a/atlas/templates/atlas/partials/_finding_modal.html b/atlas/templates/atlas/partials/_finding_modal.html
new file mode 100644
index 00000000..7279e495
--- /dev/null
+++ b/atlas/templates/atlas/partials/_finding_modal.html
@@ -0,0 +1,17 @@
+