Checkbox au DSFR
This commit is contained in:
parent
0ab31ba649
commit
37796b8843
5 changed files with 22 additions and 7 deletions
|
@ -125,7 +125,6 @@
|
||||||
|
|
||||||
&.editable-champ-checkbox {
|
&.editable-champ-checkbox {
|
||||||
label {
|
label {
|
||||||
padding-left: 28px;
|
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
- render EditableChamp::ChampLabelContentComponent.new form: @form, champ: @champ, seen_at: @seen_at
|
- render EditableChamp::ChampLabelContentComponent.new form: @form, champ: @champ, seen_at: @seen_at
|
||||||
- elsif @champ.legend_label?
|
- elsif @champ.legend_label?
|
||||||
%legend.fr-fieldset__legend.fr-text--regular= render EditableChamp::ChampLabelContentComponent.new form: @form, champ: @champ, seen_at: @seen_at
|
%legend.fr-fieldset__legend.fr-text--regular= render EditableChamp::ChampLabelContentComponent.new form: @form, champ: @champ, seen_at: @seen_at
|
||||||
|
- elsif @champ.single_checkbox?
|
||||||
|
-# no label to add
|
||||||
- else
|
- else
|
||||||
.fr-label.mb-4{ id: @champ.labelledby_id }
|
.fr-label.mb-4{ id: @champ.labelledby_id }
|
||||||
= render EditableChamp::ChampLabelContentComponent.new form: @form, champ: @champ, seen_at: @seen_at
|
= render EditableChamp::ChampLabelContentComponent.new form: @form, champ: @champ, seen_at: @seen_at
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
= @form.check_box :value,
|
.fr-fieldset__element
|
||||||
|
.fr-checkbox-group
|
||||||
|
= @form.check_box :value,
|
||||||
{ required: @champ.required?, id: @champ.input_id, checked: @champ.true?, aria: { describedby: @champ.describedby_id }, class: class_names('required' => @champ.required?)},
|
{ required: @champ.required?, id: @champ.input_id, checked: @champ.true?, aria: { describedby: @champ.describedby_id }, class: class_names('required' => @champ.required?)},
|
||||||
'true',
|
'true',
|
||||||
'false'
|
'false'
|
||||||
|
%label.fr-label{ for: @champ.input_id }
|
||||||
|
= render EditableChamp::ChampLabelContentComponent.new form: @form, champ: @champ, seen_at: @seen_at
|
||||||
|
|
|
@ -164,6 +164,10 @@ class Champ < ApplicationRecord
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def single_checkbox?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
def input_group_id
|
def input_group_id
|
||||||
"champ-#{html_id}"
|
"champ-#{html_id}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,6 +12,14 @@ class Champs::CheckboxChamp < Champs::BooleanChamp
|
||||||
value_with_legacy == TRUE_VALUE
|
value_with_legacy == TRUE_VALUE
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def html_label?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
|
def single_checkbox?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# TODO remove when normalize_checkbox_values is over
|
# TODO remove when normalize_checkbox_values is over
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue