From 1b21fcab4dc8bb7986c392f1f9dee003494937e3 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 1 Dec 2017 15:03:19 +0100 Subject: [PATCH] =?UTF-8?q?[Fix=20#963]=20Add=20a=20"personnes=20impliqu?= =?UTF-8?q?=C3=A9es"=20tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stylesheets/new_design/personnes_impliquees.scss | 8 ++++++++ .../new_gestionnaire/dossiers_controller.rb | 6 ++++++ app/views/new_gestionnaire/dossiers/_header.html.haml | 2 ++ .../dossiers/_personnes_impliquees_block.html.haml | 9 +++++++++ .../dossiers/personnes_impliquees.html.haml | 10 ++++++++++ config/routes.rb | 1 + 6 files changed, 36 insertions(+) create mode 100644 app/assets/stylesheets/new_design/personnes_impliquees.scss create mode 100644 app/views/new_gestionnaire/dossiers/_personnes_impliquees_block.html.haml create mode 100644 app/views/new_gestionnaire/dossiers/personnes_impliquees.html.haml diff --git a/app/assets/stylesheets/new_design/personnes_impliquees.scss b/app/assets/stylesheets/new_design/personnes_impliquees.scss new file mode 100644 index 00000000000..80c2274950e --- /dev/null +++ b/app/assets/stylesheets/new_design/personnes_impliquees.scss @@ -0,0 +1,8 @@ +.personnes-impliquees { + padding-bottom: 50px; + + ul { + list-style-type: disc; + margin-left: 16px; + } +} diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/new_gestionnaire/dossiers_controller.rb index a3c35a178c9..937b0797114 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -28,6 +28,12 @@ def avis current_gestionnaire.mark_tab_as_seen(dossier, :avis) end + def personnes_impliquees + @following_accompagnateurs_emails = dossier.followers_gestionnaires.pluck(:email) + @avis_emails = dossier.avis.includes(:gestionnaire).map(&:email_to_display) + @invites_emails = dossier.invites.map(&:email) + end + def follow current_gestionnaire.follow(dossier) dossier.next_step!('gestionnaire', 'follow') diff --git a/app/views/new_gestionnaire/dossiers/_header.html.haml b/app/views/new_gestionnaire/dossiers/_header.html.haml index 852e4cf6209..e6c51f920b2 100644 --- a/app/views/new_gestionnaire/dossiers/_header.html.haml +++ b/app/views/new_gestionnaire/dossiers/_header.html.haml @@ -35,6 +35,8 @@ - if notifications_summary[:messagerie] %span.notifications{ 'aria-label': 'notifications' } = link_to "Messagerie", messagerie_dossier_path(dossier.procedure, dossier) + %li{ class: current_page?(personnes_impliquees_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } + = link_to "Personnes impliquées", personnes_impliquees_dossier_path(dossier.procedure, dossier) .container .print-header diff --git a/app/views/new_gestionnaire/dossiers/_personnes_impliquees_block.html.haml b/app/views/new_gestionnaire/dossiers/_personnes_impliquees_block.html.haml new file mode 100644 index 00000000000..82165f283ea --- /dev/null +++ b/app/views/new_gestionnaire/dossiers/_personnes_impliquees_block.html.haml @@ -0,0 +1,9 @@ +.accompagnateur-title= title + +- if emails_collection.present? + %ul + - emails_collection.each do |email| + %li + = email +- else + = blank diff --git a/app/views/new_gestionnaire/dossiers/personnes_impliquees.html.haml b/app/views/new_gestionnaire/dossiers/personnes_impliquees.html.haml new file mode 100644 index 00000000000..857c99692de --- /dev/null +++ b/app/views/new_gestionnaire/dossiers/personnes_impliquees.html.haml @@ -0,0 +1,10 @@ +- content_for(:title, "Personnes impliquées · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") + += render partial: "header", locals: { dossier: @dossier } + +.personnes-impliquees.container + = render partial: 'new_gestionnaire/dossiers/personnes_impliquees_block', locals: { emails_collection: @following_accompagnateurs_emails, title: "Accompagnateurs qui suivent le dossier", blank: "Aucun accompagnateur ne suit ce dossier" } + + = render partial: 'new_gestionnaire/dossiers/personnes_impliquees_block', locals: { emails_collection: @avis_emails, title: "Personnes à qui un avis a été demandé", blank: "Aucun avis n'a été demandé" } + + = render partial: 'new_gestionnaire/dossiers/personnes_impliquees_block', locals: { emails_collection: @invites_emails, title: "Personnes invitées à consulter ce dossier", blank: "Aucune personne n'a été invitée à consulter ce dossier" } diff --git a/config/routes.rb b/config/routes.rb index 3f83c1b52cf..d43c5b46991 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -248,6 +248,7 @@ get 'messagerie' get 'annotations-privees' => 'dossiers#annotations_privees' get 'avis' + get 'personnes-impliquees' => 'dossiers#personnes_impliquees' patch 'follow' patch 'unfollow' patch 'archive'