From 964bce8233fc29fda37bee284b0298106acdce5a Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 1 Sep 2025 14:47:15 +0100 Subject: [PATCH] Enhance user experience by adding informative messages and edit mode functionality across various templates --- .../atlas/add_case_to_collection.html | 1 + atlas/templates/atlas/case_displaysets.html | 27 ++++++--- atlas/templates/atlas/collection_detail.html | 48 +++++++++------- atlas/templates/atlas/collection_viva.html | 56 +++++++++++++++---- .../atlas/partials/displayset_row.html | 28 +++++++++- atlas/views.py | 11 +++- templates/author_form.html | 8 ++- templates/exam_overview_js.html | 2 +- 8 files changed, 135 insertions(+), 46 deletions(-) diff --git a/atlas/templates/atlas/add_case_to_collection.html b/atlas/templates/atlas/add_case_to_collection.html index ff10f5cb..eb5eee15 100644 --- a/atlas/templates/atlas/add_case_to_collection.html +++ b/atlas/templates/atlas/add_case_to_collection.html @@ -1,4 +1,5 @@ + This form allows you to add an existing case to the collection. You may find it easier to do this from the individual case pages or the case overview view which allows you to add multiple cases at once.
{% csrf_token %} diff --git a/atlas/templates/atlas/case_displaysets.html b/atlas/templates/atlas/case_displaysets.html index e36e6392..9918b1cf 100755 --- a/atlas/templates/atlas/case_displaysets.html +++ b/atlas/templates/atlas/case_displaysets.html @@ -27,9 +27,7 @@
    {% for ds in case.display_sets.all %} -
  • {% include 'atlas/partials/displayset_row.html' %} -
  • {% empty %}
  • No display sets for this case.
  • {% endfor %} @@ -42,14 +40,27 @@ document.addEventListener("DOMContentLoaded", function () { window.mountDicomViewers(); - + {% if selected_displayset %} - setTimeout(function() { - importAnnotations_main_viewer({{ selected_displayset.annotations|safe }}); - importViewerState_main_viewer({{ selected_displayset.viewerstate|safe }}); - }, 500); - {% endif %} + setTimeout(function() { + importAnnotations_main_viewer({{ selected_displayset.annotations|safe }}); + importViewerState_main_viewer({{ selected_displayset.viewerstate|safe }}); + // Highlight the selected displayset row + var selectedRow = document.getElementById("displayset-{{ selected_displayset.pk }}"); + if (selectedRow) { + selectedRow.style.border = "2px solid #ffc107"; + } + }, 1000); + {% if edit %} + var editButton = document.getElementById("displayset-{{ selected_displayset.pk }}-edit-btn"); + if (editButton) { + editButton.click(); + } + + {% endif %} + {% endif %} + }); document.addEventListener("htmx:beforeRequest", function(evt) { diff --git a/atlas/templates/atlas/collection_detail.html b/atlas/templates/atlas/collection_detail.html index ab8f479e..1043a25c 100644 --- a/atlas/templates/atlas/collection_detail.html +++ b/atlas/templates/atlas/collection_detail.html @@ -20,12 +20,12 @@ {% if collection.collection_type == "VIV" %}

    {% else %} -

    This collection will be available to view/take here{% if not collection.active %} (when active){% endif %}

    Review collection here {% endif %} @@ -33,30 +33,38 @@

    Cases

      {% for casedetail in casesdetails %} -
    1. Case {{forloop.counter}} - : {{casedetail.case.title}} +
    2. - ( + + Case {{forloop.counter}} + : + {% if casedetail.case.series.count == 0 %} +    + {% endif %} + {{casedetail.case.title}} + + + ( {% if casedetail.default_viewerstate %} {% endif %} - ) + ) {% if collection.collection_type == "QUE" %} ( - {% if casedetail.question_schema %} - - {% else %} - - {% endif %} - + {% if casedetail.question_schema %} + + {% else %} + + {% endif %} + ) {% endif %} - {% if casedetail.case.previous_case %} - ( - ) - {% endif %} + {% if casedetail.case.previous_case %} + ( + ) + {% endif %}
    3. @@ -67,7 +75,7 @@ {% if can_edit %} -

      +

      +

      @@ -24,14 +25,18 @@
        {% for casedetail in casedetails %} {% with case=casedetail.case %} -
      1. -
        Case {{forloop.counter}}: {{case.title}}   - {% comment %} {% endcomment %} -{% comment %} {% endcomment %} - {% comment %} {% endcomment %} +
        + Case {{forloop.counter}}: {{case.title}}   + + +
        Series: @@ -42,10 +47,6 @@ test {{series.get_block}}
        -{% comment %} {% endcomment %} - {% comment %} @@ -56,6 +57,10 @@ data-target="{{ series.pk }}"> Load + +
        @@ -76,13 +81,17 @@ data-displayset="{{ ds.pk }}" data-case="{{ case.pk }}" data-title="{{ ds.name }}" - data-casejson='{{case.get_viva_details_json}}' - data-images='{{case.get_series_images_nested}}' + data-casejson='{{case.get_viva_details_json}}' + data-images='{{case.get_series_images_nested}}' data-viewerstate={{ds.viewerstate_string}} data-annotations='{{ds.annotations_string}}' > Load Display Set + +
        {% empty %} @@ -92,7 +101,6 @@ {% endif %}
      2. - {% endwith %} {% endfor %}
      @@ -120,10 +128,30 @@ {% block js %}