Enhance resource display: conditionally render resource search panel and update pre/post review badge logic
This commit is contained in:
@@ -204,9 +204,11 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<h5>Resources</h5>
|
<h5>Resources</h5>
|
||||||
|
|
||||||
|
{% if can_edit%}
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
{% include 'atlas/partials/resource_search_panel.html' %}
|
{% include 'atlas/partials/resource_search_panel.html' %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
{% include 'atlas/partials/case_resources_list.html' with case=case %}
|
{% include 'atlas/partials/case_resources_list.html' with case=case %}
|
||||||
|
|||||||
@@ -2,14 +2,20 @@
|
|||||||
{% if case.caseresource_set.exists %}
|
{% if case.caseresource_set.exists %}
|
||||||
<ul class="list-unstyled mb-0">
|
<ul class="list-unstyled mb-0">
|
||||||
{% for cr in case.caseresource_set.all %}
|
{% 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>
|
<div>
|
||||||
<a href="{% url 'atlas:resource_detail' cr.resource.pk %}">{{ cr.resource.name }}</a>
|
<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>
|
</div>
|
||||||
|
{% if can_edit %}
|
||||||
<div>
|
<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>
|
<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>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user