From 2141dd501e6451ba9f96207bfa6ed4861820a8ea Mon Sep 17 00:00:00 2001 From: Damien Le Thiec Date: Wed, 21 Sep 2022 15:18:23 +0200 Subject: [PATCH] Create RNA component --- app/components/editable_champ/rna_component.rb | 2 ++ .../editable_champ/rna_component/rna_component.en.yml | 4 ++++ .../editable_champ/rna_component/rna_component.fr.yml | 4 ++++ .../editable_champ/rna_component/rna_component.html.haml | 9 +++++++++ config/locales/fr.yml | 3 +++ 5 files changed, 22 insertions(+) create mode 100644 app/components/editable_champ/rna_component.rb create mode 100644 app/components/editable_champ/rna_component/rna_component.en.yml create mode 100644 app/components/editable_champ/rna_component/rna_component.fr.yml create mode 100644 app/components/editable_champ/rna_component/rna_component.html.haml diff --git a/app/components/editable_champ/rna_component.rb b/app/components/editable_champ/rna_component.rb new file mode 100644 index 000000000..93afe9641 --- /dev/null +++ b/app/components/editable_champ/rna_component.rb @@ -0,0 +1,2 @@ +class EditableChamp::RNAComponent < EditableChamp::EditableChampBaseComponent +end diff --git a/app/components/editable_champ/rna_component/rna_component.en.yml b/app/components/editable_champ/rna_component/rna_component.en.yml new file mode 100644 index 000000000..795d75d07 --- /dev/null +++ b/app/components/editable_champ/rna_component/rna_component.en.yml @@ -0,0 +1,4 @@ +--- +en: + placeholder: "W503726238" + title: "The RNA number must begin with a capital W followed by 9 digits" diff --git a/app/components/editable_champ/rna_component/rna_component.fr.yml b/app/components/editable_champ/rna_component/rna_component.fr.yml new file mode 100644 index 000000000..4099fff5c --- /dev/null +++ b/app/components/editable_champ/rna_component/rna_component.fr.yml @@ -0,0 +1,4 @@ +--- +fr: + placeholder: "W503726238" + title: "Le numéro RNA doit commencer par un W majuscule suivi de 9 chiffres" diff --git a/app/components/editable_champ/rna_component/rna_component.html.haml b/app/components/editable_champ/rna_component/rna_component.html.haml new file mode 100644 index 000000000..3ed851873 --- /dev/null +++ b/app/components/editable_champ/rna_component/rna_component.html.haml @@ -0,0 +1,9 @@ += @form.text_field :value, + id: @champ.input_id, + aria: { describedby: @champ.describedby_id }, + placeholder: t(".placeholder"), + required: @champ.mandatory?, + pattern: "W[0-9]{9}", + title: t(".title"), + class: "width-33-desktop", + maxlength: 10 diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 1d3178bbd..79f5f7568 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -306,9 +306,12 @@ fr: << : *default_attributes procedure: zone: La démarche est mise en œuvre par + champs: + value: Valeur du champ errors: messages: not_a_phone: 'Numéro de téléphone invalide' + not_a_rna: 'Numéro RNA invalide' models: attestation_template: attributes: