Korjaa monivalintalistat (palveluyksiköt, muut jäsenet)
CheckboxSelectMultiple on RadioSelectin aliluokka, joten valintaruudut saivat daisyUI:n radio-luokan, ja sama luokka meni myös listan ympärillä olevalle divillä: lista kutistui pieneksi ympyräksi. - Widget-luokkien järjestys korjattu (checkbox ennen radiota). - Valintaryhmät renderöidään fieldset + legend -rakenteena, jokaisella vaihtoehdolla oma label; puhelimella yksi sarake, leveämmällä kaksi. - Testit rakenteelle, virheen liitokselle ja näppäimistövalinnalle. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -1,4 +1,28 @@
|
||||
{% load i18n %}{% with widget_type=field.widget_type %}
|
||||
{% if widget_type == "checkboxselectmultiple" or widget_type == "radioselect" %}
|
||||
{# A group of choices: fieldset + legend, one labelled input per option (no wrapper div). #}
|
||||
<fieldset class="fieldset"{% if field.help_text or field.errors %} aria-describedby="{% if field.help_text %}{{ field.auto_id }}_helptext{% endif %}{% if field.help_text and field.errors %} {% endif %}{% if field.errors %}{{ field.auto_id }}_error{% endif %}"{% endif %}>
|
||||
<legend class="fieldset-legend text-sm">
|
||||
{{ field.label }}{% if field.field.required %} <span aria-hidden="true">*</span><span class="sr-only">{% translate "(required)" %}</span>{% endif %}
|
||||
</legend>
|
||||
<div class="grid gap-1 sm:grid-cols-2">
|
||||
{% for option in field %}
|
||||
<label class="label cursor-pointer justify-start gap-3 text-base-content whitespace-normal" for="{{ option.id_for_label }}">
|
||||
{{ option.tag }}
|
||||
<span>{{ option.choice_label }}</span>
|
||||
</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if field.help_text %}
|
||||
<p class="label text-sm whitespace-normal" id="{{ field.auto_id }}_helptext">{{ field.help_text }}</p>
|
||||
{% endif %}
|
||||
{% if field.errors %}
|
||||
<p class="text-error text-sm" id="{{ field.auto_id }}_error">
|
||||
{% for error in field.errors %}{{ error }}{% if not forloop.last %} {% endif %}{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</fieldset>
|
||||
{% else %}
|
||||
<div class="fieldset {% if field.field.widget.input_type == 'hidden' %}hidden{% endif %}">
|
||||
{% if widget_type == "checkbox" %}
|
||||
<label class="label cursor-pointer justify-start gap-3 text-base-content" for="{{ field.auto_id }}">
|
||||
@@ -20,4 +44,5 @@
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
Reference in New Issue
Block a user