From 14a07c94883563a0c96bd3844548f3c31dd8120e Mon Sep 17 00:00:00 2001 From: Kara Diaby Date: Wed, 13 Apr 2022 15:44:05 +0200 Subject: [PATCH 1/5] locales --- config/locales/en.yml | 41 +++++++++++++++++- config/locales/fr.yml | 43 ++++++++++++++++++- config/locales/models/dossier/en.yml | 20 +++++++++ config/locales/views/instructeurs/en.yml | 5 +++ config/locales/views/instructeurs/fr.yml | 14 ------ .../locales/views/instructeurs/header/en.yml | 4 ++ .../locales/views/instructeurs/header/fr.yml | 4 ++ .../views/instructeurs/procedures/en.yml | 37 ++++++++++++++++ .../views/instructeurs/procedures/fr.yml | 23 ++++++++++ 9 files changed, 175 insertions(+), 16 deletions(-) create mode 100644 config/locales/models/dossier/en.yml create mode 100644 config/locales/views/instructeurs/en.yml create mode 100644 config/locales/views/instructeurs/procedures/en.yml diff --git a/config/locales/en.yml b/config/locales/en.yml index 01e989b67..c9ac66554 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -44,9 +44,12 @@ en: subject: Subject message: Message send_mail: Send message + procedure: Procedures helpers: procedure: testing_procedure: testing procedure + close: Closed + unpublished: Unpublished commentaire: send_message_to_instructeur: "Send a message to the instructor" reply_in_mailbox: "Reply in mailbox" @@ -138,11 +141,38 @@ en: edit_identity: "Edit identity data" instructeurs: dossiers: + tab_steps: + to_follow: to follow + total: total + request: Request + private_annotations: Private annotations + external_opinion: External opininon + messaging: Messaging + involved_persons: Involved persons + tab_explainations: + a_suivre: No instructor is assigned to follow up on these files. Be the first ! + suivis: The folders that are in this tab are only those that you follow. You can exchange with the requester until you can accept them, refuse them or classify them without follow-up. + traites: "The files in this tab are finished: they have been accepted, refused or closed without follow-up." + tous: All the files that have been submitted on this approach, regardless of the status. + supprimes_recemment: All files completed and deleted by the instructors on this approach. + archives: "The files in this tab are archived: you can no longer reply to them, and requesters can no longer modify them." + expirant: Records will not expire prior to the data retention period. archived_dossier: "This file will be kept for an additional month" delete_dossier: "Delete file" deleted_by_user: "File deleted by user" deleted_by_administration: "File deleted by administration" restore: "Restore" + filters: + column: Column + value: Value + add_filter: Add filter + title: Filter + personalize: Personalize + follow_file: Follow-up the file + save: Save + stop_follow: No longer follow + no_file: No file + dossier_synthesis: Summary of files avis: introduction_file_explaination: "File attached to the request for advice" users: @@ -150,9 +180,14 @@ en: archived_dossier: "Your file will be kept %{duree_conservation_dossiers_dans_ds} more months" autosave: autosave_draft: Your draft is automatically saved. - more_infos: More informations + autosave_confirmation: Draft saved + more_information: More informations identite: identity_data: Identity data + civility: Civility + first_name: First Name + last_name: Last Name + birthdate: Date de naissance complete_data: Please complete your personal information to access the procedure. continue: Continue merci: @@ -192,6 +227,8 @@ en: mailbox: "The mailbox allows you to contact the instructor in charge of your file." demande: edit_dossier: "Edit file" + search: + search_file: Search a file index: dossiers: "Files" dossiers_list: @@ -422,6 +459,8 @@ en: deleted_by_instructeur: "The folder has been deleted" impossible_deletion: "Unable to delete : the folder is not processed" restore: "The folder has been restored" + labels: + to_follow: to follow france_connect: particulier: password_confirmation: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index f7075dd1d..98d13a947 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -35,9 +35,12 @@ fr: subject: Sujet message: Message send_mail: Envoyer le message + procedure: Démarches helpers: procedure: testing_procedure: démarche en test + close: Close + unpublished: Dépubliée commentaire: send_message_to_instructeur: "Envoyer un message à l’instructeur" reply_in_mailbox: "Répondre dans la messagerie." @@ -55,7 +58,6 @@ fr: access: Consulter mon dossier question: J’ai une question reply: Répondre à ce message - views: commencer: show: @@ -135,11 +137,39 @@ fr: edit_identity: "Modifier l’identité" instructeurs: dossiers: + tab_steps: + to_follow: à suivre + total: au total + request: Demande + private_annotations: Annotations privées + external_opinion: Avis externes + messaging: Messagerie + involved_persons: Personnes impliquées + tab_explainations: + a_suivre: Aucun instructeur n’est affecté au suivi de ces dossiers. Soyez le premier ! + suivis: Les dossiers qui sont dans cet onglet sont uniquement ceux que vous suivez. Vous pouvez échanger avec le demandeur jusqu'à pouvoir les accepter, les refuser ou les classer sans suite. + traites: "Les dossiers dans cet onglet sont terminés : ils ont été acceptés, refusés ou classés sans suite." + tous: Tous les dossiers qui ont été déposés sur cette démarche, quel que soit le statut. + supprimes_recemment: Tous les dossiers terminés et supprimés par les instructeurs sur cette démarche + archives: "Les dossiers de cet onglet sont archivés : vous ne pouvez plus y répondre, et les demandeurs ne peuvent plus les modifier." + expirant: Les dossiers n'expireront pas avant la période de conservation des données. archived_dossier: "Le dossier sera conservé 1 mois supplémentaire" delete_dossier: "Supprimer le dossier" deleted_by_user: "Dossier supprimé par l'usager" deleted_by_administration: "Dossier supprimé par l'administration" restore: "Restaurer" + filters: + column: Colonne + value: Valeur + add_filter: Ajouter le filtre + title: Filtrer + personalize: Personnaliser + download: Télécharger un dossier + follow_file: Suivre le dossier + stop_follow: Ne plus suivre + save: Enregistrer + no_file: Aucun dossier + dossier_synthesis: Synthèse des dossiers avis: introduction_file_explaination: "Fichier joint à la demande d’avis" users: @@ -147,9 +177,15 @@ fr: archived_dossier: "Votre dossier sera conservé %{duree_conservation_dossiers_dans_ds} mois supplémentaire" autosave: autosave_draft: Votre brouillon est automatiquement enregistré. + autosave_confirmation: Brouillon enregistré + more_information: More informations more_infos: En savoir plus identite: identity_data: Données d’identité + civility: Civilité + first_name: Prénom + last_name: Nom + birthdate: Date de naissance complete_data: Merci de remplir vos informations personnelles pour accéder à la démarche. continue: Continuer merci: @@ -189,6 +225,8 @@ fr: mailbox: "La messagerie vous permet de contacter l’instructeur en charge de votre dossier." demande: edit_dossier: "Modifier le dossier" + search: + search_file: Rechercher un dossier index: dossiers: "Dossiers" dossiers_list: @@ -430,6 +468,9 @@ fr: deleted_by_instructeur: "Le dossier a bien été supprimé de votre interface" impossible_deletion: "Supression impossible : le dossier n'est pas traité" restore: "Le dossier a bien été restauré" + labels: + to_follow: à suivre + total: dossiers administrateurs: procedures: show: diff --git a/config/locales/models/dossier/en.yml b/config/locales/models/dossier/en.yml new file mode 100644 index 000000000..c9bb7d046 --- /dev/null +++ b/config/locales/models/dossier/en.yml @@ -0,0 +1,20 @@ +en: + activerecord: + models: + dossier: + one: "File" + other: "Files" + attributes: + dossier: + state: "State" + dossier/state: &state + brouillon: "Draft" + en_construction: "In progress" + en_instruction: "Processing" + accepte: "Accepted" + refuse: "Refused" + sans_suite: "No further action" + traitement: + state: "State" + traitement/state: + <<: *state diff --git a/config/locales/views/instructeurs/en.yml b/config/locales/views/instructeurs/en.yml new file mode 100644 index 000000000..9ebb913db --- /dev/null +++ b/config/locales/views/instructeurs/en.yml @@ -0,0 +1,5 @@ +en: + instructeurs: + procedure: + archive_pending_html: Archive creation pending
(requested %{created_period} ago) + archive_ready_html: Download archive
(requested %{generated_period} ago) \ No newline at end of file diff --git a/config/locales/views/instructeurs/fr.yml b/config/locales/views/instructeurs/fr.yml index cc8c539ff..153dbc679 100644 --- a/config/locales/views/instructeurs/fr.yml +++ b/config/locales/views/instructeurs/fr.yml @@ -1,20 +1,6 @@ fr: instructeurs: procedure: - export_stale: - everything_short: Demander un export au format %{export_format} - everything_csv_html: Demander un export au format .csv
(uniquement les dossiers, sans les champs répétables) - everything_xlsx_html: Demander un export au format .xlsx - everything_ods_html: Demander un export au format .ods - monthly_short: Demander un export des 30 derniers jours au format %{export_format} - monthly_csv_html: Demander un export des 30 derniers jours au format .csv
(uniquement les dossiers, sans les champs répétables) - monthly_xlsx_html: Demander un export des 30 derniers jours au format .xlsx - monthly_ods_html: Demander un export des 30 derniers jours au format .ods - export_everything_ready_html: Télécharger l’export au format %{export_format}
(généré il y a %{export_time}) - export_everything_pending_html: Un export au format %{export_format} est en train d’être généré
(demandé il y a %{export_time}) - export_monthly_ready_html: Télécharger l’export des 30 derniers jours au format %{export_format}
(généré il y a %{export_time}) - export_monthly_pending_html: Un export des 30 derniers jours au format %{export_format} est en train d’être généré
(demandé il y a %{export_time}) - download_archive: Télécharger une archive au format .zip de tous les dossiers et leurs pièces jointes archive_pending_html: Archive en cours de création
(demandée il y a %{created_period}) archive_ready_html: Télécharger l’archive
(demandée il y a %{generated_period}) dossiers: diff --git a/config/locales/views/instructeurs/header/en.yml b/config/locales/views/instructeurs/header/en.yml index bf30db1e0..f02d1f484 100644 --- a/config/locales/views/instructeurs/header/en.yml +++ b/config/locales/views/instructeurs/header/en.yml @@ -10,3 +10,7 @@ en: en_construction: This file is pending for instruction. The maximum delay is 6 months, you can extend the duration by a month by clicking on the underneath button. termine: This file had been processed and will soon expire. So it will be deleted soon. If you want to keep it, you can dowload a PDF file of it. button_delay_expiration: "Keep for one more month" + notification_management: notification management + statistics: statistics + instructeurs: instructors + contact_users: contact users (draft) diff --git a/config/locales/views/instructeurs/header/fr.yml b/config/locales/views/instructeurs/header/fr.yml index ca41a5f37..897089433 100644 --- a/config/locales/views/instructeurs/header/fr.yml +++ b/config/locales/views/instructeurs/header/fr.yml @@ -10,3 +10,7 @@ fr: en_construction: Ce dossier est en attente de prise en charge. Vous pouvez toutefois entendre cette durée d'un mois en cliquant sur le bouton suivant. termine: Le traitement de ce dossier est terminé, mais il va bientôt expirer. Cela signifie qu’il va bientôt être supprimé. Si vous souhaitez conserver une trace, vous pouvez le télécharger au format PDF. button_delay_expiration: "Conserver un mois de plus" + notification_management: gestion des notifications + statistics: statistiques + instructeurs: instructeurs + contact_users: contacter les usagers (brouillon) diff --git a/config/locales/views/instructeurs/procedures/en.yml b/config/locales/views/instructeurs/procedures/en.yml new file mode 100644 index 000000000..fcad189aa --- /dev/null +++ b/config/locales/views/instructeurs/procedures/en.yml @@ -0,0 +1,37 @@ +en: + instructeurs: + procedures: + index: + to_follow: to follow + followed: followed + processed: processed + all: files + archived: archived + dossiers_close_to_expiration: expiring + dossiers_supprimes_recemment: recently deleted + dossiers_export: + everything_csv_html: Ask an export in format .csv
(only folders, without repeatable fields) + everything_xlsx_html: Ask an export in format .xlsx + everything_ods_html: Ask an export in format .ods + everything_zip_html: Ask an export in format .zip + everything_short: Ask an export in format%{export_format} + everything_pending_html: Ask an export in format %{export_format} is being generated
(ask %{export_time} ago) + everything_ready_html: Download the export in format %{export_format}
(generated %{export_time} ago) + download: + one: Download a file + other: Download %{count} files + download_dossiers: + everything_short: Ask an export in format %{export_format} + everything_csv_html: Ask an export in format .csv
(only folders, without repeatable fields) + everything_xlsx_html: Ask an export in format .xlsx + everything_ods_html: Ask an export in format .ods + monthly_short: Request an export of the last 30 days in the format %{export_format} + monthly_csv_html: Request an export of the last 30 days in the format .csv
(only folders, without repeatable fields) + monthly_xlsx_html: Request an export of the last 30 days in the format .xlsx + monthly_ods_html: Request an export of the last 30 days in the format .ods + export_everything_ready_html: Download the export in the format %{export_format}
(generated %{export_time} ago) + export_everything_pending_html: An export in the format %{export_format} is being generated
(asked %{export_time} ago) + export_monthly_ready_html: Request an export of the last 30 days in the format %{export_format}
(generated %{export_time} ago) + export_monthly_pending_html: An export of the last 30 days in the format %{export_format} is being generated
(asked %{export_time} ago) + download_archive: Download a .zip archive of all files and their attachments + download: Download all files diff --git a/config/locales/views/instructeurs/procedures/fr.yml b/config/locales/views/instructeurs/procedures/fr.yml index b4139e687..57e8ab32a 100644 --- a/config/locales/views/instructeurs/procedures/fr.yml +++ b/config/locales/views/instructeurs/procedures/fr.yml @@ -1,6 +1,14 @@ fr: instructeurs: procedures: + index: + to_follow: à suivre + followed: suivis + processed: traités + all: dossiers + archived: archivés + dossiers_close_to_expiration: expirant + dossiers_supprimes_recemment: supprimés dossiers_export: everything_csv_html: Demander un export au format .csv
(uniquement les dossiers, sans les champs répétables) everything_xlsx_html: Demander un export au format .xlsx @@ -12,3 +20,18 @@ fr: download: one: Télécharger un dossier other: Télécharger %{count} dossiers + download_dossiers: + everything_short: Demander un export au format %{export_format} + everything_csv_html: Demander un export au format .csv
(uniquement les dossiers, sans les champs répétables) + everything_xlsx_html: Demander un export au format .xlsx + everything_ods_html: Demander un export au format .ods + monthly_short: Demander un export des 30 derniers jours au format %{export_format} + monthly_csv_html: Demander un export des 30 derniers jours au format .csv
(uniquement les dossiers, sans les champs répétables) + monthly_xlsx_html: Demander un export des 30 derniers jours au format .xlsx + monthly_ods_html: Demander un export des 30 derniers jours au format .ods + export_everything_ready_html: Télécharger l’export au format %{export_format}
(généré il y a %{export_time}) + export_everything_pending_html: Un export au format %{export_format} est en train d’être généré
(demandé il y a %{export_time}) + export_monthly_ready_html: Télécharger l’export des 30 derniers jours au format %{export_format}
(généré il y a %{export_time}) + export_monthly_pending_html: Un export des 30 derniers jours au format %{export_format} est en train d’être généré
(demandé il y a %{export_time}) + download_archive: Télécharger une archive au format .zip de tous les dossiers et leurs pièces jointes + download: Télécharger tous les dossiers From 900b8f7be6771a39fb5581f9487237d923b539fc Mon Sep 17 00:00:00 2001 From: Kara Diaby Date: Wed, 13 Apr 2022 15:44:22 +0200 Subject: [PATCH 2/5] controller --- .../instructeurs/procedures_controller.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/instructeurs/procedures_controller.rb b/app/controllers/instructeurs/procedures_controller.rb index 172891bc8..cf32e1167 100644 --- a/app/controllers/instructeurs/procedures_controller.rb +++ b/app/controllers/instructeurs/procedures_controller.rb @@ -35,13 +35,13 @@ module Instructeurs .count @all_dossiers_counts = { - 'à suivre' => @dossiers_a_suivre_count_per_procedure.sum { |_, v| v }, - 'suivis' => @followed_dossiers_count_per_procedure.sum { |_, v| v }, - 'traités' => @dossiers_termines_count_per_procedure.sum { |_, v| v }, - 'dossiers' => @dossiers_count_per_procedure.sum { |_, v| v }, - 'expirant' => @dossiers_expirant_count_per_procedure.sum { |_, v| v }, - 'archivés' => @dossiers_archived_count_per_procedure.sum { |_, v| v }, - 'supprimés récemment' => @dossiers_supprimes_recemment_count_per_procedure.sum { |_, v| v } + t('.to_follow') => @dossiers_a_suivre_count_per_procedure.sum { |_, v| v }, + t('.followed') => @followed_dossiers_count_per_procedure.sum { |_, v| v }, + t('.processed') => @dossiers_termines_count_per_procedure.sum { |_, v| v }, + t('.all') => @dossiers_count_per_procedure.sum { |_, v| v }, + t('.dossiers_close_to_expiration') => @dossiers_expirant_count_per_procedure.sum { |_, v| v }, + t('.archived') => @dossiers_archived_count_per_procedure.sum { |_, v| v }, + t('.dossiers_supprimes_recemment') => @dossiers_supprimes_recemment_count_per_procedure.sum { |_, v| v } } @procedure_ids_en_cours_with_notifications = current_instructeur.procedure_ids_with_notifications(:en_cours) From 3f2ef985c7eb19c26ce79fb8b4996618f290a5d1 Mon Sep 17 00:00:00 2001 From: Kara Diaby Date: Wed, 13 Apr 2022 15:44:29 +0200 Subject: [PATCH 3/5] layout --- app/views/experts/avis/index.html.haml | 6 ++-- .../instructeurs/dossiers/_header.html.haml | 10 +++---- .../procedures/_dossier_actions.html.haml | 4 +-- .../procedures/_dossiers_export.html.haml | 4 +++ .../procedures/_dossiers_filter.html.haml | 8 +++--- .../procedures/_download_dossiers.html.haml | 24 ++++++++++++---- .../instructeurs/procedures/_header.html.haml | 12 ++++---- .../instructeurs/procedures/_list.html.haml | 2 +- .../procedures/_synthese.html.haml | 2 +- .../instructeurs/procedures/_tabs.html.haml | 4 +-- .../instructeurs/procedures/show.html.haml | 28 +++++++++++-------- app/views/layouts/_header.haml | 4 +-- .../layouts/_search_dossiers_form.html.haml | 4 +-- .../dossiers/_identite_individual.html.haml | 12 +++++--- .../help/_help_dropdown_dossier.html.haml | 3 +- .../help/_help_dropdown_instructeur.html.haml | 3 +- .../help/_help_dropdown_procedure.html.haml | 3 +- app/views/users/dossiers/_autosave.html.haml | 4 +-- 18 files changed, 84 insertions(+), 53 deletions(-) diff --git a/app/views/experts/avis/index.html.haml b/app/views/experts/avis/index.html.haml index 7b8838a3e..75c482834 100644 --- a/app/views/experts/avis/index.html.haml +++ b/app/views/experts/avis/index.html.haml @@ -35,7 +35,9 @@ - if p.close? .procedure-status - %span.label Close + %span.label + = t('helpers.procedure.close') - elsif p.depubliee? .procedure-status - %span.label Dépubliée + %span.label + = t('helpers.procedure.unpublished') diff --git a/app/views/instructeurs/dossiers/_header.html.haml b/app/views/instructeurs/dossiers/_header.html.haml index 5482a64e1..ce3536509 100644 --- a/app/views/instructeurs/dossiers/_header.html.haml +++ b/app/views/instructeurs/dossiers/_header.html.haml @@ -19,23 +19,23 @@ %ul - notifications_summary = current_instructeur.notifications_for_dossier(dossier) - = dynamic_tab_item('Demande', + = dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.request'), instructeur_dossier_path(dossier.procedure, dossier), notification: notifications_summary[:demande]) - = dynamic_tab_item('Annotations privées', + = dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.private_annotations'), annotations_privees_instructeur_dossier_path(dossier.procedure, dossier), notification: notifications_summary[:annotations_privees]) - = dynamic_tab_item('Avis externes', + = dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.external_opinion'), avis_instructeur_dossier_path(dossier.procedure, dossier), notification: notifications_summary[:avis]) - = dynamic_tab_item('Messagerie', + = dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.messaging'), messagerie_instructeur_dossier_path(dossier.procedure, dossier), notification: notifications_summary[:messagerie]) - = dynamic_tab_item('Personnes impliquées', + = dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.involved_persons'), personnes_impliquees_instructeur_dossier_path(dossier.procedure, dossier)) .container diff --git a/app/views/instructeurs/procedures/_dossier_actions.html.haml b/app/views/instructeurs/procedures/_dossier_actions.html.haml index 76d90c6b5..c4e82a15e 100644 --- a/app/views/instructeurs/procedures/_dossier_actions.html.haml +++ b/app/views/instructeurs/procedures/_dossier_actions.html.haml @@ -35,8 +35,8 @@ - if dossier_is_followed = link_to unfollow_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'button' do %span.icon.unfollow> - Ne plus suivre + = t('views.instructeurs.dossiers.stop_follow') - else = link_to follow_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'button' do %span.icon.follow> - Suivre le dossier + = t('views.instructeurs.dossiers.follow_file') diff --git a/app/views/instructeurs/procedures/_dossiers_export.html.haml b/app/views/instructeurs/procedures/_dossiers_export.html.haml index 45f0754b5..9ca01acf2 100644 --- a/app/views/instructeurs/procedures/_dossiers_export.html.haml +++ b/app/views/instructeurs/procedures/_dossiers_export.html.haml @@ -8,6 +8,10 @@ - export = item[:export] %li - if export.nil? + // i18n-tasks-use t('.everything_csv_html') + // i18n-tasks-use t('.everything_xlsx_html') + // i18n-tasks-use t('.everything_ods_html') + // i18n-tasks-use t('.everything_zip_html') = link_to t(".everything_#{format}_html"), download_export_instructeur_procedure_path(procedure, statut: statut, export_format: format), remote: true - elsif export.ready? = link_to t(".everything_ready_html", export_time: time_ago_in_words(export.updated_at), export_format: ".#{format}"), export.file.service_url, target: "_blank", rel: "noopener" diff --git a/app/views/instructeurs/procedures/_dossiers_filter.html.haml b/app/views/instructeurs/procedures/_dossiers_filter.html.haml index ac7c88839..b60b17008 100644 --- a/app/views/instructeurs/procedures/_dossiers_filter.html.haml +++ b/app/views/instructeurs/procedures/_dossiers_filter.html.haml @@ -1,16 +1,16 @@ %span.dropdown %button.button.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'filter-menu' } - Filtrer + = t('views.instructeurs.dossiers.filters.title') #filter-menu.dropdown-content.left-aligned.fade-in-down = form_tag add_filter_instructeur_procedure_path(procedure), method: :post, class: 'dropdown-form large' do - = label_tag :field, "Colonne" + = label_tag :field, t('views.instructeurs.dossiers.filters.column') = select_tag :field, options_for_select(displayed_fields_options) %br - = label_tag :value, "Valeur" + = label_tag :value, t('views.instructeurs.dossiers.filters.value') = text_field_tag :value, nil, maxlength: ProcedurePresentation::FILTERS_VALUE_MAX_LENGTH = hidden_field_tag :statut, statut %br - = submit_tag "Ajouter le filtre", class: 'button' + = submit_tag t('views.instructeurs.dossiers.filters.add_filter'), class: 'button' - current_filters.group_by { |filter| filter['table'] }.each_with_index do |(table, filters), i| - if i > 0 diff --git a/app/views/instructeurs/procedures/_download_dossiers.html.haml b/app/views/instructeurs/procedures/_download_dossiers.html.haml index 11e83b75e..80477d130 100644 --- a/app/views/instructeurs/procedures/_download_dossiers.html.haml +++ b/app/views/instructeurs/procedures/_download_dossiers.html.haml @@ -1,6 +1,6 @@ %span.dropdown %button.button.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'download-menu' } - Télécharger tous les dossiers + = t('.download') #download-menu.dropdown-content.fade-in-down{ style: 'width: 450px' } %ul.dropdown-items - exports_list(exports).each do |item| @@ -9,14 +9,26 @@ - export = item[:export] %li - if export.nil? - = link_to t("#{time_span_type}_#{format}_html", scope: [:instructeurs, :procedure, :export_stale]), download_export_instructeur_procedure_path(procedure, time_span_type: time_span_type, export_format: format), remote: true + // i18n-tasks-use t('.everything_csv_html') + // i18n-tasks-use t('.monthly_csv_html') + // i18n-tasks-use t('.everything_xlsx_html') + // i18n-tasks-use t('.monthly_xlsx_html') + // i18n-tasks-use t('.everything_ods_html') + // i18n-tasks-use t('.monthly_ods_html') + = link_to t(".#{time_span_type}_#{format}_html"), download_export_instructeur_procedure_path(procedure, time_span_type: time_span_type, export_format: format), remote: true - elsif export.ready? - = link_to t("export_#{time_span_type}_ready_html", export_time: time_ago_in_words(export.updated_at), export_format: ".#{format}", scope: [:instructeurs, :procedure]), export.file.service_url, target: "_blank", rel: "noopener" + // i18n-tasks-use t('.export_everything_ready_html') + // i18n-tasks-use t('.export_monthly_ready_html') + = link_to t(".export_#{time_span_type}_ready_html", export_time: time_ago_in_words(export.updated_at), export_format: ".#{format}"), export.file.service_url, target: "_blank", rel: "noopener" - if export.old? - = button_to download_export_instructeur_procedure_path(procedure, export_format: format, time_span_type: time_span_type, force_export: true), class: "button small", style: "padding-right: 2px", title: t("#{time_span_type}_short", export_format: ".#{format}", scope: [:instructeurs, :procedure, :export_stale]), remote: true, method: :get, params: { export_format: format, time_span_type: time_span_type, force_export: true } do + // i18n-tasks-use t('.everything_short') + // i18n-tasks-use t('.monthly_short') + = button_to download_export_instructeur_procedure_path(procedure, export_format: format, time_span_type: time_span_type, force_export: true), class: "button small", style: "padding-right: 2px", title: t(".#{time_span_type}_short", export_format: ".#{format}"), remote: true, method: :get, params: { export_format: format, time_span_type: time_span_type, force_export: true } do .icon.retry - else %span{ 'data-export-poll-url': download_export_instructeur_procedure_path(procedure, export_format: format, time_span_type: time_span_type, no_progress_notification: true) } - = t("export_#{time_span_type}_pending_html", export_time: time_ago_in_words(export.created_at), export_format: ".#{format}", scope: [:instructeurs, :procedure]) + // i18n-tasks-use t('.export_everything_pending_html') + // i18n-tasks-use t('.export_monthly_pending_html') + = t(".export_#{time_span_type}_pending_html", export_time: time_ago_in_words(export.created_at), export_format: ".#{format}") %li - = link_to t(:download_archive, scope: [:instructeurs, :procedure]), instructeur_archives_path(procedure) + = link_to t(".download_archive"), instructeur_archives_path(procedure) diff --git a/app/views/instructeurs/procedures/_header.html.haml b/app/views/instructeurs/procedures/_header.html.haml index 58598bac1..8e54952e1 100644 --- a/app/views/instructeurs/procedures/_header.html.haml +++ b/app/views/instructeurs/procedures/_header.html.haml @@ -1,19 +1,19 @@ .procedure-header %h1= procedure_libelle procedure - = link_to 'gestion des notifications', email_notifications_instructeur_procedure_path(procedure), class: 'header-link' + = link_to t('instructeurs.dossiers.header.banner.notification_management'), email_notifications_instructeur_procedure_path(procedure), class: 'header-link' | - = link_to 'statistiques', stats_instructeur_procedure_path(procedure), class: 'header-link' + = link_to t('instructeurs.dossiers.header.banner.statistics'), stats_instructeur_procedure_path(procedure), class: 'header-link' - if procedure.instructeurs_self_management? | - if can_manage_groupe_instructeurs?(procedure) - = link_to 'instructeurs', admin_procedure_groupe_instructeurs_path(procedure), class: 'header-link' + = link_to t('instructeurs.dossiers.header.banner.instructeurs'), admin_procedure_groupe_instructeurs_path(procedure), class: 'header-link' - elsif procedure.routee? - = link_to 'instructeurs', instructeur_groupes_path(procedure), class: 'header-link' + = link_to t('instructeurs.dossiers.header.banner.instructeurs'), instructeur_groupes_path(procedure), class: 'header-link' - else - = link_to 'instructeurs', instructeur_groupe_path(procedure, procedure.defaut_groupe_instructeur), class: 'header-link' + = link_to t('instructeurs.dossiers.header.banner.instructeurs'), instructeur_groupe_path(procedure, procedure.defaut_groupe_instructeur), class: 'header-link' - if can_send_groupe_message?(procedure) | - = link_to 'contacter les usagers (brouillon)', email_usagers_instructeur_procedure_path(procedure), class: 'header-link' + = link_to t('instructeurs.dossiers.header.banner.contact_users'), email_usagers_instructeur_procedure_path(procedure), class: 'header-link' diff --git a/app/views/instructeurs/procedures/_list.html.haml b/app/views/instructeurs/procedures/_list.html.haml index 073a1bea9..863894e90 100644 --- a/app/views/instructeurs/procedures/_list.html.haml +++ b/app/views/instructeurs/procedures/_list.html.haml @@ -15,7 +15,7 @@ .stats-number = number_with_html_delimiter(a_suivre_count) .stats-legend - à suivre + = t('instructeurs.dossiers.labels.to_follow') %li %object = link_to(instructeur_procedure_path(p, statut: 'suivis')) do diff --git a/app/views/instructeurs/procedures/_synthese.html.haml b/app/views/instructeurs/procedures/_synthese.html.haml index 5724eba3c..b9d705700 100644 --- a/app/views/instructeurs/procedures/_synthese.html.haml +++ b/app/views/instructeurs/procedures/_synthese.html.haml @@ -1,6 +1,6 @@ - if procedures.length > 1 .tab-title %span - Synthèse des dossiers + = t('views.instructeurs.dossiers.dossier_synthesis') - all_dossiers_counts.each_with_index do |(label, dossier_count)| %span.badge.procedure-synthese-badge= number_with_html_delimiter(dossier_count) + ' ' + label diff --git a/app/views/instructeurs/procedures/_tabs.html.haml b/app/views/instructeurs/procedures/_tabs.html.haml index 9b35e6d70..e250f4840 100644 --- a/app/views/instructeurs/procedures/_tabs.html.haml +++ b/app/views/instructeurs/procedures/_tabs.html.haml @@ -1,6 +1,6 @@ %nav.tabs.mt-3 %ul - = tab_item('à suivre', + = tab_item(t('views.instructeurs.dossiers.tab_steps.to_follow'), instructeur_procedure_path(procedure, statut: 'a-suivre'), active: statut == 'a-suivre', badge: number_with_html_delimiter(a_suivre_count)) @@ -17,7 +17,7 @@ badge: number_with_html_delimiter(traites_count), notification: has_termine_notifications) - = tab_item('au total', + = tab_item(t('views.instructeurs.dossiers.tab_steps.total'), instructeur_procedure_path(procedure, statut: 'tous'), active: statut == 'tous', badge: number_with_html_delimiter(tous_count)) diff --git a/app/views/instructeurs/procedures/show.html.haml b/app/views/instructeurs/procedures/show.html.haml index feae02087..679ba09ee 100644 --- a/app/views/instructeurs/procedures/show.html.haml +++ b/app/views/instructeurs/procedures/show.html.haml @@ -27,18 +27,23 @@ .container - if @statut == 'a-suivre' - %p.explication-onglet Aucun instructeur n’est affecté au suivi de ces dossiers. Soyez le premier ! + %p.explication-onglet + = t('views.instructeurs.dossiers.tab_explainations.a_suivre') - if @statut == 'suivis' - %p.explication-onglet Les dossiers qui sont dans cet onglet sont uniquement ceux que vous suivez. Vous pouvez échanger avec le demandeur jusqu'à pouvoir les accepter, les refuser ou les classer sans suite. + %p.explication-onglet + = t('views.instructeurs.dossiers.tab_explainations.suivis') - if @statut == 'traites' - %p.explication-onglet Les dossiers dans cet onglet sont terminés : ils ont été acceptés, refusés ou classés sans suite. + %p.explication-onglet + = t('views.instructeurs.dossiers.tab_explainations.traites') - if @statut == 'tous' - %p.explication-onglet Tous les dossiers qui ont été déposés sur cette démarche, quel que soit le statut. + %p.explication-onglet + = t('views.instructeurs.dossiers.tab_explainations.tous') - if @statut == 'supprimes_recemment' - %p.explication-onglet Tous les dossiers terminés et supprimés par les instructeurs sur cette démarche + %p.explication-onglet + = t('views.instructeurs.dossiers.tab_explainations.supprimes_recemment') - if @statut == 'archives' %p.explication-onglet - Les dossiers de cet onglet sont archivés : vous ne pouvez plus y répondre, et les demandeurs ne peuvent plus les modifier. + = t('views.instructeurs.dossiers.tab_explainations.archives') %br Ces dossiers seront supprimés lorsque leur délai de conservation dans Démarches-simplifiées - if @procedure.duree_conservation_dossiers_dans_ds @@ -50,8 +55,8 @@ %span.icon.delete Afficher les dossiers supprimés - if @statut == 'expirant' - %p.explication-onglet Les dossiers n'expireront pas avant la période de conservation des données. - + %p.explication-onglet + = t('views.instructeurs.dossiers.tab_explainations.expirant') - if @filtered_sorted_paginated_ids.present? || @current_filters.count > 0 - pagination = paginate @filtered_sorted_paginated_ids = pagination @@ -80,7 +85,7 @@ %th.action-col.follow-col %span.dropdown %button.button.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'custom-menu' } - Personnaliser + = t('views.instructeurs.dossiers.personalize') #custom-menu.dropdown-content.fade-in-down = form_tag update_displayed_fields_instructeur_procedure_path(@procedure), method: :patch, class: 'dropdown-form large columns-form' do = hidden_field_tag :values, nil @@ -92,7 +97,7 @@ group: '.columns-form', name: 'values') - = submit_tag "Enregistrer", class: 'button' + = submit_tag t('views.instructeurs.dossiers.save'), class: 'button' %tbody - @projected_dossiers.each do |p| @@ -142,4 +147,5 @@ = pagination - else - %h2.empty-text Aucun dossier + %h2.empty-text + = t('views.instructeurs.dossiers.no_file') diff --git a/app/views/layouts/_header.haml b/app/views/layouts/_header.haml index 7566f1a88..06742d50e 100644 --- a/app/views/layouts/_header.haml +++ b/app/views/layouts/_header.haml @@ -23,7 +23,7 @@ %ul.header-tabs - if current_instructeur.procedures.any? %li - = active_link_to "Démarches", instructeur_procedures_path, active: ['dossiers','procedures'].include?(controller_name), class: 'tab-link' + = active_link_to t('utils.procedure'), instructeur_procedures_path, active: ['dossiers','procedures'].include?(controller_name), class: 'tab-link' - if current_instructeur.user.expert && current_expert.avis_summary[:total] > 0 = render partial: 'layouts/header/avis_tab', locals: { current_expert: current_expert } @@ -31,7 +31,7 @@ %ul.header-tabs - if current_expert.user.instructeur && current_instructeur.procedures.any? %li - = active_link_to "Démarches", instructeur_procedures_path, active: ['dossiers','procedures'].include?(controller_name), class: 'tab-link' + = active_link_to t('utils.procedure'), instructeur_procedures_path, active: ['dossiers','procedures'].include?(controller_name), class: 'tab-link' - if current_expert.avis_summary[:total] > 0 = render partial: 'layouts/header/avis_tab', locals: { current_expert: current_expert } diff --git a/app/views/layouts/_search_dossiers_form.html.haml b/app/views/layouts/_search_dossiers_form.html.haml index 8c75c2714..341f41e49 100644 --- a/app/views/layouts/_search_dossiers_form.html.haml +++ b/app/views/layouts/_search_dossiers_form.html.haml @@ -1,5 +1,5 @@ .header-search{ role: 'search' } = form_tag "#{search_endpoint}", method: :get, class: "form" do - = text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: "Rechercher un dossier", title: "Rechercher un dossier" - %button{ title: "Rechercher" } + = text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: t('views.users.dossiers.search.search_file'), title: t('views.users.dossiers.search.search_file') + %button{ title: t('views.users.dossiers.search.search_file') } = image_tag "icons/search-blue.svg", alt: 'Rechercher', 'aria-hidden':'true', width: 24, height: 24, loading: 'lazy' diff --git a/app/views/shared/dossiers/_identite_individual.html.haml b/app/views/shared/dossiers/_identite_individual.html.haml index 344329239..887022c3b 100644 --- a/app/views/shared/dossiers/_identite_individual.html.haml +++ b/app/views/shared/dossiers/_identite_individual.html.haml @@ -1,15 +1,19 @@ %table.table.vertical.dossier-champs %tbody %tr - %td.libelle Civilité : + %td.libelle + = t('views.users.dossiers.identite.civility') %td= individual.gender %tr - %td.libelle Prénom : + %td.libelle + = t('views.users.dossiers.identite.first_name') %td= individual.prenom %tr - %td.libelle Nom : + %td.libelle + = t('views.users.dossiers.identite.last_name') %td= individual.nom - if individual.birthdate.present? %tr - %td.libelle Date de naissance : + %td.libelle + = t('views.users.dossiers.identite.birthdate') %td= try_format_date(individual.birthdate) diff --git a/app/views/shared/help/_help_dropdown_dossier.html.haml b/app/views/shared/help/_help_dropdown_dossier.html.haml index 581ab3ce2..10339433c 100644 --- a/app/views/shared/help/_help_dropdown_dossier.html.haml +++ b/app/views/shared/help/_help_dropdown_dossier.html.haml @@ -1,5 +1,6 @@ .dropdown.help-dropdown - %button.button.primary.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'help-menu' } Aide + %button.button.primary.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'help-menu' } + = t('help') #help-menu.dropdown-content.fade-in-down %ul.dropdown-items - title = dossier.brouillon? ? "Besoin d’aide pour remplir votre dossier ?" : "Une question sur votre dossier ?" diff --git a/app/views/shared/help/_help_dropdown_instructeur.html.haml b/app/views/shared/help/_help_dropdown_instructeur.html.haml index 1da8b5835..2be47dd17 100644 --- a/app/views/shared/help/_help_dropdown_instructeur.html.haml +++ b/app/views/shared/help/_help_dropdown_instructeur.html.haml @@ -1,5 +1,6 @@ .dropdown.help-dropdown - %button.button.primary.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'help-menu' } Aide + %button.button.primary.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'help-menu' } + = t('help') #help-menu.dropdown-content.fade-in-down %ul.dropdown-items = render partial: 'shared/help/dropdown_items/faq_item' diff --git a/app/views/shared/help/_help_dropdown_procedure.html.haml b/app/views/shared/help/_help_dropdown_procedure.html.haml index 18f2ca096..3b8faeddf 100644 --- a/app/views/shared/help/_help_dropdown_procedure.html.haml +++ b/app/views/shared/help/_help_dropdown_procedure.html.haml @@ -1,5 +1,6 @@ .dropdown.help-dropdown - %button.button.primary.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'help-menu' } Aide + %button.button.primary.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'help-menu' } + = t('help') #help-menu.dropdown-content.fade-in-down %ul.dropdown-items - if procedure.service.present? diff --git a/app/views/users/dossiers/_autosave.html.haml b/app/views/users/dossiers/_autosave.html.haml index f0bd50f4b..382f182dc 100644 --- a/app/views/users/dossiers/_autosave.html.haml +++ b/app/views/users/dossiers/_autosave.html.haml @@ -7,8 +7,8 @@ %p.autosave-status.succeeded %span.autosave-icon.icon.accept %span.autosave-label - Brouillon enregistré - = link_to 'En savoir plus', FAQ_AUTOSAVE_URL, target: '_blank', rel: 'noopener', class: 'autosave-more-infos' + = t('views.users.dossiers.autosave.autosave_confirmation') + = link_to t('views.users.dossiers.autosave.more_information'), FAQ_AUTOSAVE_URL, target: '_blank', rel: 'noopener', class: 'autosave-more-infos' %p.autosave-status.failed %span.autosave-icon ⚠️ From 83a8d87e95cbab8e07ecc44966f5d14dffbd97dd Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 14 Apr 2022 10:30:23 +0200 Subject: [PATCH 4/5] i18n(procedure_presentation): translate fields --- app/models/procedure_presentation.rb | 55 +++++++++++-------- .../instructeurs/procedures/show.html.haml | 8 +-- .../models/procedure_presentation/en.yml | 32 +++++++++++ .../models/procedure_presentation/fr.yml | 32 +++++++++++ spec/models/procedure_presentation_spec.rb | 46 ++++++++-------- 5 files changed, 121 insertions(+), 52 deletions(-) create mode 100644 config/locales/models/procedure_presentation/en.yml create mode 100644 config/locales/models/procedure_presentation/fr.yml diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index c2edecc70..4b2459a25 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -37,43 +37,43 @@ class ProcedurePresentation < ApplicationRecord def fields fields = [ - field_hash('Créé le', 'self', 'created_at'), - field_hash('En construction le', 'self', 'en_construction_at'), - field_hash('Déposé le', 'self', 'depose_at'), - field_hash('Mis à jour le', 'self', 'updated_at'), - field_hash('Demandeur', 'user', 'email'), - field_hash('Email instructeur', 'followers_instructeurs', 'email'), - field_hash('Groupe instructeur', 'groupe_instructeur', 'label') + field_hash('self', 'created_at'), + field_hash('self', 'en_construction_at'), + field_hash('self', 'depose_at'), + field_hash('self', 'updated_at'), + field_hash('user', 'email'), + field_hash('followers_instructeurs', 'email'), + field_hash('groupe_instructeur', 'label') ] if procedure.for_individual fields.push( - field_hash("Prénom", "individual", "prenom"), - field_hash("Nom", "individual", "nom"), - field_hash("Civilité", "individual", "gender") + field_hash("individual", "prenom"), + field_hash("individual", "nom"), + field_hash("individual", "gender") ) end if !procedure.for_individual fields.push( - field_hash('SIREN', 'etablissement', 'entreprise_siren'), - field_hash('Forme juridique', 'etablissement', 'entreprise_forme_juridique'), - field_hash('Nom commercial', 'etablissement', 'entreprise_nom_commercial'), - field_hash('Raison sociale', 'etablissement', 'entreprise_raison_sociale'), - field_hash('SIRET siège social', 'etablissement', 'entreprise_siret_siege_social'), - field_hash('Date de création', 'etablissement', 'entreprise_date_creation') + field_hash('etablissement', 'entreprise_siren'), + field_hash('etablissement', 'entreprise_forme_juridique'), + field_hash('etablissement', 'entreprise_nom_commercial'), + field_hash('etablissement', 'entreprise_raison_sociale'), + field_hash('etablissement', 'entreprise_siret_siege_social'), + field_hash('etablissement', 'entreprise_date_creation') ) fields.push( - field_hash('SIRET', 'etablissement', 'siret'), - field_hash('Libellé NAF', 'etablissement', 'libelle_naf'), - field_hash('Code postal', 'etablissement', 'code_postal') + field_hash('etablissement', 'siret'), + field_hash('etablissement', 'libelle_naf'), + field_hash('etablissement', 'code_postal') ) end fields.concat procedure.types_de_champ_for_procedure_presentation .pluck(:libelle, :private, :stable_id) - .map { |(libelle, is_private, stable_id)| field_hash(libelle, is_private ? TYPE_DE_CHAMP_PRIVATE : TYPE_DE_CHAMP, stable_id.to_s) } + .map { |(libelle, is_private, stable_id)| field_hash(is_private ? TYPE_DE_CHAMP_PRIVATE : TYPE_DE_CHAMP, stable_id.to_s, label: libelle) } fields end @@ -85,6 +85,14 @@ class ProcedurePresentation < ApplicationRecord ] end + def displayed_fields_for_headers + [ + *displayed_fields, + field_hash('self', 'id', classname: 'number-col'), + field_hash('self', 'state', classname: 'state-col') + ] + end + def sorted_ids(dossiers, count) table, column, order = sort.values_at(TABLE, COLUMN, 'order') @@ -323,11 +331,12 @@ class ProcedurePresentation < ApplicationRecord end end - def field_hash(label, table, column) + def field_hash(table, column, label: nil, classname: '') { - 'label' => label, + 'label' => label || I18n.t(column, scope: [:activerecord, :attributes, :procedure_presentation, :fields, table]), TABLE => table, - COLUMN => column + COLUMN => column, + 'classname' => classname } end diff --git a/app/views/instructeurs/procedures/show.html.haml b/app/views/instructeurs/procedures/show.html.haml index 679ba09ee..d125dc3c3 100644 --- a/app/views/instructeurs/procedures/show.html.haml +++ b/app/views/instructeurs/procedures/show.html.haml @@ -75,12 +75,8 @@ - else %th.notification-col - = render partial: "header_field", locals: { field: { "label" => "Nº dossier", "table" => "self", "column" => "id" }, classname: "number-col" } - - - @procedure_presentation.displayed_fields.each do |field| - = render partial: "header_field", locals: { field: field, classname: "" } - - = render partial: "header_field", locals: { field: { "label" => "Statut", "table" => "self", "column" => "state" }, classname: "status-col" } + - @procedure_presentation.displayed_fields_for_headers.each do |field| + = render partial: "header_field", locals: { field: field, classname: field['classname'] } %th.action-col.follow-col %span.dropdown diff --git a/config/locales/models/procedure_presentation/en.yml b/config/locales/models/procedure_presentation/en.yml new file mode 100644 index 000000000..76f83d31e --- /dev/null +++ b/config/locales/models/procedure_presentation/en.yml @@ -0,0 +1,32 @@ +fr: + activerecord: + attributes: + procedure_presentation: + fields: + self: + id: File Nº + state: State + created_at: Created on + en_construction_at: En construction le + depose_at: Submitted on + updated_at: Updated on + user: + email: Requester + followers_instructeurs: + email: Email instructeur + groupe_instructeur: + label: Team + individual: + prenom: First name + nom: Last name + gender: Title + etablissement: + entreprise_siren: SIREN + entreprise_forme_juridique: Forme juridique + entreprise_nom_commercial: Commercial name + entreprise_raison_sociale: Raison sociale + entreprise_siret_siege_social: SIRET siège social + entreprise_date_creation: Creation date + siret: SIRET + libelle_naf: Libellé NAF + code_postal: Postal code diff --git a/config/locales/models/procedure_presentation/fr.yml b/config/locales/models/procedure_presentation/fr.yml new file mode 100644 index 000000000..6fe01d80c --- /dev/null +++ b/config/locales/models/procedure_presentation/fr.yml @@ -0,0 +1,32 @@ +fr: + activerecord: + attributes: + procedure_presentation: + fields: + self: + id: Nº dossier + state: Statut + created_at: Créé le + en_construction_at: En construction le + depose_at: Déposé le + updated_at: Mis à jour le + user: + email: Demandeur + followers_instructeurs: + email: Email instructeur + groupe_instructeur: + label: Groupe instructeur + individual: + prenom: Prénom + nom: Nom + gender: Civilité + etablissement: + entreprise_siren: SIREN + entreprise_forme_juridique: Forme juridique + entreprise_nom_commercial: Nom commercial + entreprise_raison_sociale: Raison sociale + entreprise_siret_siege_social: SIRET siège social + entreprise_date_creation: Date de création + siret: SIRET + libelle_naf: Libellé NAF + code_postal: Code postal diff --git a/spec/models/procedure_presentation_spec.rb b/spec/models/procedure_presentation_spec.rb index eaa5395e3..63aa24bab 100644 --- a/spec/models/procedure_presentation_spec.rb +++ b/spec/models/procedure_presentation_spec.rb @@ -58,26 +58,26 @@ describe ProcedurePresentation do let(:tdc_private_2) { procedure.types_de_champ_private[1] } let(:expected) { [ - { "label" => 'Créé le', "table" => 'self', "column" => 'created_at' }, - { "label" => 'En construction le', "table" => 'self', "column" => 'en_construction_at' }, - { "label" => 'Déposé le', "table" => 'self', "column" => 'depose_at' }, - { "label" => 'Mis à jour le', "table" => 'self', "column" => 'updated_at' }, - { "label" => 'Demandeur', "table" => 'user', "column" => 'email' }, - { "label" => 'Email instructeur', "table" => 'followers_instructeurs', "column" => 'email' }, - { "label" => 'Groupe instructeur', "table" => 'groupe_instructeur', "column" => 'label' }, - { "label" => 'SIREN', "table" => 'etablissement', "column" => 'entreprise_siren' }, - { "label" => 'Forme juridique', "table" => 'etablissement', "column" => 'entreprise_forme_juridique' }, - { "label" => 'Nom commercial', "table" => 'etablissement', "column" => 'entreprise_nom_commercial' }, - { "label" => 'Raison sociale', "table" => 'etablissement', "column" => 'entreprise_raison_sociale' }, - { "label" => 'SIRET siège social', "table" => 'etablissement', "column" => 'entreprise_siret_siege_social' }, - { "label" => 'Date de création', "table" => 'etablissement', "column" => 'entreprise_date_creation' }, - { "label" => 'SIRET', "table" => 'etablissement', "column" => 'siret' }, - { "label" => 'Libellé NAF', "table" => 'etablissement', "column" => 'libelle_naf' }, - { "label" => 'Code postal', "table" => 'etablissement', "column" => 'code_postal' }, - { "label" => tdc_1.libelle, "table" => 'type_de_champ', "column" => tdc_1.stable_id.to_s }, - { "label" => tdc_2.libelle, "table" => 'type_de_champ', "column" => tdc_2.stable_id.to_s }, - { "label" => tdc_private_1.libelle, "table" => 'type_de_champ_private', "column" => tdc_private_1.stable_id.to_s }, - { "label" => tdc_private_2.libelle, "table" => 'type_de_champ_private', "column" => tdc_private_2.stable_id.to_s } + { "label" => 'Créé le', "table" => 'self', "column" => 'created_at', 'classname' => '' }, + { "label" => 'En construction le', "table" => 'self', "column" => 'en_construction_at', 'classname' => '' }, + { "label" => 'Déposé le', "table" => 'self', "column" => 'depose_at', 'classname' => '' }, + { "label" => 'Mis à jour le', "table" => 'self', "column" => 'updated_at', 'classname' => '' }, + { "label" => 'Demandeur', "table" => 'user', "column" => 'email', 'classname' => '' }, + { "label" => 'Email instructeur', "table" => 'followers_instructeurs', "column" => 'email', 'classname' => '' }, + { "label" => 'Groupe instructeur', "table" => 'groupe_instructeur', "column" => 'label', 'classname' => '' }, + { "label" => 'SIREN', "table" => 'etablissement', "column" => 'entreprise_siren', 'classname' => '' }, + { "label" => 'Forme juridique', "table" => 'etablissement', "column" => 'entreprise_forme_juridique', 'classname' => '' }, + { "label" => 'Nom commercial', "table" => 'etablissement', "column" => 'entreprise_nom_commercial', 'classname' => '' }, + { "label" => 'Raison sociale', "table" => 'etablissement', "column" => 'entreprise_raison_sociale', 'classname' => '' }, + { "label" => 'SIRET siège social', "table" => 'etablissement', "column" => 'entreprise_siret_siege_social', 'classname' => '' }, + { "label" => 'Date de création', "table" => 'etablissement', "column" => 'entreprise_date_creation', 'classname' => '' }, + { "label" => 'SIRET', "table" => 'etablissement', "column" => 'siret', 'classname' => '' }, + { "label" => 'Libellé NAF', "table" => 'etablissement', "column" => 'libelle_naf', 'classname' => '' }, + { "label" => 'Code postal', "table" => 'etablissement', "column" => 'code_postal', 'classname' => '' }, + { "label" => tdc_1.libelle, "table" => 'type_de_champ', "column" => tdc_1.stable_id.to_s, 'classname' => '' }, + { "label" => tdc_2.libelle, "table" => 'type_de_champ', "column" => tdc_2.stable_id.to_s, 'classname' => '' }, + { "label" => tdc_private_1.libelle, "table" => 'type_de_champ_private', "column" => tdc_private_1.stable_id.to_s, 'classname' => '' }, + { "label" => tdc_private_2.libelle, "table" => 'type_de_champ_private', "column" => tdc_private_2.stable_id.to_s, 'classname' => '' } ] } @@ -94,9 +94,9 @@ describe ProcedurePresentation do end context 'when the procedure is for individuals' do - let(:name_field) { { "label" => "Prénom", "table" => "individual", "column" => "prenom" } } - let(:surname_field) { { "label" => "Nom", "table" => "individual", "column" => "nom" } } - let(:gender_field) { { "label" => "Civilité", "table" => "individual", "column" => "gender" } } + let(:name_field) { { "label" => "Prénom", "table" => "individual", "column" => "prenom", 'classname' => '' } } + let(:surname_field) { { "label" => "Nom", "table" => "individual", "column" => "nom", 'classname' => '' } } + let(:gender_field) { { "label" => "Civilité", "table" => "individual", "column" => "gender", 'classname' => '' } } let(:procedure) { create(:procedure, :for_individual) } let(:procedure_presentation) { create(:procedure_presentation, assign_to: assign_to) } From c671f25d34f955b6cec6ecf1ee3e420c944fd343 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 14 Apr 2022 11:08:17 +0200 Subject: [PATCH 5/5] fix(dossier): do not show unwanted closed procedure banners --- app/models/dossier.rb | 4 ++++ app/views/shared/dossiers/_header.html.haml | 6 ++--- .../users/dossiers/show/_header.html.haml | 7 +++--- .../shared/dossiers/_header.html.haml.spec.rb | 23 ++++++++++++++++++- .../dossiers/show/_header.html.haml_spec.rb | 23 ++++++++++++++++++- 5 files changed, 54 insertions(+), 9 deletions(-) diff --git a/app/models/dossier.rb b/app/models/dossier.rb index e32aa99db..08b59df06 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -631,6 +631,10 @@ class Dossier < ApplicationRecord termine_close_to_expiration_notice_sent_at: nil) end + def show_procedure_state_warning? + procedure.discarded? || (brouillon? && !procedure.dossier_can_transition_to_en_construction?) + end + def show_groupe_instructeur_details? procedure.routee? && groupe_instructeur.present? && (!procedure.feature_enabled?(:procedure_routage_api) || !defaut_groupe_instructeur?) end diff --git a/app/views/shared/dossiers/_header.html.haml b/app/views/shared/dossiers/_header.html.haml index ce1a700dc..b235930e3 100644 --- a/app/views/shared/dossiers/_header.html.haml +++ b/app/views/shared/dossiers/_header.html.haml @@ -8,8 +8,8 @@ = render(partial: 'users/dossiers/expiration_banner', locals: {dossier: dossier}) - - if current_user.owns?(dossier) && !dossier.procedure.discarded? && !dossier.procedure.close? + - if dossier.show_procedure_state_warning? + = render(partial: 'users/dossiers/procedure_removed_banner', locals: { dossier: dossier }) + - elsif current_user.owns?(dossier) .header-actions = render partial: 'invites/dropdown', locals: { dossier: dossier } - - else - = render(partial: 'users/dossiers/procedure_removed_banner', locals: { dossier: dossier }) diff --git a/app/views/users/dossiers/show/_header.html.haml b/app/views/users/dossiers/show/_header.html.haml index 19b2b0e39..e515a25cd 100644 --- a/app/views/users/dossiers/show/_header.html.haml +++ b/app/views/users/dossiers/show/_header.html.haml @@ -12,16 +12,15 @@ = render(partial: 'users/dossiers/expiration_banner', locals: {dossier: dossier}) - - if (current_user.owns?(dossier) && !dossier.procedure.discarded?) || (!dossier.procedure.discarded? && !dossier.procedure.close? && !dossier.en_construction?) + - if dossier.show_procedure_state_warning? + = render(partial: 'users/dossiers/procedure_removed_banner', locals: { dossier: dossier }) + - elsif current_user.owns?(dossier) .header-actions = render partial: 'invites/dropdown', locals: { dossier: dossier } - if dossier.can_be_updated_by_user? && !current_page?(modifier_dossier_path(dossier)) = link_to t('views.users.dossiers.show.header.edit_dossier'), modifier_dossier_path(dossier), class: 'button accepted edit-form', 'title'=> "Vous pouvez modifier votre dossier tant qu'il n'est passé en instruction" = render(partial: 'users/dossiers/show/print_dossier', locals: { dossier: dossier }) - - else - = render(partial: 'users/dossiers/procedure_removed_banner', locals: { dossier: dossier }) - %nav.tabs %ul = dynamic_tab_item(t('views.users.dossiers.show.header.summary'), dossier_path(dossier)) diff --git a/spec/views/shared/dossiers/_header.html.haml.spec.rb b/spec/views/shared/dossiers/_header.html.haml.spec.rb index 648fdb365..402b4edb1 100644 --- a/spec/views/shared/dossiers/_header.html.haml.spec.rb +++ b/spec/views/shared/dossiers/_header.html.haml.spec.rb @@ -1,9 +1,10 @@ describe 'dossiers/show/header.html.haml', type: :view do let(:procedure) { create(:procedure, :discarded) } let(:dossier) { create(:dossier, state: "brouillon", procedure: procedure) } + let(:user) { dossier.user } before do - sign_in dossier.user + sign_in user end subject! { render 'shared/dossiers/header.html.haml', dossier: dossier } @@ -31,4 +32,24 @@ describe 'dossiers/show/header.html.haml', type: :view do expect(rendered).not_to have_text("Tout le dossier") end end + + context "when user is invited" do + context "when the procedure is closed with a dossier en construction" do + let(:procedure) { create(:procedure, :closed) } + let(:dossier) { create(:dossier, :en_construction, procedure: procedure) } + let(:user) { create(:user) } + + before do + create(:invite, user: user, dossier: dossier) + end + + it "n'affiche pas de banner" do + expect(rendered).not_to have_text("La démarche liée à votre dossier est close") + end + + it 'can not download the dossier' do + expect(rendered).not_to have_text("Tout le dossier") + end + end + end end 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 660a09a3c..4be3a6af1 100644 --- a/spec/views/users/dossiers/show/_header.html.haml_spec.rb +++ b/spec/views/users/dossiers/show/_header.html.haml_spec.rb @@ -1,8 +1,9 @@ describe 'users/dossiers/show/header.html.haml', type: :view do let(:dossier) { create(:dossier, :en_construction, procedure: create(:procedure)) } + let(:user) { dossier.user } before do - sign_in dossier.user + sign_in user end subject! { render 'users/dossiers/show/header.html.haml', dossier: dossier } @@ -57,4 +58,24 @@ describe 'users/dossiers/show/header.html.haml', type: :view do expect(rendered).to have_text("Tout le dossier") end end + + context "when user is invited" do + context "when the procedure is closed with a dossier en construction" do + let(:procedure) { create(:procedure, :closed) } + let(:dossier) { create(:dossier, :en_construction, procedure: procedure) } + let(:user) { create(:user) } + + before do + create(:invite, user: user, dossier: dossier) + end + + it "n'affiche pas de banner" do + expect(rendered).not_to have_text("La démarche liée à votre dossier est close") + end + + it 'can not download the dossier' do + expect(rendered).not_to have_text("Tout le dossier") + end + end + end end