Add preview templates and update URLs for display sets and series findings
This commit is contained in:
@@ -293,9 +293,9 @@
|
||||
|
||||
function getDetailUrl(type, pk){
|
||||
if(!type || !pk) return null;
|
||||
if(type === 'seriesfinding') return window.location.origin + '/atlas/series_finding/' + pk + '/details/';
|
||||
if(type === 'seriesfinding') return window.location.origin + '/atlas/series_finding/' + pk + '/preview/';
|
||||
if(type === 'finding') return window.location.origin + '/atlas/finding/' + pk;
|
||||
if(type === 'displayset') return window.location.origin + '/' + 'atlas/' + pk + '/display_sets/detail';
|
||||
if(type === 'displayset') return window.location.origin + '/atlas/displayset/' + pk + '/preview/';
|
||||
if(type === 'case') return window.location.origin + '/atlas/case/' + pk + '/';
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<div class="displayset-preview p-2">
|
||||
<h5 class="mb-1">Display Set</h5>
|
||||
<div class="small text-muted mb-2">Case: <a href="{% url 'atlas:case_displaysets' ds.case.pk %}">{{ ds.case.title }}</a></div>
|
||||
<div class="mb-2">Name: {{ ds.name|default:'(unnamed)' }}</div>
|
||||
{% if ds.description %}
|
||||
<div class="mb-2">{{ ds.description }}</div>
|
||||
{% endif %}
|
||||
<div class="d-flex gap-2">
|
||||
<a class="btn btn-sm btn-primary" href="{% url 'atlas:case_displaysets_detail' ds.pk %}">Open full</a>
|
||||
<button class="btn btn-sm btn-outline-secondary view-displayset-modal" data-ds-id="{{ ds.pk }}" data-url="{% url 'atlas:case_displaysets_modal' ds.pk %}">View in modal</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,18 @@
|
||||
<div class="seriesfinding-preview p-2">
|
||||
<h5 class="mb-1">Series Finding</h5>
|
||||
<div class="small text-muted mb-2">Series: {% if finding.series %}<a href="{% url 'atlas:series_detail' finding.series.pk %}">{{ finding.series.get_block|truncatechars:80 }}</a>{% else %}—{% endif %}</div>
|
||||
<div class="mb-2">{{ finding.description|default:'(no description)' }}</div>
|
||||
{% if finding.findings.all %}
|
||||
<div class="mb-2"><strong>Findings:</strong>
|
||||
<ul class="mb-0">
|
||||
{% for f in finding.findings.all %}
|
||||
<li>{{ f.name }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="d-flex gap-2">
|
||||
<a class="btn btn-sm btn-primary" href="{% url 'atlas:series_finding_details' finding.pk %}">Open full</a>
|
||||
<a class="btn btn-sm btn-outline-secondary" href="{% url 'atlas:series_detail' finding.series.pk %}">Open series</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -397,6 +397,7 @@ urlpatterns = [
|
||||
path("<int:pk>/display_sets/edit", views.case_displaysets_edit, name="case_displaysets_edit"),
|
||||
path("<int:pk>/display_sets/detail", views.case_displaysets_detail, name="case_displaysets_detail"),
|
||||
path("<int:pk>/display_sets/modal", views.case_displaysets_modal, name="case_displaysets_modal"),
|
||||
path('displayset/<int:pk>/preview/', views.displayset_preview, name='displayset_preview'),
|
||||
path("<int:pk>/display_sets/delete", views.case_displaysets_delete, name="case_displaysets_delete"),
|
||||
path(
|
||||
"case/<int:pk>/dicom_json",
|
||||
@@ -433,6 +434,7 @@ urlpatterns = [
|
||||
path('series/<int:series_pk>/<int:case_pk>/remove-from-case/', views.remove_series_from_case, name='remove_series_from_case'),
|
||||
path('series/bulk-delete/', views.series_bulk_delete, name='series_bulk_delete'),
|
||||
path('series_finding/<int:finding_id>/details/', views.series_finding_details, name='series_finding_details'),
|
||||
path('series_finding/<int:pk>/preview/', views.series_finding_preview, name='series_finding_preview'),
|
||||
path('series_finding/migration-status/', views.seriesfinding_migration_status, name='seriesfinding_migration_status'),
|
||||
path("uncategorised_dicoms/", views.uncategorised_dicoms, name="uncategorised_dicoms_view"),
|
||||
path("question_schema/", views.QuestionSchemaView.as_view(), name="question_schema_overview"),
|
||||
|
||||
@@ -725,6 +725,12 @@ def case_displaysets_modal(request, pk):
|
||||
can_edit = False
|
||||
return render(request, 'atlas/case_displayset_modal.html', {'ds': displayset, 'can_edit': can_edit})
|
||||
|
||||
|
||||
def displayset_preview(request, pk):
|
||||
"""Return a compact HTML fragment summarising a CaseDisplaySet for popups/modals."""
|
||||
displayset = get_object_or_404(CaseDisplaySet, pk=pk)
|
||||
return render(request, 'atlas/partials/_displayset_preview.html', {'ds': displayset})
|
||||
|
||||
def case_displaysets_delete(request, pk):
|
||||
try:
|
||||
displayset = CaseDisplaySet.objects.get(pk=pk)
|
||||
@@ -6157,6 +6163,13 @@ def series_finding_details(request, finding_id):
|
||||
finding = get_object_or_404(SeriesFinding, pk=finding_id)
|
||||
return render(request, 'atlas/series_finding_details.html', {'finding': finding})
|
||||
|
||||
|
||||
@login_required
|
||||
def series_finding_preview(request, finding_id):
|
||||
"""Return a small HTML fragment summarising a SeriesFinding for popups/modals."""
|
||||
finding = get_object_or_404(SeriesFinding, pk=finding_id)
|
||||
return render(request, 'atlas/partials/_seriesfinding_preview.html', {'finding': finding})
|
||||
|
||||
@login_required
|
||||
def series_finding_related(request, series_id):
|
||||
series = get_object_or_404(Series, pk=series_id)
|
||||
|
||||
Reference in New Issue
Block a user