fix: Correct indentation for hx-include attribute in case search widget

This commit is contained in:
Ross
2026-04-27 23:11:57 +01:00
parent 4a787aa3eb
commit 56a644c5c1
2 changed files with 7 additions and 93 deletions
+6 -92
View File
@@ -474,7 +474,6 @@
<details class="series-move-panel border rounded p-2">
<summary class="small fw-semibold">Move selected series to another case</summary>
aaoecuthsaoehntu
{% if move_series_form %}
<form id="move-selected-series-form" class="d-flex flex-column gap-2 mt-2">
{{ move_series_form.destination_case }}
@@ -530,38 +529,6 @@
submitBtn.disabled = !hiddenInput.value;
}
function selectFromRow(row) {
if (!row) return;
const casePk = row.getAttribute('data-case-pk');
const caseTitleEl = row.querySelector('h6');
const caseTitle = caseTitleEl ? caseTitleEl.textContent.trim() : ('Case #' + casePk);
applyMoveCaseSelection(casePk, caseTitle);
}
// Hard fallback: capture-phase click listener scoped to this widget results.
document.addEventListener('click', function (e) {
try {
const row = e.target.closest('#move-series-case-search-results .list-group-item[data-case-pk]');
if (!row) return;
if (e.target.closest('a,button,form,input')) return;
selectFromRow(row);
} catch (err) {
console.error('Move series capture click handler error', err);
}
}, true);
// Mirror uploads-style delegated click handling directly on rows.
document.body.addEventListener('click', function (e) {
try {
const item = e.target.closest('#move-series-case-search-results .list-group-item[data-case-pk]');
if (!item) return;
if (e.target.closest('a,button,form,input')) return;
selectFromRow(item);
} catch (err) {
console.error('Move series row click handler error', err);
}
});
document.body.addEventListener('case:selected', function (e) {
try {
const detail = e.detail || {};
@@ -1117,62 +1084,6 @@
detailsElement.addEventListener("toggle", toggleCheckboxes);
}
const modal = new bootstrap.Modal(document.getElementById("findingModal"));
const modalBody = document.getElementById("findingModalBody");
document.querySelectorAll(".view-finding-modal").forEach(button => {
button.addEventListener("click", function () {
const findingId = this.getAttribute("data-finding-id");
const seriesId = this.getAttribute("data-series-id");
// Show loading text
modalBody.innerHTML = "<p>Loading...</p>";
// Fetch the finding details (replace with your actual endpoint)
fetch(`/atlas/series_finding/${findingId}/details/`)
.then(response => response.text())
.then(html => {
modalBody.innerHTML = html; // Load the fetched HTML into the modal body
load_3d = false;
viewer_element_3d = document.getElementById('root');
if (viewer_element_3d.dataset.viewerstate3d != undefined) {
load_3d = true;
viewerState = JSON.parse(viewer_element_3d.dataset.viewerstate3d || {});
annotationjson3d = JSON.parse(viewer_element_3d.dataset.annotationjson3d || {});
} else {
viewer_element_3d = null;
}
// Initialize viewer deterministically after injecting HTML
(async function(){
try {
await mountDicomViewersSafely();
if (load_3d) {
console.log("loading 3d");
// deferred 3D import can be handled here if needed
} else {
console.log("not loading 3d");
}
} catch(e){
console.warn('Viewer init error:', e);
}
})();
document.getElementById("reload-finding").addEventListener("click", function () {
mountDicomViewersSafely();
});
// Initialize the DICOM viewer with the images and annotations
})
.catch(error => {
console.error("Error loading finding details:", error);
modalBody.innerHTML = "<p>Failed to load finding details.</p>";
});
// Show the modal
modal.show();
});
});
// Display Set modal handler
const dsModal = new bootstrap.Modal(document.getElementById("displaysetModal"));
const dsModalBody = document.getElementById("displaysetModalBody");
@@ -1319,7 +1230,8 @@
document.querySelectorAll(".view-finding-modal").forEach(button => {
button.addEventListener("click", function () {
const findingId = this.getAttribute("data-finding-id");
try { setUrlParam('finding', findingId); } catch (e) {}
const url = this.getAttribute('data-url');
loadFindingModal(findingId, url);
});
});
document.getElementById('findingModal').addEventListener('hidden.bs.modal', function () {
@@ -1427,8 +1339,10 @@
}
.series-actions summary { list-style: none; }
.series-actions summary::-webkit-details-marker { display:none; }
.series-actions .btn { vertical-align: middle; }
.series-actions .btn { text-align: left; }
.series-actions .btn {
vertical-align: middle;
text-align: left;
}
@media (prefers-color-scheme: dark) {
.series-actions { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.04); }
}
@@ -10,7 +10,7 @@
<input id="{{ input_id }}" name="q" class="form-control" type="search"
placeholder="Type to search cases..."
hx-get="{% url 'atlas:case_search' %}"
hx-include="closest .case-search-widget"
hx-include="closest .case-search-widget"
hx-target="#{{ target_id }}"
hx-trigger="keyup changed delay:400ms"
autocomplete="off">