From 772ae47521892667e1096aeaf241b0e0ce4bbdfe Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Wed, 26 Jun 2024 16:47:53 +0200 Subject: [PATCH 1/3] change print to download button for user --- app/views/users/dossiers/_merci.html.haml | 2 +- app/views/users/dossiers/show/_header.html.haml | 4 ++-- app/views/users/dossiers/show/_print_dossier.html.haml | 2 +- config/locales/en.yml | 1 - config/locales/fr.yml | 1 - 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/views/users/dossiers/_merci.html.haml b/app/views/users/dossiers/_merci.html.haml index a3f30856c..f55bad730 100644 --- a/app/views/users/dossiers/_merci.html.haml +++ b/app/views/users/dossiers/_merci.html.haml @@ -20,7 +20,7 @@ - if procedure.active_dossier_submitted_message %p.fr-m-2= procedure.active_dossier_submitted_message.message_on_submit_by_usager %p.justify-center.flex.fr-mb-5w.fr-mt-2w - = link_to "#{t('views.users.dossiers.merci.download_dossier')} (PDF)", dossier ? dossier_path(dossier, format: :pdf) : "#", download: "Mon dossier", target: "_blank", rel: "noopener", title: t('views.users.dossiers.show.header.print_dossier'), class: 'fr-btn fr-btn--secondary fr-mx-2w fr-btn--icon-left fr-icon-download-line' + = render(partial: 'users/dossiers/show/print_dossier', locals: { dossier: dossier }) = link_to t('views.users.dossiers.merci.acces_dossier'), dossier ? dossier_path(dossier) : "#dossier" , class: 'fr-btn fr-mx-2w' %hr.fr-hr diff --git a/app/views/users/dossiers/show/_header.html.haml b/app/views/users/dossiers/show/_header.html.haml index 2d0a73858..428ca6eb9 100644 --- a/app/views/users/dossiers/show/_header.html.haml +++ b/app/views/users/dossiers/show/_header.html.haml @@ -14,12 +14,12 @@ - if dossier.show_procedure_state_warning? = render(partial: 'users/dossiers/procedure_removed_banner', locals: { dossier: dossier }) - elsif current_user.owns?(dossier) - .header-actions + .header-actions.fr-mb-3w = render partial: 'invites/dropdown', locals: { dossier: dossier, morphing: false } + = render(partial: 'users/dossiers/show/print_dossier', locals: { dossier: dossier }) - if dossier.can_be_updated_by_user? && !current_page?(modifier_dossier_path(dossier)) = link_to t('views.users.dossiers.demande.edit_dossier'), modifier_dossier_path(dossier), class: 'fr-btn fr-btn-sm', title: t('views.users.dossiers.demande.edit_dossier_title') - = render(partial: 'users/dossiers/show/print_dossier', locals: { dossier: dossier }) %nav.fr-tabs %ul.fr-tabs__list{ role: 'tablist' } diff --git a/app/views/users/dossiers/show/_print_dossier.html.haml b/app/views/users/dossiers/show/_print_dossier.html.haml index 1e2392431..bbc169f37 100644 --- a/app/views/users/dossiers/show/_print_dossier.html.haml +++ b/app/views/users/dossiers/show/_print_dossier.html.haml @@ -1 +1 @@ -= link_to t('views.users.dossiers.show.header.print'), dossier_path(dossier, format: :pdf), target: "_blank", rel: "noopener", title: t('views.users.dossiers.show.header.print_dossier'), class: 'fr-btn fr-icon-printer-line fr-btn--tertiary' += link_to "#{t('views.users.dossiers.merci.download_dossier')} (PDF)", dossier ? dossier_path(dossier, format: :pdf) : "#", download: "Mon dossier", target: "_blank", rel: "noopener", title: t('views.users.dossiers.show.header.print_dossier'), class: 'fr-btn fr-btn--secondary fr-btn--icon-left fr-icon-download-line' diff --git a/config/locales/en.yml b/config/locales/en.yml index 23860d6be..4d5e60ab1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -465,7 +465,6 @@ en: dossier_number: "File n. %{dossier_id}" created_date: "- Draft on %{date_du_dossier}" submit_date: "- Submit on %{date_du_dossier}" - print: "print" print_dossier: "All the file" status_overview: status_draft: draft diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 4559e8795..cedada2ef 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -467,7 +467,6 @@ fr: dossier_number: "Dossier nº %{dossier_id}" created_date: "- En brouillon depuis le %{date_du_dossier}" submit_date: "- Déposé le %{date_du_dossier}" - print: "imprimer" print_dossier: "Tout le dossier" status_overview: status_draft: brouillon From 1b2d4368ae946a45c81f7b5c2c319154afd60559 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Wed, 26 Jun 2024 18:20:48 +0200 Subject: [PATCH 2/3] place button to the left --- app/views/users/dossiers/show/_header.html.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/users/dossiers/show/_header.html.haml b/app/views/users/dossiers/show/_header.html.haml index 428ca6eb9..fade2eeb0 100644 --- a/app/views/users/dossiers/show/_header.html.haml +++ b/app/views/users/dossiers/show/_header.html.haml @@ -15,11 +15,12 @@ = render(partial: 'users/dossiers/procedure_removed_banner', locals: { dossier: dossier }) - elsif current_user.owns?(dossier) .header-actions.fr-mb-3w - = render partial: 'invites/dropdown', locals: { dossier: dossier, morphing: false } = render(partial: 'users/dossiers/show/print_dossier', locals: { dossier: dossier }) - - if dossier.can_be_updated_by_user? && !current_page?(modifier_dossier_path(dossier)) - = link_to t('views.users.dossiers.demande.edit_dossier'), modifier_dossier_path(dossier), class: 'fr-btn fr-btn-sm', - title: t('views.users.dossiers.demande.edit_dossier_title') + .ml-auto + = render partial: 'invites/dropdown', locals: { dossier: dossier, morphing: false } + - if dossier.can_be_updated_by_user? && !current_page?(modifier_dossier_path(dossier)) + = link_to t('views.users.dossiers.demande.edit_dossier'), modifier_dossier_path(dossier), class: 'fr-btn fr-btn-sm fr-ml-1w', + title: t('views.users.dossiers.demande.edit_dossier_title') %nav.fr-tabs %ul.fr-tabs__list{ role: 'tablist' } From 8b4e12a407b4c1bfea95c41880c0f6a2384f7ca7 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Mon, 1 Jul 2024 11:28:39 +0200 Subject: [PATCH 3/3] replace wording, use download instead of print --- app/views/users/dossiers/_merci.html.haml | 2 +- .../users/dossiers/_procedure_removed_banner.html.haml | 2 +- .../users/dossiers/show/_download_dossier.html.haml | 1 + app/views/users/dossiers/show/_header.html.haml | 2 +- app/views/users/dossiers/show/_print_dossier.html.haml | 1 - config/locales/en.yml | 1 - config/locales/fr.yml | 1 - .../users/dossiers/show/_header.html.haml_spec.rb | 10 +++++----- 8 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 app/views/users/dossiers/show/_download_dossier.html.haml delete mode 100644 app/views/users/dossiers/show/_print_dossier.html.haml diff --git a/app/views/users/dossiers/_merci.html.haml b/app/views/users/dossiers/_merci.html.haml index f55bad730..d131104f6 100644 --- a/app/views/users/dossiers/_merci.html.haml +++ b/app/views/users/dossiers/_merci.html.haml @@ -20,7 +20,7 @@ - if procedure.active_dossier_submitted_message %p.fr-m-2= procedure.active_dossier_submitted_message.message_on_submit_by_usager %p.justify-center.flex.fr-mb-5w.fr-mt-2w - = render(partial: 'users/dossiers/show/print_dossier', locals: { dossier: dossier }) + = render(partial: 'users/dossiers/show/download_dossier', locals: { dossier: dossier }) = link_to t('views.users.dossiers.merci.acces_dossier'), dossier ? dossier_path(dossier) : "#dossier" , class: 'fr-btn fr-mx-2w' %hr.fr-hr diff --git a/app/views/users/dossiers/_procedure_removed_banner.html.haml b/app/views/users/dossiers/_procedure_removed_banner.html.haml index cffffab84..a9156cdb5 100644 --- a/app/views/users/dossiers/_procedure_removed_banner.html.haml +++ b/app/views/users/dossiers/_procedure_removed_banner.html.haml @@ -17,4 +17,4 @@ = t('users.dossiers.header.banner.contact_service_html', service_name: dossier.procedure.service.nom, service_phone_number: Phonelib.parse(dossier.procedure.service.telephone_url).full_national, service_email: dossier.procedure.service.email) - if !dossier.brouillon? - = render(partial: 'users/dossiers/show/print_dossier', locals: { dossier: dossier }) + = render(partial: 'users/dossiers/show/download_dossier', locals: { dossier: dossier }) diff --git a/app/views/users/dossiers/show/_download_dossier.html.haml b/app/views/users/dossiers/show/_download_dossier.html.haml new file mode 100644 index 000000000..ed9245955 --- /dev/null +++ b/app/views/users/dossiers/show/_download_dossier.html.haml @@ -0,0 +1 @@ += link_to "#{t('views.users.dossiers.merci.download_dossier')} (PDF)", dossier ? dossier_path(dossier, format: :pdf) : "#", download: "Mon dossier", target: "_blank", rel: "noopener", class: 'fr-btn fr-btn--secondary fr-btn--icon-left fr-icon-download-line' diff --git a/app/views/users/dossiers/show/_header.html.haml b/app/views/users/dossiers/show/_header.html.haml index fade2eeb0..76d30870f 100644 --- a/app/views/users/dossiers/show/_header.html.haml +++ b/app/views/users/dossiers/show/_header.html.haml @@ -15,7 +15,7 @@ = render(partial: 'users/dossiers/procedure_removed_banner', locals: { dossier: dossier }) - elsif current_user.owns?(dossier) .header-actions.fr-mb-3w - = render(partial: 'users/dossiers/show/print_dossier', locals: { dossier: dossier }) + = render(partial: 'users/dossiers/show/download_dossier', locals: { dossier: dossier }) .ml-auto = render partial: 'invites/dropdown', locals: { dossier: dossier, morphing: false } - if dossier.can_be_updated_by_user? && !current_page?(modifier_dossier_path(dossier)) diff --git a/app/views/users/dossiers/show/_print_dossier.html.haml b/app/views/users/dossiers/show/_print_dossier.html.haml deleted file mode 100644 index bbc169f37..000000000 --- a/app/views/users/dossiers/show/_print_dossier.html.haml +++ /dev/null @@ -1 +0,0 @@ -= link_to "#{t('views.users.dossiers.merci.download_dossier')} (PDF)", dossier ? dossier_path(dossier, format: :pdf) : "#", download: "Mon dossier", target: "_blank", rel: "noopener", title: t('views.users.dossiers.show.header.print_dossier'), class: 'fr-btn fr-btn--secondary fr-btn--icon-left fr-icon-download-line' diff --git a/config/locales/en.yml b/config/locales/en.yml index 4d5e60ab1..d2cfbc4b7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -465,7 +465,6 @@ en: dossier_number: "File n. %{dossier_id}" created_date: "- Draft on %{date_du_dossier}" submit_date: "- Submit on %{date_du_dossier}" - print_dossier: "All the file" status_overview: status_draft: draft status_in_progress: in progress diff --git a/config/locales/fr.yml b/config/locales/fr.yml index cedada2ef..f09ff3d3c 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -467,7 +467,6 @@ fr: dossier_number: "Dossier nº %{dossier_id}" created_date: "- En brouillon depuis le %{date_du_dossier}" submit_date: "- Déposé le %{date_du_dossier}" - print_dossier: "Tout le dossier" status_overview: status_draft: brouillon status_in_progress: en construction diff --git a/spec/views/users/dossiers/show/_header.html.haml_spec.rb b/spec/views/users/dossiers/show/_header.html.haml_spec.rb index 1be2c4b8f..6d9c760b7 100644 --- a/spec/views/users/dossiers/show/_header.html.haml_spec.rb +++ b/spec/views/users/dossiers/show/_header.html.haml_spec.rb @@ -47,7 +47,7 @@ describe 'users/dossiers/show/header', type: :view do end it 'can download the dossier' do - expect(rendered).to have_selector('a[title="Tout le dossier"]') + expect(rendered).to have_text('Télécharger mon dossier') end end @@ -65,7 +65,7 @@ describe 'users/dossiers/show/header', type: :view do end it 'can download the dossier' do - expect(rendered).to have_selector('a[title="Tout le dossier"]') + expect(rendered).to have_text('Télécharger mon dossier') end it 'does not display a new procedure link' do @@ -88,7 +88,7 @@ describe 'users/dossiers/show/header', type: :view do end it 'can download the dossier' do - expect(rendered).to have_selector('a[title="Tout le dossier"]') + expect(rendered).to have_text('Télécharger mon dossier') end it 'displays a new procedure link' do @@ -125,7 +125,7 @@ describe 'users/dossiers/show/header', type: :view do end it 'can download the dossier' do - expect(rendered).to have_selector('a[title="Tout le dossier"]') + expect(rendered).to have_text('Télécharger mon dossier') end end @@ -144,7 +144,7 @@ describe 'users/dossiers/show/header', type: :view do end it 'can not download the dossier' do - expect(rendered).not_to have_selector('a[title="Tout le dossier"]') + expect(rendered).not_to have_text('Télécharger mon dossier') end end end