Refactor case detail references: standardize variable naming from case_detail to casedetail across templates for consistency

This commit is contained in:
Ross
2025-11-17 10:34:55 +00:00
parent 12b7fa6629
commit b6478c44dc
3 changed files with 31 additions and 31 deletions
@@ -4,7 +4,7 @@
{% block content %}
<h2>Case: {{ case.title }}</h2>
{{ case_detail.question_schema }}
{{ casedetail.question_schema }}
{{ case.question_answers }}
@@ -3,21 +3,21 @@
{% comment %} <script src="{% static 'js/jquery-3.7.1.min.js' %}"></script>
<script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script> {% endcomment %}
<ol>
{% for case_detail in case_details %}
{% for casedetail in casedetails %}
<li id="case-detail-{{case_detail.pk}}"{% if case_detail.question_schema %} class="cases"{% endif %}>
<h2>Case: {{ case_detail.case.title }}</h2>
{% if case_detail.question_schema %}
<li id="case-detail-{{casedetail.pk}}"{% if casedetail.question_schema %} class="cases"{% endif %}>
<h2>Case: {{ casedetail.case.title }}</h2>
{% if casedetail.question_schema %}
<button class="btn btn-sm btn-secondary use-layout">Use schema</button>
<details><summary>Schema:</summary>
<div class="schema" data-schema='{{ case_detail.get_question_schema }}'>{{ case_detail.question_schema }}</div>
<div class="schema" data-schema='{{ casedetail.get_question_schema }}'>{{ casedetail.question_schema }}</div>
</details>
<div class="form"></div>
{% else %}
<p>No question(s)</p>
{% endif %}
</li>
{% endfor %}
@@ -30,8 +30,8 @@
console.log(n, el);
form_el = $(el).find(".form").get(0);
schema = $(el).find(".schema").get(0).dataset.schema;
console.log(schema)
console.log(form_el)
console.log(schema)
console.log(form_el)
form = new JSONEditor(form_el, {
schema: JSON.parse(schema),
theme: 'bootstrap4',
+21 -21
View File
@@ -1,25 +1,25 @@
<div class="d-flex flex-wrap justify-content-between align-items-start mb-3">
<div class="btn-toolbar" role="toolbar" aria-label="Case actions">
<div class="btn-group me-2 mb-2" role="group" aria-label="Primary actions">
<a class="btn btn-sm btn-outline-primary" href="{% url 'atlas:case_detail' pk=case.pk %}" title="View the Case">View</a>
<a class="btn btn-sm btn-outline-secondary" href="{% url 'atlas:case_update' pk=case.pk %}" title="Edit the Case">Edit</a>
<a class="btn btn-sm btn-outline-secondary" href="{% url 'atlas:case_series_update' pk=case.pk %}" title="Edit the Cases Series">Series</a>
<a class="btn btn-sm btn-outline-secondary" href="{% url 'atlas:case_displaysets' pk=case.pk %}" title="View and edit case display sets">Display sets</a>
<div class="d-flex flex-wrap justify-content-between align-items-start mb-3">
<div class="btn-toolbar" role="toolbar" aria-label="Case actions">
<div class="btn-group me-2 mb-2" role="group" aria-label="Primary actions">
<a class="btn btn-sm btn-outline-primary" href="{% url 'atlas:casedetail' pk=case.pk %}" title="View the Case">View</a>
<a class="btn btn-sm btn-outline-secondary" href="{% url 'atlas:case_update' pk=case.pk %}" title="Edit the Case">Edit</a>
<a class="btn btn-sm btn-outline-secondary" href="{% url 'atlas:case_series_update' pk=case.pk %}" title="Edit the Cases Series">Series</a>
<a class="btn btn-sm btn-outline-secondary" href="{% url 'atlas:case_displaysets' pk=case.pk %}" title="View and edit case display sets">Display sets</a>
</div>
<div class="btn-group me-2 mb-2" role="group" aria-label="Secondary actions">
<a class="btn btn-sm btn-outline-success" href="{% url 'atlas:case_clone' pk=case.pk %}" title="Clone the Case (duplicate everything but the images)">Clone</a>
<a class="btn btn-sm btn-outline-danger" href="{% url 'atlas:case_delete' pk=case.pk %}" title="Delete the Case">Delete</a>
<a class="btn btn-sm btn-outline-info" href="#" onclick="return window.create_popup_window('{% url 'feedback_create' question_type='atlas' pk=case.pk %}');">Add Note</a>
<a class="btn btn-sm btn-outline-secondary" href="{% url 'atlas:case_authors' case.pk %}" title="Edit Authors">Authors</a>
{% if request.user.is_superuser %}
<a class="btn btn-sm btn-outline-dark" href="{% url 'admin:atlas_case_change' case.id %}" title="Edit the Case using the admin interface">Admin</a>
{% endif %}
</div>
</div>
<div class="btn-group me-2 mb-2" role="group" aria-label="Secondary actions">
<a class="btn btn-sm btn-outline-success" href="{% url 'atlas:case_clone' pk=case.pk %}" title="Clone the Case (duplicate everything but the images)">Clone</a>
<a class="btn btn-sm btn-outline-danger" href="{% url 'atlas:case_delete' pk=case.pk %}" title="Delete the Case">Delete</a>
<a class="btn btn-sm btn-outline-info" href="#" onclick="return window.create_popup_window('{% url 'feedback_create' question_type='atlas' pk=case.pk %}');">Add Note</a>
<a class="btn btn-sm btn-outline-secondary" href="{% url 'atlas:case_authors' case.pk %}" title="Edit Authors">Authors</a>
{% if request.user.is_superuser %}
<a class="btn btn-sm btn-outline-dark" href="{% url 'admin:atlas_case_change' case.id %}" title="Edit the Case using the admin interface">Admin</a>
{% endif %}
</div>
</div>
</div>
{% if collection %}
{% include 'atlas/partials/_viewing_case_as_part_of_collection.html' with nav_link_view="atlas:collection_case_view" %}
{% endif %}
{% if collection %}
{% include 'atlas/partials/_viewing_case_as_part_of_collection.html' with nav_link_view="atlas:collection_case_view" %}
{% endif %}