From 48582397685419bc615d4d3d18b1dadbfcfa7126 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 22 Jun 2023 16:04:56 +0200 Subject: [PATCH] amelioration(champ.rna): affiche les retours UX avec les bons composant text dsfr --- .../editable_champ/rna_component/rna_component.html.haml | 1 + app/views/shared/champs/rna/_association.html.haml | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/components/editable_champ/rna_component/rna_component.html.haml b/app/components/editable_champ/rna_component/rna_component.html.haml index b8684093b..b57423b27 100644 --- a/app/components/editable_champ/rna_component/rna_component.html.haml +++ b/app/components/editable_champ/rna_component/rna_component.html.haml @@ -1,3 +1,4 @@ = @form.text_field(:value, input_opts( id: @champ.input_id, aria: { describedby: @champ.describedby_id }, placeholder: t(".placeholder"), data: { controller: 'turbo-input', turbo_input_load_on_connect_value: @champ.prefilled? && @champ.value.present? && @champ.data.blank?, turbo_input_url_value: champs_rna_path(@champ.id) }, required: @champ.required?, pattern: "W[0-9]{9}", title: t(".title"), class: "width-33-desktop", maxlength: 10)) + .rna-info{ id: dom_id(@champ, :rna_info) } = render 'shared/champs/rna/association', champ: @champ, error: nil diff --git a/app/views/shared/champs/rna/_association.html.haml b/app/views/shared/champs/rna/_association.html.haml index f95ac29b6..f38ed4be7 100644 --- a/app/views/shared/champs/rna/_association.html.haml +++ b/app/views/shared/champs/rna/_association.html.haml @@ -1,11 +1,11 @@ - case error - when :invalid - %p.fr-pt-1.fr-pb-0 + %p.fr-error-text Le numéro RNA doit commencer par un W majuscule suivi de 9 chiffres - when :not_found - %p.fr-pt-1.fr-pb-0= t('.not_found') + %p.fr-error-text= t('.not_found') - when :network_error - %p.fr-pt-1.fr-pb-0= t('.network_error') + %p.fr-error-text= t('.network_error') - else - if champ.value.present? - %p.fr-pt-1.fr-pb-0= t('.data_fetched', title: champ.title) + %p.fr-info-text= t('.data_fetched', title: champ.title)