add a normals feature

This commit is contained in:
Ross
2025-11-13 21:54:25 +00:00
parent a70354c18d
commit 5fb3c98941
6 changed files with 142 additions and 8 deletions
+4
View File
@@ -46,6 +46,9 @@
<li>
<a class="dropdown-item" href="{% url 'atlas:case_create' %}"><i class="bi bi-plus-square me-1" aria-hidden="true"></i>Create Case</a>
</li>
<li>
<a class="dropdown-item" href="{% url 'atlas:normals_list' %}"><i class="bi bi-file-earmark-check me-1" aria-hidden="true"></i>Normals</a>
</li>
</ul>
</li>
<li class="nav-item dropdown">
@@ -69,6 +72,7 @@
<li class="nav-item">
<a class="nav-link" href="{% url 'atlas:resource_view' %}" title="Resources"><i class="bi bi-folder2-open me-1" aria-hidden="true"></i>Resources</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'atlas:user_uploads' %}" title="View unimported uploads"><i class="bi bi-upload me-1" aria-hidden="true"></i>Uploads</a>
</li>
@@ -147,6 +147,10 @@
{# Diagnostic certainty as a badge #}
Diagnostic certainty: <span class="badge bg-info text-dark ms-2">{{ case.get_diagnostic_certainty_display }}</span>
{# Normal toggle HTMX block #}
<div class="mt-1">
{% include "atlas/partials/_normal_toggle.html" %}
</div>
</div>
</div>
+14 -8
View File
@@ -1,5 +1,6 @@
{% extends "atlas/base.html" %}
{% load static %}
{% load crispy_forms_tags %}
{% block content %}
<div class="container">
@@ -12,7 +13,7 @@
<div class="mb-2">
{{ field.label_tag }}
{{ field }}
+ </div>
</div>
{% endfor %}
<div class="mb-2">
<button class="btn btn-primary" type="submit">Filter</button>
@@ -22,13 +23,18 @@
</div>
</div>
<div class="list-group">
{% for normal in page_obj.object_list %}
{% include "atlas/partials/_normal_row.html" with normal=normal %}
{% empty %}
<div class="list-group-item">No normal cases found.</div>
{% endfor %}
</div>
{% if page_obj.object_list %}
<div class="list-group">
{% for normal in page_obj.object_list %}
<a class="list-group-item list-group-item-action" href="{% url 'atlas:case_detail' normal.case.pk %}">
{{ normal.case.title }}{% if normal.age_years %} — {{ normal.age_years }} yrs{% endif %}
<div class="small text-muted">Added {{ normal.added_date }}</div>
</a>
{% endfor %}
</div>
{% else %}
<div class="list-group-item">No normal cases found.</div>
{% endif %}
<nav aria-label="Page navigation">
<ul class="pagination mt-3">
@@ -0,0 +1,28 @@
{% load static %}
<div id="normal-toggle-block">
{% if case.normal_case %}
<span class="badge bg-success">Normal</span>
<small class="text-muted">{% if case.normal_case.age_years %}{{ case.normal_case.age_years }}y{% else %}age unknown{% endif %}</small>
{% if is_atlas_editor %}
<button class="btn btn-sm btn-outline-danger ms-2"
hx-post="{% url 'atlas:case_toggle_normal' case.pk %}"
hx-target="#normal-toggle-block"
hx-swap="outerHTML"
hx-confirm="Unmark this case as normal?">
Unmark normal
</button>
{% endif %}
{% else %}
{% if is_atlas_editor %}
<button class="btn btn-sm btn-outline-primary"
hx-post="{% url 'atlas:case_toggle_normal' case.pk %}"
hx-target="#normal-toggle-block"
hx-swap="outerHTML">
Mark as normal
</button>
{% else %}
<span class="text-muted">Normal status only editable by atlas editors</span>
{% endif %}
{% endif %}
</div>