Enhance case list item links and management actions: update hrefs for dynamic case numbering and improve button structure for better accessibility

This commit is contained in:
Ross
2025-11-16 23:03:19 +00:00
parent 5e0068d490
commit 9760be8f27
3 changed files with 67 additions and 11 deletions
@@ -3,8 +3,12 @@
<div class="flex-fill">
<div class="d-flex justify-content-between align-items-start">
<div>
<a class="h6 mb-0 text-decoration-none" href="{% url 'atlas:collection_case_view' pk=collection.pk case_number=forloop.counter0 %}">{{ casedetail.case.title }}</a>
<div class="small text-muted">Case {{ forloop.counter }} &mdash; <span class="text-truncate">{{ casedetail.case.description|default_if_none:""|truncatechars:80 }}</span></div>
<a class="h6 mb-0 text-decoration-none case-link"
href="{% url 'atlas:collection_case_view' pk=collection.pk case_number=forloop.counter0 %}"
data-case-base-href="{% url 'atlas:collection_case_view' pk=collection.pk case_number=0 %}">
{{ casedetail.case.title }}
</a>
<div class="small text-muted"><span class="case-number">Case {{ forloop.counter }}</span> &mdash; <span class="text-truncate">{{ casedetail.case.description|default_if_none:""|truncatechars:80 }}</span></div>
</div>
</div>
@@ -1,4 +1,4 @@
<span class="btn-group btn-group-sm me-2" role="group" aria-label="management-actions">
<div class="btn-group btn-group-sm me-2" role="group" aria-label="management-actions">
<a class="btn btn-outline-secondary" href="{% url 'atlas:collection_case_displaysetup' casedetail.collection.pk casedetail.case.pk %}" title="Setup default display">
<i class="bi bi-display"></i>
</a>
@@ -30,4 +30,13 @@
<i class="bi bi-check"></i>
</button>
{% endif %}
</span>
</div>
{# Remove button (HTMX) - only shown when the surrounding template has `can_edit` true #}
{% if can_edit %}
<form class="d-inline ms-2 m-0" hx-post="{% url 'atlas:remove_case_from_collection' casedetail.case.pk casedetail.collection.pk %}" hx-target="closest li" hx-swap="outerHTML" hx-confirm="Remove this case from the collection?">
<button type="submit" class="btn btn-outline-danger btn-sm case-remove" title="Remove this case from the collection">
<i class="bi bi-trash"></i>
</button>
</form>
{% endif %}