-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Simplify form_field_snippets templates by setting 'aria-describedby' in dsfr_input_class_attr filter - Don't use 'field.label_tag' when specifying <label> or <legend> - Add support inline checkboxes and radio buttons - Add ability to inline fields with new 'dsfr_inline' filter
- Loading branch information
1 parent
48d5f81
commit c5f55bf
Showing
7 changed files
with
78 additions
and
47 deletions.
There are no files selected for viewing
10 changes: 2 additions & 8 deletions
10
dsfr/templates/dsfr/form_field_snippets/checkbox_snippet.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 14 additions & 18 deletions
32
dsfr/templates/dsfr/form_field_snippets/checkboxselectmultiple_snippet.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,27 @@ | ||
{% load widget_tweaks dsfr_tags %} | ||
<fieldset class="fr-fieldset{% if field.errors %} fr-fieldset--error{% endif %}" | ||
<fieldset class="fr-fieldset{% if field.errors %} fr-fieldset--error{% endif %} fr-fieldsets" | ||
id="checkboxes-{{ field.auto_id }}" | ||
aria-labelledby="{{ field.auto_id }}-legend{% if field.errors %} {{ field.auto_id }}-messages{% endif %}"> | ||
<legend class="fr-fieldset__legend fr-text--regular" | ||
<legend class="fr-fieldset__legend fr-fieldset__legend--regular" | ||
id="{{ field.auto_id }}-legend"> | ||
{{ field.label_tag }} | ||
{{ field.label }} | ||
{% if field.field.required %} | ||
* | ||
{% endif %} | ||
{% if field.help_text %} | ||
<span class="fr-hint-text">{{ field.help_text|safe }}</span> | ||
{% endif %} | ||
</legend> | ||
<div class="fr-fieldset__content"> | ||
<div class="fr-checkbox-group{% if field.errors %} fr-checkbox-group--error{% endif %}{% if field.field.disabled %} fr-input-group--disabled{% endif %}"> | ||
{% if field.errors %} | ||
{% with aria_describedby="aria-describedby:"|add:field.auto_id|add:"-desc-error" %} | ||
{{ field|dsfr_input_class_attr|attr:"type:checkbox"|attr:aria_describedby }} | ||
{% endwith %} | ||
{% else %} | ||
{{ field|dsfr_input_class_attr|attr:"type:checkbox" }} | ||
{% endif %} | ||
{% if field.errors %} | ||
<div id="{{ field.auto_id }}-desc-error"> | ||
{{ field.errors }} | ||
</div> | ||
{% endif %} | ||
{% with field=field|dsfr_input_class_attr %} | ||
{% for subwidget in field.subwidgets %} | ||
<div class="fr-fieldset__element{% if field.field.widget.inline %} fr-fieldset__element--inline{% endif %}"> | ||
{{ subwidget }} | ||
</div> | ||
{% endfor %} | ||
{% endwith %} | ||
{% if field.errors %} | ||
<div id="{{ field.auto_id }}-desc-error"> | ||
{{ field.errors }} | ||
</div> | ||
</div> | ||
{% endif %} | ||
</fieldset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 11 additions & 13 deletions
24
dsfr/templates/dsfr/form_field_snippets/radioselect_snippet.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters