Enhance resource display: conditionally render resource search panel and update pre/post review badge logic

This commit is contained in:
Ross
2025-12-15 10:53:21 +00:00
parent 0644ed99f4
commit cbff1317d0
2 changed files with 10 additions and 2 deletions
@@ -204,9 +204,11 @@
<div class="mb-3">
<h5>Resources</h5>
{% if can_edit%}
<div class="mb-2">
{% include 'atlas/partials/resource_search_panel.html' %}
</div>
{% endif %}
<div>
{% include 'atlas/partials/case_resources_list.html' with case=case %}
@@ -2,14 +2,20 @@
{% if case.caseresource_set.exists %}
<ul class="list-unstyled mb-0">
{% for cr in case.caseresource_set.all %}
<li class="py-1 d-flex justify-content-between align-items-center" data-caseresource-id="{{ cr.id }}">
<li class="py-1 d-flex justify-content-between align-items-center" data-caseresource-id="{{ cr.id }}" data-pre="{{ cr.pre_review|yesno:'1,0' }}">
<div>
<a href="{% url 'atlas:resource_detail' cr.resource.pk %}">{{ cr.resource.name }}</a>
{% if cr.pre_review %}<span class="badge bg-info text-dark ms-2 small">pre</span>{% endif %}
{% if cr.pre_review %}
<span class="badge bg-info text-dark ms-2 small">pre</span>
{% else %}
<span class="badge bg-secondary text-light ms-2 small">post</span>
{% endif %}
</div>
{% if can_edit %}
<div>
<button type="button" class="btn btn-sm btn-outline-danger" hx-post="{% url 'atlas:case_detach_resource' pk=case.pk %}" hx-vals='{"resource_id": "{{ cr.resource.pk }}"}' hx-swap="outerHTML" hx-target="#case-resources-list">Remove</button>
</div>
{% endif %}
</li>
{% endfor %}
</ul>