feat(Champ.siret): on invalid, set error message on InputStatutErrorMessage. on valid, set info message on siret info component
Co-authored-by: Corinne Durrmeyer <corinne@inseo.fr>
This commit is contained in:
parent
331dfd3044
commit
83c6bf1f0e
3 changed files with 23 additions and 4 deletions
|
@ -75,9 +75,9 @@ module Dsfr
|
||||||
}.merge(input_error_class_names)))
|
}.merge(input_error_class_names)))
|
||||||
|
|
||||||
if errors_on_attribute?
|
if errors_on_attribute?
|
||||||
@opts.deep_merge!(aria: {
|
@opts.deep_merge!(aria: { describedby: describedby_id })
|
||||||
describedby: describedby_id
|
elsif hintable?
|
||||||
})
|
@opts.deep_merge!(aria: { describedby: hint_id })
|
||||||
end
|
end
|
||||||
|
|
||||||
if @required
|
if @required
|
||||||
|
@ -130,6 +130,10 @@ module Dsfr
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def hintable?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
def hint?
|
def hint?
|
||||||
return true if get_slot(:hint).present?
|
return true if get_slot(:hint).present?
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,12 @@ class EditableChamp::SiretComponent < EditableChamp::EditableChampBaseComponent
|
||||||
def dsfr_input_classname
|
def dsfr_input_classname
|
||||||
'fr-input'
|
'fr-input'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def hint_id
|
||||||
|
dom_id(@champ, :siret_info)
|
||||||
|
end
|
||||||
|
|
||||||
|
def hintable?
|
||||||
|
true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1 +1,8 @@
|
||||||
|
- if @champ.etablissement_fetch_error_key.present?
|
||||||
|
= turbo_stream.update @champ.describedby_id, partial: 'shared/champs/siret/etablissement', locals: { siret: @siret, etablissement: @champ.etablissement }
|
||||||
|
= turbo_stream.show @champ.describedby_id
|
||||||
|
= turbo_stream.hide(dom_id(@champ, :siret_info))
|
||||||
|
- else
|
||||||
= turbo_stream.update dom_id(@champ, :siret_info), partial: 'shared/champs/siret/etablissement', locals: { siret: @siret, etablissement: @champ.etablissement }
|
= turbo_stream.update dom_id(@champ, :siret_info), partial: 'shared/champs/siret/etablissement', locals: { siret: @siret, etablissement: @champ.etablissement }
|
||||||
|
= turbo_stream.show dom_id(@champ, :siret_info)
|
||||||
|
= turbo_stream.hide(@champ.describedby_id)
|
||||||
|
|
Loading…
Reference in a new issue