Enhance QuestionReviewForm by adding autofocus to comment field and improve status button rendering with active state
This commit is contained in:
@@ -9,21 +9,12 @@
|
||||
<div class="col-auto">
|
||||
<label class="form-label mb-1">Status</label>
|
||||
<div>
|
||||
{% for radio in form.status %}
|
||||
{% with current_status=form.status.value %}
|
||||
{% for radio in form.status %}
|
||||
{% comment %} Render colored button for each choice by checking value {% endcomment %}
|
||||
{{ radio.tag }}
|
||||
{% if radio.choice_value == 'AC' %}
|
||||
<label class="btn btn-outline-success me-1 mb-1" for="{{ radio.id_for_label }}">{{ radio.choice_label }}</label>
|
||||
{% elif radio.choice_value == 'OD' %}
|
||||
<label class="btn btn-outline-secondary me-1 mb-1" for="{{ radio.id_for_label }}">{{ radio.choice_label }}</label>
|
||||
{% elif radio.choice_value == 'ER' %}
|
||||
<label class="btn btn-outline-warning me-1 mb-1" for="{{ radio.id_for_label }}">{{ radio.choice_label }}</label>
|
||||
{% elif radio.choice_value == 'RJ' %}
|
||||
<label class="btn btn-outline-danger me-1 mb-1" for="{{ radio.id_for_label }}">{{ radio.choice_label }}</label>
|
||||
{% else %}
|
||||
<label class="btn btn-outline-primary me-1 mb-1" for="{{ radio.id_for_label }}">{{ radio.choice_label }}</label>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<label class="btn btn-outline-primary me-1 mb-1{% if radio.choice_value == current_status %} active{% endif %}" for="{{ radio.id_for_label }}">{{ radio.choice_label }}</label>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
{% if form.status.errors %}
|
||||
<div class="invalid-feedback d-block">{{ form.status.errors|join:", " }}</div>
|
||||
|
||||
Reference in New Issue
Block a user