Enhance CaseCollectionForm: replace collection_type field with radio buttons and add custom styling

This commit is contained in:
Ross
2025-11-15 23:02:12 +00:00
parent 478dcb7217
commit 3312f3058a
3 changed files with 78 additions and 1 deletions
@@ -0,0 +1,24 @@
{% load i18n %}
<div class="btn-group" role="group" aria-label="{{ widget.name }}">
{% for val, label in widget.choices %}
{% with forloop.counter0 as idx %}
{% with id=widget.name|add:"_"|add:idx %}
<input
type="radio"
class="btn-check"
name="{{ widget.name }}"
id="{{ widget.name }}_{{ idx }}"
value="{{ val }}"
{% if val|stringformat:"s" == widget.value|stringformat:"s" %}checked{% endif %}
autocomplete="off"
>
<label
class="btn btn-outline-primary {% if val|stringformat:"s" == widget.value|stringformat:"s" %}active{% endif %}"
for="{{ widget.name }}_{{ idx }}"
>
{{ label }}
</label>
{% endwith %}
{% endwith %}
{% endfor %}
</div>