Refactor case prior display: enhance layout with Bootstrap cards for improved readability and user interaction
This commit is contained in:
@@ -4,106 +4,109 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
{% if previous %}
|
{% if previous %}
|
||||||
<a href="{% url 'atlas:collection_case_questions' collection.id previous.id %}">Previous question</a>
|
<a class="btn btn-outline-secondary btn-sm" href="{% url 'atlas:collection_case_priors' collection.id previous.id %}">← Previous</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
Viewing question as part of collection: <a href="{% url 'atlas:collection_detail' collection.id %}">{{collection.name}}</a> [{{case_number|add:1}}/{{collection_length}}]
|
</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 %}
|
{% if next %}
|
||||||
<a href="{% url 'atlas:collection_case_questions' collection.id next.id %}">Next question</a>
|
<a class="btn btn-outline-secondary btn-sm" href="{% url 'atlas:collection_case_priors' collection.id next.id %}">Next →</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<h2>Case: <a href="{% url 'atlas:case_detail' case_detail.case.pk %}">{{case_detail.case.title}}</a></h2>
|
<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>
|
||||||
|
|
||||||
<p>This page allows you to add series from prior cases to a case in a collection. In order to be available here the cases must be linked on the system.</p>
|
<div class="card mb-4">
|
||||||
<p>It is necessary to give a description of how the cases are related that will be displayed to the user when viewing the case.</p>
|
<div class="card-body">
|
||||||
|
<p class="mb-1">This page allows you to add series from prior cases to a case in a collection. In order to be available here the cases must be linked on the system.</p>
|
||||||
|
<p class="mb-0">It is necessary to give a description of how the cases are related that will be displayed to the user when viewing the case.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3>Available priors</h3>
|
<h3 class="mb-3">Available priors</h3>
|
||||||
|
|
||||||
<ul>
|
<div class="row g-3">
|
||||||
{% for case, added, relation, visibility in available_priors %}
|
{% for case, added, relation, visibility in available_priors %}
|
||||||
|
<div class="col-12 col-md-6 col-lg-4" data-case="{{case.id}}">
|
||||||
<li class='
|
<div class="card h-100 shadow-sm {% if added %}border-success{% else %}border-secondary{% endif %}">
|
||||||
|
<div class="card-body d-flex flex-column">
|
||||||
|
<div class="d-flex justify-content-between align-items-start mb-2">
|
||||||
|
<h5 class="card-title mb-0">{{case.title}}</h5>
|
||||||
|
<div>
|
||||||
{% if added %}
|
{% if added %}
|
||||||
added
|
<span class="badge bg-success">Added</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
not-added
|
<span class="badge bg-secondary">Available</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
' data-case={{case.id}}>
|
</div>
|
||||||
{{case.title}} / {{added}} / {{relation}} / <a href="{% url 'atlas:case_detail' case.id %}">View case</a>
|
</div>
|
||||||
<br/>{{case.get_series_blocks|safe}}
|
|
||||||
|
|
||||||
<br/>
|
<p class="card-text small text-muted mb-2">Relation: <span class="fw-medium">{{ relation }}</span></p>
|
||||||
|
|
||||||
|
<div class="mb-3 small">{{case.get_series_blocks|safe}}</div>
|
||||||
|
|
||||||
|
<div class="mt-auto">
|
||||||
|
<div class="d-flex gap-2 mb-2">
|
||||||
|
<a href="{% url 'atlas:case_detail' case.id %}" class="btn btn-sm btn-outline-primary">View case</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if not added %}
|
{% if not added %}
|
||||||
<form hx-post="{% url 'atlas:collection_case_priors' collection.id case_detail.case.pk %}"
|
<form class="row g-2" hx-post="{% url 'atlas:collection_case_priors' collection.id case_detail.case.pk %}"
|
||||||
hx-target="#htmx-response-{{case.id}}"
|
hx-target="#htmx-response-{{case.id}}">
|
||||||
_="on htmx:afterRequest log 'test' then remove me">
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="prior_case_id" value="{{case.id}}" />
|
<input type="hidden" name="prior_case_id" value="{{case.id}}" />
|
||||||
<input type="text" name="relation" value="{{relation}}" placeholder="relation to case" />
|
<div class="col-12">
|
||||||
<br />
|
<input class="form-control form-control-sm" type="text" name="relation" value="{{relation}}" placeholder="Relation to case" />
|
||||||
<label for="prior_visibility_{{case.id}}">Visibility:</label>
|
</div>
|
||||||
<select name="prior_visibility" id="prior_visibility_{{case.id}}">
|
<div class="col-8">
|
||||||
<option value="AL"
|
<select class="form-select form-select-sm" name="prior_visibility" id="prior_visibility_{{case.id}}">
|
||||||
{% if visibility == 'AL' %}
|
<option value="AL" {% if visibility == 'AL' %}selected{% endif %}>Always</option>
|
||||||
selected
|
<option value="RE" {% if visibility == 'RE' %}selected{% endif %}>Review</option>
|
||||||
{% endif %}
|
<option value="NO" {% if visibility == 'NO' %}selected{% endif %}>None</option>
|
||||||
>Always</option>
|
|
||||||
<option value="RE"
|
|
||||||
{% if visibility == 'RE' %}
|
|
||||||
selected
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
>Review</option>
|
|
||||||
<option value="NO"
|
|
||||||
{% if visibility == 'NO' %}
|
|
||||||
selected
|
|
||||||
{% endif %}
|
|
||||||
>None</option>
|
|
||||||
</select>
|
</select>
|
||||||
<br />
|
</div>
|
||||||
<button class="btn primary">Add to case</button>
|
<div class="col-4 d-grid">
|
||||||
|
<button class="btn btn-sm btn-primary" type="submit">Add</button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
<form hx-post="{% url 'atlas:collection_case_priors' collection.id case_detail.case.pk %}"
|
<form hx-post="{% url 'atlas:collection_case_priors' collection.id case_detail.case.pk %}"
|
||||||
hx-target="#htmx-response-{{case.id}}"
|
hx-target="#htmx-response-{{case.id}}">
|
||||||
_="on htmx:afterRequest log 'test' then remove me">
|
{% csrf_token %}
|
||||||
Case available: {{relation}}
|
|
||||||
<input type="hidden" name="remove" value="{{case.id}}" />
|
<input type="hidden" name="remove" value="{{case.id}}" />
|
||||||
<br />
|
<div class="mb-2 small text-muted">Current relation: <strong>{{relation}}</strong></div>
|
||||||
<label for="prior_visibility_{{case.id}}">Visibility:</label>
|
<div class="d-flex gap-2">
|
||||||
<select name="prior_visibility" id="prior_visibility_{{case.id}}" disabled>
|
<select class="form-select form-select-sm w-50" name="prior_visibility" id="prior_visibility_{{case.id}}" disabled>
|
||||||
<option value="AL"
|
<option value="AL" {% if visibility == 'AL' %}selected{% endif %}>Always</option>
|
||||||
{% if visibility == 'AL' %}
|
<option value="RE" {% if visibility == 'RE' %}selected{% endif %}>Review</option>
|
||||||
selected
|
<option value="NO" {% if visibility == 'NO' %}selected{% endif %}>None</option>
|
||||||
{% endif %}
|
|
||||||
>Always</option>
|
|
||||||
<option value="RE"
|
|
||||||
{% if visibility == 'RE' %}
|
|
||||||
selected
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
>Review</option>
|
|
||||||
<option value="NO"
|
|
||||||
{% if visibility == 'NO' %}
|
|
||||||
selected
|
|
||||||
{% endif %}
|
|
||||||
>None</option>
|
|
||||||
</select>
|
</select>
|
||||||
<br />
|
<button class="btn btn-sm btn-danger" type="submit">Remove</button>
|
||||||
<button class="btn primary">Remove from case</button>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span id="htmx-response-{{case.id}}"></span>
|
|
||||||
|
|
||||||
</li>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-footer bg-transparent">
|
||||||
|
<span id="htmx-response-{{case.id}}" class="small"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user