From bfb8611c81f64644bdf3ad9a7b8efe5517c8de46 Mon Sep 17 00:00:00 2001 From: Eric Leroy-Terquem Date: Fri, 27 Oct 2023 14:21:31 +0200 Subject: [PATCH] feat(rnf): display rnf data in show --- app/views/shared/champs/rnf/_show.html.haml | 24 +++++++++++++++++++ config/locales/models/champs/rnf_champ/en.yml | 21 ++++++++++++++++ config/locales/models/champs/rnf_champ/fr.yml | 21 ++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 app/views/shared/champs/rnf/_show.html.haml create mode 100644 config/locales/models/champs/rnf_champ/en.yml create mode 100644 config/locales/models/champs/rnf_champ/fr.yml diff --git a/app/views/shared/champs/rnf/_show.html.haml b/app/views/shared/champs/rnf/_show.html.haml new file mode 100644 index 000000000..aabb571e1 --- /dev/null +++ b/app/views/shared/champs/rnf/_show.html.haml @@ -0,0 +1,24 @@ +- if champ.data.blank? + %p= t('.not_found', rnf: champ.rnf_id) +- else + .fr-background-alt--grey.fr-p-3v + = render Dossiers::RowShowComponent.new(label: t("activemodel.attributes.rnf_champ.rnf_id")) do |c| + - c.with_value do + %p + = champ.rnf_id + = render Dsfr::CopyButtonComponent.new(text: champ.rnf_id, title: t("activemodel.attributes.rnf_champ.paste"), success: t("activemodel.attributes.rnf_champ.paste_success")) + + - ['title', 'email', 'phone', 'address', 'status'].each do |scope| + - if champ.data[scope].present? + = render Dossiers::RowShowComponent.new(label: t("activemodel.attributes.rnf_champ.data.#{scope}")) do |c| + - if scope == 'address' + - c.with_value do + %p= champ.data[scope]['label'] + - else + - c.with_value do + %p= champ.data[scope] + - ['createdAt', 'updatedAt', 'dissolvedAt'].each do |scope| + - if champ.data[scope].present? + = render Dossiers::RowShowComponent.new(label: t("activemodel.attributes.rnf_champ.data.#{scope}")) do |c| + - c.with_value do + %p= l(champ.data[scope].to_date) diff --git a/config/locales/models/champs/rnf_champ/en.yml b/config/locales/models/champs/rnf_champ/en.yml new file mode 100644 index 000000000..8050acc4b --- /dev/null +++ b/config/locales/models/champs/rnf_champ/en.yml @@ -0,0 +1,21 @@ +en: + activemodel: + attributes: + rnf_champ: + rnf_id: RNF id + data: + title: Foundation name + email: Email + phone: Phone + createdAt: Created at + updatedAt: Updated at + dissolvedAt: Dissolved at + address: Address + status: Status + paste: Copy the RNF to the clipboard + paste_success: The RNF has been copied to the clipboard + activerecord: + attributes: + champs/rnf_champ: + hints: + value: "Expected format : 075-FDD-00003-01" diff --git a/config/locales/models/champs/rnf_champ/fr.yml b/config/locales/models/champs/rnf_champ/fr.yml new file mode 100644 index 000000000..a847d6e52 --- /dev/null +++ b/config/locales/models/champs/rnf_champ/fr.yml @@ -0,0 +1,21 @@ +fr: + activemodel: + attributes: + rnf_champ: + rnf_id: Numéro RNF + data: + title: Nom de la fondation + email: Email + phone: Téléphone + createdAt: Créée le + updatedAt: Mise à jour le + dissolvedAt: Dissoute le + address: Adresse + status: Statut + paste: Copier le RNF dans le presse-papier + paste_success: Le RNF a été copié dans le presse-papier + activerecord: + attributes: + champs/rnf_champ: + hints: + value: "Format attendu : 075-FDD-00003-01"