diff --git a/atlas/templates/atlas/partials/series_images.html b/atlas/templates/atlas/partials/series_images.html new file mode 100644 index 00000000..20eb59b1 --- /dev/null +++ b/atlas/templates/atlas/partials/series_images.html @@ -0,0 +1,31 @@ +{% load static %} + +
+ {% for image in images %} +
+ {% if image.image %} + + image-{{ image.pk }} + + {% else %} +
+ {% endif %} + +
+
{{ image.image.name|default:"(no file)" }}
+ {% if image.image %} +
{{ image.image.size|filesizeformat }}
+ {% endif %} + {% if image.image_blake3_hash %} +
hash: {{ image.image_blake3_hash|truncatechars:12 }}
+ {% endif %} +
+ + +
+ {% empty %} +

No images found for this series.

+ {% endfor %} +
diff --git a/atlas/templates/atlas/series_viewer.html b/atlas/templates/atlas/series_viewer.html index e8e4f133..7a0d2c3e 100755 --- a/atlas/templates/atlas/series_viewer.html +++ b/atlas/templates/atlas/series_viewer.html @@ -1,337 +1,361 @@ {% load crispy_forms_tags %} {% with image_url_array_and_count=series.get_image_url_array_and_count %} -
-
-
-
-
-
-

Series: {{ series.modality }} - {{ series.examination }}

-
{{ series.plane }}, {{ series.contrast }}
-
Description: {{ series.description }}
-
Author: {{ series.get_author_display }}
+
+
+
+
+
+
+

Series: {{ series.modality }} - {{ series.examination }}

+
{{ series.plane }}, {{ series.contrast }}
+
Description: {{ series.description }}
+
Author: {{ series.get_author_display }}
+
+
+ View series + {% if can_edit %} + + {% else %} + + {% endif %} +
- +
+
+ +
+
+
+
+ {% with image_url_array_and_count=series.get_image_url_array_and_count %} +
+
+ {% endwith %} +
+ +
+
+ +
+
Finding form
+
+
+
+ {% if editing_finding > 0 %} +
Editing Finding
+

Editing finding with ID: {{editing_finding}}

+ {% else %} +
Add Finding
+

Click the button below to add a new finding.

+ {% endif %} +
+ {% csrf_token %} + {{series_finding_form|crispy}} +
+ + +
+
+
+
+
+
+
+ Findings +
+ {% for finding in series.findings.all %} +
+
+
+ + Finding(s): + {% for f in finding.findings.all %}{{f.get_link}}{% endfor %}
+ Structure(s): {% for s in finding.structures.all %}{{s.get_link}}{% endfor %}
+ Condition(s): {% for s in finding.conditions.all %}{{s.get_link}}{% endfor %}
+
{{finding.description}}
+
+
+ {% if request.user.is_superuser %} + +
+
{{finding.annotation_json}}
+
{{finding.viewport_json}}
+
+ {% endif %} + {% if can_edit %} +
+ Edit + Delete +
+ {% endif %} +
+
+
+ {% empty %} +

No findings available.

+ {% endfor %} +
+
+
+ + +
+
+ Images +
+ + Download + +
+
+
+
+

Click 'Load images' to fetch.

+
+
+
+ +
+ +
+
+
Cases
+
+
+ {% include 'atlas/partials/series_cases_list.html' %} +
{% if can_edit %} - - {% else %} - +
+ Add Series to Case +
+ {% csrf_token %} +
+ + +
+
+ + +
+
+
{% endif %}
+ + + + + + {% if can_edit %} +
+
Truncate series
+
+

Limit the series to the selected bounds (the rest of the images will be deleted). This action is irreversible on site.

+
Warning: If you have reordered the series this may remove the wrong images.
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ + +
+
+
+
+ {% endif %}
-
-
-
-
- {% with image_url_array_and_count=series.get_image_url_array_and_count %} -
-
- {% endwith %} -
- -
-
- -
-
Finding form
-
-
-
- {% if editing_finding > 0 %} -
Editing Finding
-

Editing finding with ID: {{editing_finding}}

- {% else %} -
Add Finding
-

Click the button below to add a new finding.

- {% endif %} -
- {% csrf_token %} - {{series_finding_form|crispy}} -
- - -
-
-
-
-
-
-
- Findings -
- {% for finding in series.findings.all %} -
-
-
- - Finding(s): - {% for f in finding.findings.all %}{{f.get_link}}{% endfor %}
- Structure(s): {% for s in finding.structures.all %}{{s.get_link}}{% endfor %}
- Condition(s): {% for s in finding.conditions.all %}{{s.get_link}}{% endfor %}
-
{{finding.description}}
-
-
- {% if request.user.is_superuser %} - -
-
{{finding.annotation_json}}
-
{{finding.viewport_json}}
-
- {% endif %} - {% if can_edit %} -
- Edit - Delete -
- {% endif %} -
-
-
- {% empty %} -

No findings available.

- {% endfor %} -
-
-
-
- -
-
-
Cases
-
-
- {% include 'atlas/partials/series_cases_list.html' %} -
- {% if can_edit %} -
- Add Series to Case -
- {% csrf_token %} -
- - -
-
- - -
-
-
- {% endif %} -
-
- - - - - - {% if can_edit %} -
-
Truncate series
-
-

Limit the series to the selected bounds (the rest of the images will be deleted). This action is irreversible on site.

-
Warning: If you have reordered the series this may remove the wrong images.
-
- -
- - -
-
-
- -
- - -
-
-
- - -
-
-
-
- {% endif %} + -
- + + {% endwith %} @@ -402,14 +426,14 @@ transition: background 0.2s, font-size 0.2s; } -details.styled-detail:not([open]) { - padding-bottom: 0; - min-height: 0; -} + details.styled-detail:not([open]) { + padding-bottom: 0; + min-height: 0; + } -details.styled-detail:not([open]) > *:not(summary) { - display: none; -} + details.styled-detail:not([open]) > *:not(summary) { + display: none; + } details.styled-detail:not([open]) > summary { padding: 0.7em 1.2em 0.3em 1.2em; diff --git a/atlas/urls.py b/atlas/urls.py index 868399fc..2097dc8d 100755 --- a/atlas/urls.py +++ b/atlas/urls.py @@ -457,6 +457,7 @@ urlpatterns = [ # TODO: case context series viewing (so that we can view series in the context of a case) path("series/", views.series_detail, name="series_detail"), path("series//viewer", views.series_viewer, name="series_viewer"), + path("series//images/", views.series_images_partial, name="series_images"), path("series//authors", views.SeriesAuthorUpdate.as_view(), name="series_authors"), path("series//finding/related", views.series_finding_related, name="series_finding_related"), path("series/", views.SeriesView.as_view(), name="series_view"), diff --git a/atlas/views.py b/atlas/views.py index 7d03c3d6..25709c5a 100755 --- a/atlas/views.py +++ b/atlas/views.py @@ -796,6 +796,17 @@ def series_detail(request, pk, finding_pk=None): ) +@login_required +@user_is_author_or_atlas_series_checker_or_atlas_marker_or_open_access +def series_images_partial(request, pk): + """Return a small fragment that lists images for a series. Intended for HTMX.""" + series = get_object_or_404(Series, pk=pk) + logger.debug(series) + images = series.images.filter(removed=False).order_by("pk") + logger.debug(images) + return render(request, "atlas/partials/series_images.html", {"series": series, "images": images}) + + @login_required # @user_is_atlas_editor def question_schema_detail(request, pk: int): diff --git a/deploy/settings_local.py b/deploy/settings_local.py index 03376c38..66c13638 100644 --- a/deploy/settings_local.py +++ b/deploy/settings_local.py @@ -117,4 +117,6 @@ SECURE_HSTS_SECONDS = 0 CSRF_TRUSTED_ORIGINS = [ "http://127.0.0.1:8000", "http://localhost:8000", -] \ No newline at end of file +] + +REMOTE_URL = "http://127.0.0.1:8000" \ No newline at end of file