Refactor case navigation: consolidate previous and next links into a reusable partial for improved maintainability and consistency across templates
This commit is contained in:
@@ -3,15 +3,7 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div>
|
||||
{% if previous %}
|
||||
<a href="{% url 'atlas:collection_case_details' collection.id previous.id %}">Previous question</a>
|
||||
{% endif %}
|
||||
Viewing question as part of collection: <a href="{% url 'atlas:collection_detail' collection.id %}">{{collection.name}}</a> [{{case_number|add:1}}/{{collection_length}}]
|
||||
{% if next %}
|
||||
<a href="{% url 'atlas:collection_case_details' collection.id next.id %}">Next question</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% include 'atlas/partials/_viewing_case_as_part_of_collection.html' %}
|
||||
|
||||
<h2>Case: <a href="{% url 'atlas:case_detail' case_detail.case.pk %}">{{case_detail.case.title}}</a></h2>
|
||||
|
||||
|
||||
@@ -4,26 +4,7 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<div>
|
||||
{% if previous %}
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{% url 'atlas:collection_case_priors' collection.id previous.id %}">← Previous</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<div class="h6 mb-0">Viewing question in collection</div>
|
||||
<div>
|
||||
<a href="{% url 'atlas:collection_detail' collection.id %}" class="fw-bold">{{collection.name}}</a>
|
||||
<small class="text-muted">[{{case_number|add:1}}/{{collection_length}}]</small>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{% if next %}
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{% url 'atlas:collection_case_priors' collection.id next.id %}">Next →</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include 'atlas/partials/_viewing_case_as_part_of_collection.html' with casedetail=case_detail %}
|
||||
|
||||
<h2 class="mb-3">Case: <a href="{% url 'atlas:case_detail' case_detail.case.pk %}" class="text-decoration-none">{{case_detail.case.title}}</a></h2>
|
||||
|
||||
@@ -39,6 +20,10 @@
|
||||
<div class="row g-3">
|
||||
{% for case, added, relation, visibility in available_priors %}
|
||||
{% include 'atlas/partials/_prior_card.html' with case=case added=added relation=relation visibility=visibility case_detail=case_detail collection=collection %}
|
||||
{% empty %}
|
||||
<div class="col-12">
|
||||
<div class="alert alert-info">No available prior cases found for the case.</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,17 +4,7 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div>
|
||||
|
||||
{% if previous %}
|
||||
<a href="{% url 'atlas:collection_case_questions' collection.id previous.id %}">Previous question</a>
|
||||
{% endif %}
|
||||
Viewing question as part of collection: <a href="{% url 'atlas:collection_detail' collection.id %}">{{collection.name}}</a> [{{case_number|add:1}}/{{collection_length}}]
|
||||
{% if next %}
|
||||
<a href="{% url 'atlas:collection_case_questions' collection.id next.id %}">Next question</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% include 'atlas/partials/_viewing_case_as_part_of_collection.html' with casedetail=case_detail %}
|
||||
|
||||
<h2>Case: <a href="{% url 'atlas:case_detail' case_detail.case.pk %}">{{case_detail.case.title}}</a></h2>
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<div id="prior-card-{{case.id}}" class="col-12 col-md-6 col-lg-4" data-case="{{case.id}}">
|
||||
<div class="card h-100 shadow-sm {% if added %}border-success{% else %}border-secondary{% endif %}">
|
||||
<div class="card-body d-flex flex-column">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger py-1 mb-2 small">{{ error }}</div>
|
||||
{% endif %}
|
||||
<div class="d-flex justify-content-between align-items-start mb-2">
|
||||
<h5 class="card-title mb-0">{{case.title}}</h5>
|
||||
<div>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<div>
|
||||
{% if previous %}
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{% url nav_link_view collection.id previous.id %}">← Previous</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<div class="h6 mb-0">Viewing as part of a collection</div>
|
||||
<div>
|
||||
<a href="{% url 'atlas:collection_detail' collection.id %}" class="fw-bold">{{collection.name}}</a>
|
||||
<small class="text-muted">[{{case_number|add:1}}/{{collection_length}}]</small>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{% if next %}
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{% url nav_link_view collection.id next.id %}">Next →</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="mb-1">
|
||||
{% include "atlas/collection_detail.html#casedetails-management-links" %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<div class="mt-2 small text-muted">
|
||||
{% if casedetail.case.series.count == 0 %}
|
||||
<span class="text-warning">No series attached</span>
|
||||
<span class="text-warning">This case has no series / stacks attached</span>
|
||||
{% else %}
|
||||
{{ casedetail.case.series.count }} series
|
||||
{% endif %}
|
||||
|
||||
@@ -18,22 +18,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if collection %}
|
||||
<div class="text-end mb-2">
|
||||
<div class="small text-muted">Collection</div>
|
||||
<div class="mb-1">
|
||||
{% include "atlas/collection_detail.html#casedetails-management-links" %}
|
||||
</div>
|
||||
<div class="small">
|
||||
{% if previous %}
|
||||
<a class="me-2" href="{% url 'atlas:collection_case_view' collection.id case_number|add:-1 %}">Previous</a>
|
||||
{% endif %}
|
||||
Viewing question as part of a collection: <a href="{% url 'atlas:collection_detail' collection.id %}">{{ collection.name }}</a>
|
||||
[{{ case_number|add:1 }} / {{ collection_length }}]
|
||||
{% if next %}
|
||||
<a class="ms-2" href="{% url 'atlas:collection_case_view' collection.id case_number|add:1 %}">Next</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if collection %}
|
||||
{% include 'atlas/partials/_viewing_case_as_part_of_collection.html' with nav_link_view="atlas:collection_case_view" %}
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user