liaison for label/input

This commit is contained in:
Benoit Queyron 2024-07-10 16:33:39 +02:00
parent 75a6c8b4b6
commit 9e4b7cc84e
No known key found for this signature in database
GPG key ID: 9E723480C7317E22
3 changed files with 5 additions and 6 deletions

View file

@ -165,8 +165,7 @@ class Attachment::EditComponent < ApplicationComponent
# There is always a single input by champ, its id must match the label "for" attribute. # There is always a single input by champ, its id must match the label "for" attribute.
return champ.input_id return champ.input_id
end end
@form_object_name || dom_id(@attached_file.record, attribute_name)
helpers.field_id(@form_object_name || @attached_file.record, attribute_name)
end end
def auto_attach_url def auto_attach_url

View file

@ -16,7 +16,7 @@
.fr-fieldset__element .fr-fieldset__element
.fr-input-group .fr-input-group
= f.label :logo, 'Ajouter un logo de la démarche', class: 'fr-label' = f.label :logo, 'Ajouter un logo de la démarche', class: 'fr-label', for: dom_id(@procedure, :logo)
= render Attachment::EditComponent.new(attached_file: @procedure.logo, view_as: :link) = render Attachment::EditComponent.new(attached_file: @procedure.logo, view_as: :link)
.fr-fieldset__element .fr-fieldset__element
.fr-input-group .fr-input-group
@ -55,7 +55,7 @@
.fr-fieldset__element .fr-fieldset__element
.fr-input-group .fr-input-group
= f.label :deliberation, 'Cadre juridique - texte à importer', class: 'fr-label' = f.label :deliberation, 'Cadre juridique - texte à importer', class: 'fr-label', for: dom_id(@procedure, :deliberation)
= render Attachment::EditComponent.new(attached_file: @procedure.deliberation, view_as: :download) = render Attachment::EditComponent.new(attached_file: @procedure.deliberation, view_as: :download)
%fieldset.fr-fieldset %fieldset.fr-fieldset
@ -80,7 +80,7 @@
.fr-fieldset__element .fr-fieldset__element
.fr-input-group .fr-input-group
= f.label :notice, 'Notice explicative de la démarche', class: 'fr-label' = f.label :notice, 'Notice explicative de la démarche', class: 'fr-label', for: dom_id(@procedure, :notice)
%p.fr-hint-text %p.fr-hint-text
Une notice explicative est un document que vous avez élaboré, destiné à guider lusager dans sa démarche. Le bouton pour télécharger cette notice apparaît en haut du formulaire pour lusager. Une notice explicative est un document que vous avez élaboré, destiné à guider lusager dans sa démarche. Le bouton pour télécharger cette notice apparaît en haut du formulaire pour lusager.
%br %br

View file

@ -11,7 +11,7 @@
- if local_assigns.has_key?(:dossier) - if local_assigns.has_key?(:dossier)
.fr-mt-3w.fr-input-group .fr-mt-3w.fr-input-group
= f.label :piece_jointe, class: "fr-label" = f.label :piece_jointe, class: "fr-label", for: dom_id(commentaire, :piece_jointe)
%div{ data: { controller: "file-input-reset", delete_label: t('views.shared.messages.remove_file') } } %div{ data: { controller: "file-input-reset", delete_label: t('views.shared.messages.remove_file') } }
= render Attachment::MultipleComponent.new(attached_file: commentaire.piece_jointe) = render Attachment::MultipleComponent.new(attached_file: commentaire.piece_jointe)
%ul{ data: { 'file-input-reset-target': 'fileList' } } %ul{ data: { 'file-input-reset-target': 'fileList' } }