From b125f921eae4925e41bb161f19531326c1733b00 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Wed, 11 Oct 2023 12:14:00 +0200 Subject: [PATCH 1/2] harmonize rna display for instructeur and usager - add grey card like siret --- app/views/shared/champs/rna/_show.html.haml | 21 ++++++++++++------- config/locales/models/champs/rna_champ/en.yml | 3 +++ config/locales/models/champs/rna_champ/fr.yml | 2 ++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/views/shared/champs/rna/_show.html.haml b/app/views/shared/champs/rna/_show.html.haml index 2fc50c039..864b4edc1 100644 --- a/app/views/shared/champs/rna/_show.html.haml +++ b/app/views/shared/champs/rna/_show.html.haml @@ -1,16 +1,23 @@ - if champ.value.blank? %p= t('.not_filled') -- elsif profile == 'instructeur' +- else - if champ.data.blank? %p= t('.not_found', rna: champ.value) - else - %p= t('.data_fetched_title', rna: champ.value) - %ul + %div.fr-background-alt--grey.fr-p-3v + = render Dossiers::RowShowComponent.new(label: t("activemodel.attributes.rna_champ.value")) do |c| + - c.with_value do + %p + = champ.value + =render Dsfr::CopyButtonComponent.new(text: champ.value, title: t("activemodel.attributes.rna_champ.paste"), success: t("activemodel.attributes.rna_champ.paste_success")) + - ['association_titre', 'association_objet', ].each do |scope| - if champ.data[scope].present? - %li #{t("activemodel.attributes.rna_champ.data.#{scope}")} : #{champ.data[scope].capitalize} + = render Dossiers::RowShowComponent.new(label: t("activemodel.attributes.rna_champ.data.#{scope}")) do |c| + - c.with_value do + %p= champ.data[scope] - ['association_date_creation', 'association_date_declaration', 'association_date_publication'].each do |scope| - if champ.data[scope].present? - %li #{t("activemodel.attributes.rna_champ.data.#{scope}")} : #{l(champ.data[scope].to_date)} -- else - %p= champ.identifier + = render Dossiers::RowShowComponent.new(label: t("activemodel.attributes.rna_champ.data.#{scope}")) do |c| + - c.with_value do + %p= l(champ.data[scope].to_date) diff --git a/config/locales/models/champs/rna_champ/en.yml b/config/locales/models/champs/rna_champ/en.yml index 3ac9e32ab..d40042092 100644 --- a/config/locales/models/champs/rna_champ/en.yml +++ b/config/locales/models/champs/rna_champ/en.yml @@ -2,12 +2,15 @@ en: activemodel: attributes: rna_champ: + value: N° RNA data: association_titre: Association name association_objet: Association purpose association_date_creation: Creation date association_date_declaration: Declaration date association_date_publication: Publication date + paste: Copy the RNA to the clipboard + paste_success: The RNA has been copied to the clipboard activerecord: attributes: champs/rna_champ: diff --git a/config/locales/models/champs/rna_champ/fr.yml b/config/locales/models/champs/rna_champ/fr.yml index 52bf93d17..42d3ecfc2 100644 --- a/config/locales/models/champs/rna_champ/fr.yml +++ b/config/locales/models/champs/rna_champ/fr.yml @@ -9,6 +9,8 @@ fr: association_date_creation: Date de création association_date_declaration: Date de déclaration association_date_publication: Date de publication + paste: Copier le RNA dans le presse-papier + paste_success: Le RNA a été copié dans le presse-papier activerecord: attributes: champs/rna_champ: From 2360e5e115f67575cb6ea280e4cb46eee42f1ba0 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Wed, 11 Oct 2023 12:45:41 +0200 Subject: [PATCH 2/2] fix specs --- app/views/shared/champs/rna/_show.html.haml | 4 ++-- config/locales/shared.en.yml | 1 - config/locales/shared.fr.yml | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/shared/champs/rna/_show.html.haml b/app/views/shared/champs/rna/_show.html.haml index 864b4edc1..86f03b0d3 100644 --- a/app/views/shared/champs/rna/_show.html.haml +++ b/app/views/shared/champs/rna/_show.html.haml @@ -4,12 +4,12 @@ - if champ.data.blank? %p= t('.not_found', rna: champ.value) - else - %div.fr-background-alt--grey.fr-p-3v + .fr-background-alt--grey.fr-p-3v = render Dossiers::RowShowComponent.new(label: t("activemodel.attributes.rna_champ.value")) do |c| - c.with_value do %p = champ.value - =render Dsfr::CopyButtonComponent.new(text: champ.value, title: t("activemodel.attributes.rna_champ.paste"), success: t("activemodel.attributes.rna_champ.paste_success")) + = render Dsfr::CopyButtonComponent.new(text: champ.value, title: t("activemodel.attributes.rna_champ.paste"), success: t("activemodel.attributes.rna_champ.paste_success")) - ['association_titre', 'association_objet', ].each do |scope| - if champ.data[scope].present? diff --git a/config/locales/shared.en.yml b/config/locales/shared.en.yml index f9e8ec865..cd59bdb0e 100644 --- a/config/locales/shared.en.yml +++ b/config/locales/shared.en.yml @@ -26,7 +26,6 @@ en: show: not_filled: not filled not_found: "RNA number %{rna} (no association found)" - data_fetched_title: Data received from RNA number "%{rna}" association: data_fetched: "This RNA number is linked to %{title}" not_found: "No association found" diff --git a/config/locales/shared.fr.yml b/config/locales/shared.fr.yml index 0295744f0..2cd62ffd7 100644 --- a/config/locales/shared.fr.yml +++ b/config/locales/shared.fr.yml @@ -28,7 +28,6 @@ fr: show: not_filled: non renseigné not_found: "RNA %{rna} (aucun établissement trouvé)" - data_fetched_title: Données obtenues grâce au RNA "%{rna}" association: data_fetched: "Ce RNA correspond à %{title}" not_found: "Aucun établissement trouvé"