Enhance question review functionality with latest review status annotation and display in templates
This commit is contained in:
@@ -96,7 +96,7 @@
|
||||
|
||||
<div class="mb-3">
|
||||
<h5 class="h6">Feedback</h5>
|
||||
<div>{{ question.feedback|linebreaks }}</div>
|
||||
<div>{{ question.feedback|safe|linebreaks }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{% extends 'sbas/base.html' %}
|
||||
|
||||
{% load partials %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Filtered questions</h2>
|
||||
|
||||
@@ -36,6 +38,16 @@
|
||||
<div>
|
||||
<a href="{% url app_name|add:':question_detail' q.pk %}">{{ q.title|default:q.stem|truncatechars:80|safe }}</a>
|
||||
<div class="small text-muted">ID: {{ q.pk }}</div>
|
||||
{% comment %} Show latest review status if available {% endcomment %}
|
||||
{% with status_code=q.latest_review_status %}
|
||||
{% if status_code %}
|
||||
{% with label=status_choices|get_item:status_code %}
|
||||
<div class="mt-1"><span class="badge bg-secondary">Latest review: {{ label }}</span></div>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
<div class="mt-1"><span class="text-muted small">Latest review: Unreviewed</span></div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-sm btn-outline-secondary" href="{% url app_name|add:':question_detail' q.pk %}">View</a>
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<button type="submit" class="btn btn-primary">Start review</button>
|
||||
|
||||
<div class="mb-3">
|
||||
@@ -40,7 +42,13 @@
|
||||
<button id="view-list-btn" type="button" class="btn btn-outline-primary">View list</button>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
<!-- Checkbox outside the POST form so it only affects the View List flow -->
|
||||
<div class="form-check mb-2">
|
||||
<input class="form-check-input" type="checkbox" value="me" id="id_reviewed_me">
|
||||
<label class="form-check-label" for="id_reviewed_me">Only questions I've reviewed (applies to View list)</label>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// When View list is clicked, read the values from the main filter form and navigate
|
||||
@@ -51,8 +59,10 @@
|
||||
const params = new URLSearchParams();
|
||||
const categoryEl = document.getElementById('id_category');
|
||||
const statusEl = document.getElementById('id_status');
|
||||
const reviewedEl = document.getElementById('id_reviewed_me');
|
||||
if (categoryEl && categoryEl.value) params.set('category', categoryEl.value);
|
||||
if (statusEl && statusEl.value) params.set('status', statusEl.value);
|
||||
if (reviewedEl && reviewedEl.checked) params.set('reviewed', reviewedEl.value || 'me');
|
||||
const url = base + (params.toString() ? ('?' + params.toString()) : '');
|
||||
window.location.href = url;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user