From e162e60f44b97a8f933e79e5a35dc549956c546b Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 13 Apr 2026 14:15:04 +0100 Subject: [PATCH] Refactor case display logic by creating partials for findings and display sets to enhance maintainability and readability --- atlas/templates/atlas/case_display_block.html | 127 +----------------- .../atlas/collection_case_view_take.html | 7 +- .../atlas/partials/_case_displaysets.html | 72 ++++++++++ .../atlas/partials/_case_findings.html | 59 ++++++++ 4 files changed, 138 insertions(+), 127 deletions(-) create mode 100644 atlas/templates/atlas/partials/_case_displaysets.html create mode 100644 atlas/templates/atlas/partials/_case_findings.html diff --git a/atlas/templates/atlas/case_display_block.html b/atlas/templates/atlas/case_display_block.html index 09c5ca31..bbf0df89 100755 --- a/atlas/templates/atlas/case_display_block.html +++ b/atlas/templates/atlas/case_display_block.html @@ -678,133 +678,10 @@ {% endif %}
-
- Findings - {% if can_edit %} -
- Help -

Findings are display sets that can be added to series. Once added they will appear here on linked cases.

-

To add a finding to a series, select the series and then click the "Add finding" button.

-
- {% endif %} + {% include 'atlas/partials/_case_findings.html' %} - -
Series Findings
- {% for series in case.ordered_series %} - {% for finding in series.findings.all %} -
- - - - - - - {% if finding.findings %} - - Findings: {% for f in finding.findings.all %} - {{f.get_link}},  - {% endfor %} - - {% endif %} - {% if finding.conditions %} - - Conditions: {% for c in finding.conditions.all %} - {{c.get_link}},  - {% endfor %} - - {% endif %} - {% if finding.structures %} - - Structure: {% for s in finding.structures.all %} - {{s.get_link}},  - {% endfor %} - - {% endif %} - {% if finding.description %} - - Description: {{finding.description}} - - {% endif %} -
- {% endfor %} - {% empty%} - No series associated with case. - {% endfor %} - - -
Case Display Sets
-
    - {% for ds in case.display_sets.all %} -
  • - Name: {{ ds.name }} - {% if ds.description %} - ({{ ds.description }}) - {% endif %} - - View Display Set - - -
    - Findings: - {% if ds.findings.all %} -
      - {% for finding in ds.findings.all %} -
    • {{ finding.get_link }}
    • - {% endfor %} -
    - {% else %} - None - {% endif %} -
    -
    - Structures: - {% if ds.structures.all %} -
      - {% for structure in ds.structures.all %} -
    • {{ structure.get_link }}
    • - {% endfor %} -
    - {% else %} - None - {% endif %} -
    -
    - Conditions: - {% if ds.conditions.all %} -
      - {% for condition in ds.conditions.all %} -
    • {{ condition.get_link }}
    • - {% endfor %} -
    - {% else %} - None - {% endif %} -
    -
    -
    - Show advanced (viewer state & annotations) -
    - {% include 'atlas/partials/json_pretty.html' with json_value=ds.viewerstate title='Viewer State' %} -
    -
    - {% include 'atlas/partials/json_pretty.html' with json_value=ds.annotations title='Annotations' %} -
    -
    -
    -
  • - {% empty %} -
    - No display sets for this case. - {% if can_edit %} - Add one now - {% endif %} -
    - {% endfor %} -
-
+ {% include 'atlas/partials/_case_displaysets.html' %}
diff --git a/atlas/templates/atlas/collection_case_view_take.html b/atlas/templates/atlas/collection_case_view_take.html index 2cf81a27..300e08b7 100644 --- a/atlas/templates/atlas/collection_case_view_take.html +++ b/atlas/templates/atlas/collection_case_view_take.html @@ -184,8 +184,11 @@
{% endif %} - {% if collection.show_findings_post or collection.show_displaysets_post %} - {% include 'atlas/case_display_block.html' %} + {% if collection.show_findings_post %} + {% include 'atlas/partials/_case_findings.html' %} + {% endif %} + {% if collection.show_displaysets_post %} + {% include 'atlas/partials/_case_displaysets.html' %} {% endif %} {% if resources %} diff --git a/atlas/templates/atlas/partials/_case_displaysets.html b/atlas/templates/atlas/partials/_case_displaysets.html new file mode 100644 index 00000000..28d16211 --- /dev/null +++ b/atlas/templates/atlas/partials/_case_displaysets.html @@ -0,0 +1,72 @@ +{# Partial: Case Display Sets (displaysets) #} +
+
Case Display Sets
+ +
diff --git a/atlas/templates/atlas/partials/_case_findings.html b/atlas/templates/atlas/partials/_case_findings.html new file mode 100644 index 00000000..8e46ff15 --- /dev/null +++ b/atlas/templates/atlas/partials/_case_findings.html @@ -0,0 +1,59 @@ +{# Partial: Series Findings for a Case #} +
+
+ Findings + + {% if can_edit %} +
+ Help +

Findings are display sets that can be added to series. Once added they will appear here on linked cases.

+

To add a finding to a series, select the series and then click the "Add finding" button.

+
+ {% endif %} + + +
Series Findings
+ {% for series in case.ordered_series %} + {% for finding in series.findings.all %} +
+ + + + + + + {% if finding.findings %} + + Findings: {% for f in finding.findings.all %} + {{f.get_link}},  + {% endfor %} + + {% endif %} + {% if finding.conditions %} + + Conditions: {% for c in finding.conditions.all %} + {{c.get_link}},  + {% endfor %} + + {% endif %} + {% if finding.structures %} + + Structure: {% for s in finding.structures.all %} + {{s.get_link}},  + {% endfor %} + + {% endif %} + {% if finding.description %} + + Description: {{finding.description}} + + {% endif %} +
+ {% endfor %} + {% empty %} + No series associated with case. + {% endfor %} +
+