From d75a3872d1c4f516fce26dc0db5837d5ca0ea1c6 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 --- .../new_design/personnes_impliquees.scss | 8 +++++++ .../new_gestionnaire/dossiers_controller.rb | 6 +++++ .../dossiers/_header.html.haml | 2 ++ .../_personnes_impliquees_block.html.haml | 9 ++++++++ .../dossiers/personnes_impliquees.html.haml | 10 ++++++++ config/routes.rb | 1 + .../new_gestionnaire/gestionnaire_spec.rb | 23 +++++++++++++++++++ 7 files changed, 59 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 000000000..80c227495 --- /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 a3c35a178..937b07971 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -28,6 +28,12 @@ module NewGestionnaire 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 852e4cf62..e6c51f920 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 000000000..82165f283 --- /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 000000000..857c99692 --- /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 3f83c1b52..d43c5b469 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -248,6 +248,7 @@ Rails.application.routes.draw do get 'messagerie' get 'annotations-privees' => 'dossiers#annotations_privees' get 'avis' + get 'personnes-impliquees' => 'dossiers#personnes_impliquees' patch 'follow' patch 'unfollow' patch 'archive' diff --git a/spec/features/new_gestionnaire/gestionnaire_spec.rb b/spec/features/new_gestionnaire/gestionnaire_spec.rb index 85fe6bda5..15acf9e38 100644 --- a/spec/features/new_gestionnaire/gestionnaire_spec.rb +++ b/spec/features/new_gestionnaire/gestionnaire_spec.rb @@ -112,6 +112,29 @@ feature 'The gestionnaire part' do expect(page).to have_text('a great answer') end + scenario 'A gestionnaire can see the personnes impliquées' do + gestionnaire2 = FactoryGirl.create(:gestionnaire, password: password) + + log_in(gestionnaire.email, password) + + click_on 'nouvelle interface' + click_on procedure.libelle + click_on dossier.user.email + + click_on 'Avis externes' + expect(page).to have_current_path(avis_dossier_path(procedure, dossier)) + + expert_email = 'expert@tps.com' + ask_confidential_avis(expert_email, 'a good introduction') + + expert_email = gestionnaire2.email + ask_confidential_avis(expert_email, 'a good introduction') + + click_on 'Personnes impliquées' + expect(page).to have_text(expert_email) + expect(page).to have_text(gestionnaire2.email) + end + def log_in(email, password) visit '/' click_on 'Connexion'