From 603d66e020dd8815eaf77cdb195e84194a1497fb Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Fri, 10 Mar 2023 18:39:26 +0100 Subject: [PATCH 1/8] split form and avis answers in 2 views for instructeurs --- app/controllers/instructeurs/dossiers_controller.rb | 8 ++++++++ .../instructeurs/dossiers/_header_bottom.html.haml | 3 ++- app/views/instructeurs/dossiers/avis.html.haml | 5 ++++- app/views/instructeurs/dossiers/avis_new.html.haml | 12 ++++++++++++ config/routes.rb | 1 + 5 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 app/views/instructeurs/dossiers/avis_new.html.haml diff --git a/app/controllers/instructeurs/dossiers_controller.rb b/app/controllers/instructeurs/dossiers_controller.rb index f49532472..51c09e05b 100644 --- a/app/controllers/instructeurs/dossiers_controller.rb +++ b/app/controllers/instructeurs/dossiers_controller.rb @@ -76,6 +76,14 @@ module Instructeurs end end + def avis_new + @avis_seen_at = current_instructeur.follows.find_by(dossier: dossier)&.avis_seen_at + @avis = Avis.new + if @dossier.procedure.experts_require_administrateur_invitation? + @experts_emails = dossier.procedure.experts_procedures.where(revoked_at: nil).map(&:expert).map(&:email).sort + end + end + def personnes_impliquees @following_instructeurs_emails = dossier.followers_instructeurs.map(&:email) previous_followers = dossier.previous_followers_instructeurs - dossier.followers_instructeurs diff --git a/app/views/instructeurs/dossiers/_header_bottom.html.haml b/app/views/instructeurs/dossiers/_header_bottom.html.haml index 5b1493cef..793ae4c8f 100644 --- a/app/views/instructeurs/dossiers/_header_bottom.html.haml +++ b/app/views/instructeurs/dossiers/_header_bottom.html.haml @@ -12,7 +12,8 @@ notification: notifications_summary[:annotations_privees]) = dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.external_opinion'), - avis_instructeur_dossier_path(dossier.procedure, dossier), + [avis_instructeur_dossier_path(dossier.procedure, dossier), + avis_new_instructeur_dossier_path(dossier.procedure, dossier)], notification: notifications_summary[:avis]) = dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.messaging'), diff --git a/app/views/instructeurs/dossiers/avis.html.haml b/app/views/instructeurs/dossiers/avis.html.haml index c02565ff2..39879988f 100644 --- a/app/views/instructeurs/dossiers/avis.html.haml +++ b/app/views/instructeurs/dossiers/avis.html.haml @@ -5,7 +5,10 @@ .container - if !@dossier.termine? - if @dossier.procedure.allow_expert_review - = render partial: "instructeurs/avis/shared/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis } + - if @dossier.avis.present? + = link_to 'demander un nouvel avis', avis_new_instructeur_dossier_path(@dossier.procedure, @dossier), class: 'fr-btn fr-btn--sm pull-right' + - else + = render partial: "instructeurs/avis/shared/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis } - else %p Cette démarche n’autorise pas la demande d’avis à un expert. Veuillez contacter votre administrateur diff --git a/app/views/instructeurs/dossiers/avis_new.html.haml b/app/views/instructeurs/dossiers/avis_new.html.haml new file mode 100644 index 000000000..446b8286c --- /dev/null +++ b/app/views/instructeurs/dossiers/avis_new.html.haml @@ -0,0 +1,12 @@ +- content_for(:title, "Avis · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") + += render partial: "header", locals: { dossier: @dossier } + +.container + - if !@dossier.termine? + - if @dossier.procedure.allow_expert_review + - if @dossier.avis.present? + = link_to '< retour aux avis', avis_instructeur_dossier_path(@dossier.procedure, @dossier), class: 'fr-link' + = render partial: "instructeurs/avis/shared/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis } + - else + %p Cette démarche n’autorise pas la demande d’avis à un expert. Veuillez contacter votre administrateur diff --git a/config/routes.rb b/config/routes.rb index ff4055da3..eccf61e3f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -424,6 +424,7 @@ Rails.application.routes.draw do get 'messagerie' get 'annotations-privees' => 'dossiers#annotations_privees' get 'avis' + get 'avis_new' get 'personnes-impliquees' => 'dossiers#personnes_impliquees' patch 'follow' patch 'unfollow' From c51e6aa2e6ebd7a3667b37bb20afe76be340f19c Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Tue, 14 Mar 2023 16:50:25 +0100 Subject: [PATCH 2/8] split form and avis answers in 2 views for experts and add sidemenu --- app/controllers/experts/avis_controller.rb | 5 +- app/javascript/entrypoints/main.css | 1 + app/views/experts/avis/_header.html.haml | 2 +- app/views/experts/avis/_sidemenu.html.haml | 17 ++++ app/views/experts/avis/avis_list.html.haml | 11 +++ app/views/experts/avis/instruction.html.haml | 88 ++++++++++---------- config/routes.rb | 1 + 7 files changed, 81 insertions(+), 44 deletions(-) create mode 100644 app/views/experts/avis/_sidemenu.html.haml create mode 100644 app/views/experts/avis/avis_list.html.haml diff --git a/app/controllers/experts/avis_controller.rb b/app/controllers/experts/avis_controller.rb index 13bc62d3f..117af4c94 100644 --- a/app/controllers/experts/avis_controller.rb +++ b/app/controllers/experts/avis_controller.rb @@ -6,7 +6,7 @@ module Experts before_action :authenticate_expert!, except: [:sign_up, :update_expert] before_action :check_if_avis_revoked, except: [:index, :procedure] before_action :redirect_if_no_sign_up_needed, only: [:sign_up, :update_expert] - before_action :set_avis_and_dossier, only: [:show, :instruction, :messagerie, :create_commentaire, :delete_commentaire, :update, :telecharger_pjs] + before_action :set_avis_and_dossier, only: [:show, :instruction, :avis_list, :messagerie, :create_commentaire, :delete_commentaire, :update, :telecharger_pjs] A_DONNER_STATUS = 'a-donner' DONNES_STATUS = 'donnes' @@ -56,6 +56,9 @@ module Experts @new_avis = Avis.new end + def avis_list + end + def create_avis @procedure = Procedure.find(params[:procedure_id]) @new_avis = create_avis_from_params(avis.dossier, current_expert, avis.confidentiel) diff --git a/app/javascript/entrypoints/main.css b/app/javascript/entrypoints/main.css index 2e4478c31..a78396681 100644 --- a/app/javascript/entrypoints/main.css +++ b/app/javascript/entrypoints/main.css @@ -30,6 +30,7 @@ @import '@gouvfr/dsfr/dist/component/header/header.css'; @import '@gouvfr/dsfr/dist/component/footer/footer.css'; @import '@gouvfr/dsfr/dist/component/search/search.css'; +@import '@gouvfr/dsfr/dist/component/sidemenu/sidemenu.css'; @import '@gouvfr/dsfr/dist/component/translate/translate.css'; @import '@gouvfr/dsfr/dist/component/pagination/pagination.css'; @import '@gouvfr/dsfr/dist/component/skiplink/skiplink.css'; diff --git a/app/views/experts/avis/_header.html.haml b/app/views/experts/avis/_header.html.haml index 24312fd9f..defdbb19e 100644 --- a/app/views/experts/avis/_header.html.haml +++ b/app/views/experts/avis/_header.html.haml @@ -18,5 +18,5 @@ %nav.tabs %ul = dynamic_tab_item('Demande', expert_avis_path(avis.procedure, avis)) - = dynamic_tab_item('Avis', instruction_expert_avis_path(avis.procedure, avis), notification: avis.answer.blank?) + = dynamic_tab_item('Avis', [instruction_expert_avis_path(avis.procedure, avis), avis_list_expert_avis_path(avis.procedure, avis)], notification: avis.answer.blank?) = dynamic_tab_item('Messagerie', messagerie_expert_avis_path(avis.procedure, avis)) diff --git a/app/views/experts/avis/_sidemenu.html.haml b/app/views/experts/avis/_sidemenu.html.haml new file mode 100644 index 000000000..2ca62d024 --- /dev/null +++ b/app/views/experts/avis/_sidemenu.html.haml @@ -0,0 +1,17 @@ +%nav.fr-sidemenu{"aria-labelledby" => "fr-sidemenu-title"} + .fr-sidemenu__inner + %button.fr-sidemenu__btn{"aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: ""} Dans cette rubrique + #fr-sidemenu-wrapper.fr-collapse + %ul.fr-sidemenu__list + - current_page = current_page?(instruction_expert_avis_path(@avis.procedure, @avis)) + %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} + %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil, href: instruction_expert_avis_path(@avis.procedure, @avis), target: "_self"} Donner votre avis + + - current_page = current_page?(avis_list_expert_avis_path(@avis.procedure, @avis)) + - if @dossier.avis_for_expert(current_expert).present? + %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} + %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: avis_list_expert_avis_path(@avis.procedure, @avis), target: "_self"} Voir les avis + + -# - if !@dossier.termine? + -# %li.fr-sidemenu__item + -# %a.fr-sidemenu__link{href: "#", target: "_self"} Demander un nouvel avis diff --git a/app/views/experts/avis/avis_list.html.haml b/app/views/experts/avis/avis_list.html.haml new file mode 100644 index 000000000..0479010fe --- /dev/null +++ b/app/views/experts/avis/avis_list.html.haml @@ -0,0 +1,11 @@ +- content_for(:title, "Avis · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") + += render partial: 'header', locals: { avis: @avis, dossier: @dossier } + +.container + .fr-grid-row + .fr-col.fr-col-12.fr-col-md-3 + = render partial: 'sidemenu' + .fr-col + - if @dossier.avis_for_expert(current_expert).present? + = render partial: 'experts/avis/shared/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil } diff --git a/app/views/experts/avis/instruction.html.haml b/app/views/experts/avis/instruction.html.haml index fb6577350..6fbe1251d 100644 --- a/app/views/experts/avis/instruction.html.haml +++ b/app/views/experts/avis/instruction.html.haml @@ -3,55 +3,59 @@ = render partial: 'header', locals: { avis: @avis, dossier: @dossier } .container - %section.give-avis - %h1.tab-title Donner votre avis - %h2.claimant - Demandeur : - %span.email.font-weight-normal= safe_claimant_email(@avis.claimant) - %span.date.font-weight-normal Demande d’avis envoyée le #{l(@avis.created_at, format: '%d/%m/%y')} - %p.introduction= @avis.introduction + .fr-grid-row + .fr-col.fr-col-12.fr-col-md-3 + = render partial: 'sidemenu' + .fr-col + %section.give-avis + %h1.tab-title Donner votre avis + %h2.claimant + Demandeur : + %span.email.font-weight-normal= safe_claimant_email(@avis.claimant) + %span.date.font-weight-normal Demande d’avis envoyée le #{l(@avis.created_at, format: '%d/%m/%y')} + %p.introduction= @avis.introduction - - if @avis.introduction_file.attached? - = render Attachment::ShowComponent.new(attachment: @avis.introduction_file.attachment) - %br/ - = render Attachment::DeleteFormComponent.new - = form_for @avis, url: expert_avis_path(@avis.procedure, @avis), html: { data: { controller: 'persisted-form', persisted_form_key_value: dom_id(@avis) }, multipart: true } do |f| + - if @avis.introduction_file.attached? + = render Attachment::ShowComponent.new(attachment: @avis.introduction_file.attachment) + %br/ + = render Attachment::DeleteFormComponent.new + = form_for @avis, url: expert_avis_path(@avis.procedure, @avis), html: { data: { controller: 'persisted-form', persisted_form_key_value: dom_id(@avis) }, multipart: true } do |f| - - if @avis.question_label - .fr-form-group - %fieldset.fr-fieldset.fr-fieldset--inline - %legend#radio-inline-legend.fr-fieldset__legend.fr-text--regular - = @avis.question_label - .fr-fieldset__content - .fr-radio-group - = f.radio_button :question_answer, true - = f.label :question_answer, 'oui', value: true, class: 'fr-label' + - if @avis.question_label + .fr-form-group + %fieldset.fr-fieldset.fr-fieldset--inline + %legend#radio-inline-legend.fr-fieldset__legend.fr-text--regular + = @avis.question_label + .fr-fieldset__content + .fr-radio-group + = f.radio_button :question_answer, true + = f.label :question_answer, 'oui', value: true, class: 'fr-label' - .fr-radio-group - = f.radio_button :question_answer, false - = f.label :question_answer, 'non', value: false, class: 'fr-label' + .fr-radio-group + = f.radio_button :question_answer, false + = f.label :question_answer, 'non', value: false, class: 'fr-label' - .fr-select-group - = f.text_area :answer, rows: 3, class: 'fr-input', placeholder: 'Votre avis', required: true + .fr-select-group + = f.text_area :answer, rows: 3, class: 'fr-input', placeholder: 'Votre avis', required: true - = render Attachment::EditComponent.new(attached_file: @avis.piece_justificative_file, view_as: :download) + = render Attachment::EditComponent.new(attached_file: @avis.piece_justificative_file, view_as: :download) - .flex.justify-between.align-baseline - %p.confidentiel.flex - - if @avis.confidentiel? - %span.icon.lock - %span - Cet avis est confidentiel et n’est pas affiché aux autres experts consultés - - else - %span - Cet avis est partagé avec les autres experts - .send-wrapper - = f.submit 'Envoyer votre avis', class: 'fr-btn' + .flex.justify-between.align-baseline + %p.confidentiel.flex + - if @avis.confidentiel? + %span.icon.lock + %span + Cet avis est confidentiel et n’est pas affiché aux autres experts consultés + - else + %span + Cet avis est partagé avec les autres experts + .send-wrapper + = f.submit 'Envoyer votre avis', class: 'fr-btn' - - if !@dossier.termine? - = render partial: "experts/avis/shared/form", locals: { url: avis_expert_avis_path(@avis.procedure, @avis), linked_dossiers: @dossier.linked_dossiers_for(current_expert), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis } + -# - if !@dossier.termine? + -# = render partial: "experts/avis/shared/form", locals: { url: avis_expert_avis_path(@avis.procedure, @avis), linked_dossiers: @dossier.linked_dossiers_for(current_expert), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis } - - if @dossier.avis_for_expert(current_expert).present? - = render partial: 'experts/avis/shared/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil } + -# - if @dossier.avis_for_expert(current_expert).present? + -# = render partial: 'experts/avis/shared/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil } diff --git a/config/routes.rb b/config/routes.rb index eccf61e3f..bc176c289 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -355,6 +355,7 @@ Rails.application.routes.draw do get '', action: 'procedure', on: :collection, as: :procedure member do get 'instruction' + get 'avis_list' get 'messagerie' post 'commentaire' => 'avis#create_commentaire' post 'avis' => 'avis#create_avis' From 79552b496b4772785f7048520d40c4ddeaf49b52 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Thu, 16 Mar 2023 10:46:10 +0100 Subject: [PATCH 3/8] add 3rd view for expert - form to ask avis to another expert --- app/controllers/experts/avis_controller.rb | 6 +++++- app/views/experts/avis/_header.html.haml | 2 +- app/views/experts/avis/_sidemenu.html.haml | 9 +++++---- app/views/experts/avis/avis_new.html.haml | 11 +++++++++++ app/views/experts/avis/instruction.html.haml | 6 ------ config/routes.rb | 1 + 6 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 app/views/experts/avis/avis_new.html.haml diff --git a/app/controllers/experts/avis_controller.rb b/app/controllers/experts/avis_controller.rb index 117af4c94..2476eeeb4 100644 --- a/app/controllers/experts/avis_controller.rb +++ b/app/controllers/experts/avis_controller.rb @@ -6,7 +6,7 @@ module Experts before_action :authenticate_expert!, except: [:sign_up, :update_expert] before_action :check_if_avis_revoked, except: [:index, :procedure] before_action :redirect_if_no_sign_up_needed, only: [:sign_up, :update_expert] - before_action :set_avis_and_dossier, only: [:show, :instruction, :avis_list, :messagerie, :create_commentaire, :delete_commentaire, :update, :telecharger_pjs] + before_action :set_avis_and_dossier, only: [:show, :instruction, :avis_list, :avis_new, :messagerie, :create_commentaire, :delete_commentaire, :update, :telecharger_pjs] A_DONNER_STATUS = 'a-donner' DONNES_STATUS = 'donnes' @@ -59,6 +59,10 @@ module Experts def avis_list end + def avis_new + @new_avis = Avis.new + end + def create_avis @procedure = Procedure.find(params[:procedure_id]) @new_avis = create_avis_from_params(avis.dossier, current_expert, avis.confidentiel) diff --git a/app/views/experts/avis/_header.html.haml b/app/views/experts/avis/_header.html.haml index defdbb19e..fe88e32b2 100644 --- a/app/views/experts/avis/_header.html.haml +++ b/app/views/experts/avis/_header.html.haml @@ -18,5 +18,5 @@ %nav.tabs %ul = dynamic_tab_item('Demande', expert_avis_path(avis.procedure, avis)) - = dynamic_tab_item('Avis', [instruction_expert_avis_path(avis.procedure, avis), avis_list_expert_avis_path(avis.procedure, avis)], notification: avis.answer.blank?) + = dynamic_tab_item('Avis', [instruction_expert_avis_path(avis.procedure, avis), avis_list_expert_avis_path(avis.procedure, avis), avis_new_expert_avis_path(avis.procedure, avis)], notification: avis.answer.blank?) = dynamic_tab_item('Messagerie', messagerie_expert_avis_path(avis.procedure, avis)) diff --git a/app/views/experts/avis/_sidemenu.html.haml b/app/views/experts/avis/_sidemenu.html.haml index 2ca62d024..bb71ac11e 100644 --- a/app/views/experts/avis/_sidemenu.html.haml +++ b/app/views/experts/avis/_sidemenu.html.haml @@ -7,11 +7,12 @@ %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil, href: instruction_expert_avis_path(@avis.procedure, @avis), target: "_self"} Donner votre avis - - current_page = current_page?(avis_list_expert_avis_path(@avis.procedure, @avis)) - if @dossier.avis_for_expert(current_expert).present? + - current_page = current_page?(avis_list_expert_avis_path(@avis.procedure, @avis)) %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: avis_list_expert_avis_path(@avis.procedure, @avis), target: "_self"} Voir les avis - -# - if !@dossier.termine? - -# %li.fr-sidemenu__item - -# %a.fr-sidemenu__link{href: "#", target: "_self"} Demander un nouvel avis + - if !@dossier.termine? + - current_page = current_page?(avis_new_expert_avis_path(@avis.procedure, @avis)) + %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} + %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: avis_new_expert_avis_path(@avis.procedure, @avis), target: "_self"} Demander un nouvel avis diff --git a/app/views/experts/avis/avis_new.html.haml b/app/views/experts/avis/avis_new.html.haml new file mode 100644 index 000000000..d5e29041c --- /dev/null +++ b/app/views/experts/avis/avis_new.html.haml @@ -0,0 +1,11 @@ +- content_for(:title, "Avis · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") + += render partial: 'header', locals: { avis: @avis, dossier: @dossier } + +.container + .fr-grid-row + .fr-col.fr-col-12.fr-col-md-3 + = render partial: 'sidemenu' + .fr-col + - if !@dossier.termine? + = render partial: "experts/avis/shared/form", locals: { url: avis_expert_avis_path(@avis.procedure, @avis), linked_dossiers: @dossier.linked_dossiers_for(current_expert), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis } diff --git a/app/views/experts/avis/instruction.html.haml b/app/views/experts/avis/instruction.html.haml index 6fbe1251d..465d8441b 100644 --- a/app/views/experts/avis/instruction.html.haml +++ b/app/views/experts/avis/instruction.html.haml @@ -53,9 +53,3 @@ Cet avis est partagé avec les autres experts .send-wrapper = f.submit 'Envoyer votre avis', class: 'fr-btn' - - -# - if !@dossier.termine? - -# = render partial: "experts/avis/shared/form", locals: { url: avis_expert_avis_path(@avis.procedure, @avis), linked_dossiers: @dossier.linked_dossiers_for(current_expert), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis } - - -# - if @dossier.avis_for_expert(current_expert).present? - -# = render partial: 'experts/avis/shared/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil } diff --git a/config/routes.rb b/config/routes.rb index bc176c289..0dbed9948 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -356,6 +356,7 @@ Rails.application.routes.draw do member do get 'instruction' get 'avis_list' + get 'avis_new' get 'messagerie' post 'commentaire' => 'avis#create_commentaire' post 'avis' => 'avis#create_avis' From d21ff7a762a14c739c70965b192ee853fc226ae5 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Thu, 16 Mar 2023 15:26:40 +0100 Subject: [PATCH 4/8] add sidemenu for instructeurs instead of links at top of page --- app/views/experts/avis/_sidemenu.html.haml | 15 ++++++++----- .../instructeurs/avis/_sidemenu.html.haml | 14 ++++++++++++ .../instructeurs/dossiers/avis.html.haml | 22 +++++++------------ .../instructeurs/dossiers/avis_new.html.haml | 16 ++++++++------ 4 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 app/views/instructeurs/avis/_sidemenu.html.haml diff --git a/app/views/experts/avis/_sidemenu.html.haml b/app/views/experts/avis/_sidemenu.html.haml index bb71ac11e..88f8aa6d9 100644 --- a/app/views/experts/avis/_sidemenu.html.haml +++ b/app/views/experts/avis/_sidemenu.html.haml @@ -3,16 +3,19 @@ %button.fr-sidemenu__btn{"aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: ""} Dans cette rubrique #fr-sidemenu-wrapper.fr-collapse %ul.fr-sidemenu__list - - current_page = current_page?(instruction_expert_avis_path(@avis.procedure, @avis)) + - url = instruction_expert_avis_path(@avis.procedure, @avis) + - current_page = current_page?(url) %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} - %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil, href: instruction_expert_avis_path(@avis.procedure, @avis), target: "_self"} Donner votre avis + %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil, href: url, target: "_self"} Donner votre avis - if @dossier.avis_for_expert(current_expert).present? - - current_page = current_page?(avis_list_expert_avis_path(@avis.procedure, @avis)) + - url = avis_list_expert_avis_path(@avis.procedure, @avis) + - current_page = current_page?(url) %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} - %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: avis_list_expert_avis_path(@avis.procedure, @avis), target: "_self"} Voir les avis + %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: url, target: "_self"} Voir les avis - if !@dossier.termine? - - current_page = current_page?(avis_new_expert_avis_path(@avis.procedure, @avis)) + - url = avis_new_expert_avis_path(@avis.procedure, @avis) + - current_page = current_page?(url) %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} - %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: avis_new_expert_avis_path(@avis.procedure, @avis), target: "_self"} Demander un nouvel avis + %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: url, target: "_self"} Demander un nouvel avis diff --git a/app/views/instructeurs/avis/_sidemenu.html.haml b/app/views/instructeurs/avis/_sidemenu.html.haml new file mode 100644 index 000000000..8c73d86f2 --- /dev/null +++ b/app/views/instructeurs/avis/_sidemenu.html.haml @@ -0,0 +1,14 @@ +%nav.fr-sidemenu{"aria-labelledby" => "fr-sidemenu-title"} + .fr-sidemenu__inner + %button.fr-sidemenu__btn{"aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: ""} Dans cette rubrique + #fr-sidemenu-wrapper.fr-collapse + %ul.fr-sidemenu__list + - url = avis_new_instructeur_dossier_path(@dossier.procedure, @dossier) + - current_page = current_page?(url) + %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} + %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil, href: url, target: "_self"} Demander un avis + + - url = avis_instructeur_dossier_path(@dossier.procedure, @dossier) + - current_page = current_page?(url) + %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} + %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: url, target: "_self"} Voir les avis diff --git a/app/views/instructeurs/dossiers/avis.html.haml b/app/views/instructeurs/dossiers/avis.html.haml index 39879988f..7866eb782 100644 --- a/app/views/instructeurs/dossiers/avis.html.haml +++ b/app/views/instructeurs/dossiers/avis.html.haml @@ -3,19 +3,13 @@ = render partial: "header", locals: { dossier: @dossier } .container - - if !@dossier.termine? - - if @dossier.procedure.allow_expert_review + .fr-grid-row + .fr-col.fr-col-12.fr-col-md-3 + = render partial: 'instructeurs/avis/sidemenu' + .fr-col - if @dossier.avis.present? - = link_to 'demander un nouvel avis', avis_new_instructeur_dossier_path(@dossier.procedure, @dossier), class: 'fr-btn fr-btn--sm pull-right' - - else - = render partial: "instructeurs/avis/shared/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis } - - else - %p Cette démarche n’autorise pas la demande d’avis à un expert. Veuillez contacter votre administrateur + = render partial: 'instructeurs/avis/shared/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } - - if @dossier.avis.present? - = render partial: 'instructeurs/avis/shared/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } - - - if @dossier.termine? && !@dossier.avis.present? - .blank-tab - %h2.empty-text Aucun avis. - %p.empty-text-details Aucun avis n’a été demandé sur ce dossier. + -else + %h2.empty-text Aucun avis. + %p.empty-text-details Aucun avis n’a été demandé sur ce dossier. diff --git a/app/views/instructeurs/dossiers/avis_new.html.haml b/app/views/instructeurs/dossiers/avis_new.html.haml index 446b8286c..790793db0 100644 --- a/app/views/instructeurs/dossiers/avis_new.html.haml +++ b/app/views/instructeurs/dossiers/avis_new.html.haml @@ -3,10 +3,12 @@ = render partial: "header", locals: { dossier: @dossier } .container - - if !@dossier.termine? - - if @dossier.procedure.allow_expert_review - - if @dossier.avis.present? - = link_to '< retour aux avis', avis_instructeur_dossier_path(@dossier.procedure, @dossier), class: 'fr-link' - = render partial: "instructeurs/avis/shared/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis } - - else - %p Cette démarche n’autorise pas la demande d’avis à un expert. Veuillez contacter votre administrateur + .fr-grid-row + .fr-col.fr-col-12.fr-col-md-3 + = render partial: 'instructeurs/avis/sidemenu' + .fr-col + - if !@dossier.termine? + - if @dossier.procedure.allow_expert_review + = render partial: "instructeurs/avis/shared/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis } + - else + %p Cette démarche n’autorise pas la demande d’avis à un expert. Veuillez contacter votre administrateur From c1b5daadef2811f5246ef16e7752661514fa542a Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Fri, 17 Mar 2023 10:50:44 +0100 Subject: [PATCH 5/8] remove unused view and routes from instructeurs avis --- app/controllers/experts/avis_controller.rb | 2 +- app/views/experts/avis/index.html.haml | 6 +-- app/views/experts/avis/procedure.html.haml | 6 +-- .../avis/{shared => }/_form.html.haml | 0 app/views/instructeurs/avis/_header.html.haml | 14 ------ .../avis/{shared => }/_list.html.haml | 0 app/views/instructeurs/avis/index.html.haml | 41 ----------------- .../instructeurs/avis/messagerie.html.haml | 5 -- .../instructeurs/avis/procedure.html.haml | 46 ------------------- app/views/instructeurs/avis/show.html.haml | 5 -- .../instructeurs/dossiers/avis.html.haml | 2 +- .../instructeurs/dossiers/avis_new.html.haml | 2 +- config/routes.rb | 3 +- .../avis/{shared => }/list.html.haml_spec.rb | 4 +- 14 files changed, 12 insertions(+), 124 deletions(-) rename app/views/instructeurs/avis/{shared => }/_form.html.haml (100%) delete mode 100644 app/views/instructeurs/avis/_header.html.haml rename app/views/instructeurs/avis/{shared => }/_list.html.haml (100%) delete mode 100644 app/views/instructeurs/avis/index.html.haml delete mode 100644 app/views/instructeurs/avis/messagerie.html.haml delete mode 100644 app/views/instructeurs/avis/procedure.html.haml delete mode 100644 app/views/instructeurs/avis/show.html.haml rename spec/views/instructeur/avis/{shared => }/list.html.haml_spec.rb (89%) diff --git a/app/controllers/experts/avis_controller.rb b/app/controllers/experts/avis_controller.rb index 2476eeeb4..f96dfd09f 100644 --- a/app/controllers/experts/avis_controller.rb +++ b/app/controllers/experts/avis_controller.rb @@ -142,7 +142,7 @@ module Experts extension = params[:format] render extension.to_sym => avis.dossier.etablissement.entreprise_bilans_bdf_to_sheet(extension) else - redirect_to instructeur_avis_path(avis) + redirect_to expert_avis_path(avis) end end diff --git a/app/views/experts/avis/index.html.haml b/app/views/experts/avis/index.html.haml index b3d2dd845..535c0e49d 100644 --- a/app/views/experts/avis/index.html.haml +++ b/app/views/experts/avis/index.html.haml @@ -13,12 +13,12 @@ .procedure-details %p.fr-mb-2w = procedure_badge(p) - = link_to(p.libelle, procedure_instructeur_avis_index_path(p), class: "fr-link fr-ml-1w") + = link_to(p.libelle, procedure_expert_avis_index_path(p), class: "fr-link fr-ml-1w") %ul.procedure-stats.flex %li %object - = link_to(procedure_instructeur_avis_index_path(p, statut: Instructeurs::AvisController::A_DONNER_STATUS)) do + = link_to(procedure_expert_avis_index_path(p, statut: Instructeurs::AvisController::A_DONNER_STATUS)) do - without_answer_count = procedure_avis.select { |a| a.answer.nil? }.size - if without_answer_count > 0 %span.notifications{ 'aria-label': "notifications" } @@ -28,7 +28,7 @@ avis à donner %li %object - = link_to(procedure_instructeur_avis_index_path(p, statut: Instructeurs::AvisController::DONNES_STATUS)) do + = link_to(procedure_expert_avis_index_path(p, statut: Instructeurs::AvisController::DONNES_STATUS)) do - with_answer_count = procedure_avis.select { |a| a.answer.present? }.size .stats-number= with_answer_count .stats-legend diff --git a/app/views/experts/avis/procedure.html.haml b/app/views/experts/avis/procedure.html.haml index 0e08e2ed4..547d633f9 100644 --- a/app/views/experts/avis/procedure.html.haml +++ b/app/views/experts/avis/procedure.html.haml @@ -36,11 +36,11 @@ - @avis.each do |avis| %tr %td.number-col - = link_to(instructeur_avis_path(avis.procedure, avis), class: 'cell-link') do + = link_to(expert_avis_path(avis.procedure, avis), class: 'cell-link') do %span.icon.folder #{avis.dossier.id} - %td= link_to(avis.dossier.user_email_for(:display), instructeur_avis_path(avis.procedure, avis), class: 'cell-link') - %td= link_to(avis.procedure.libelle, instructeur_avis_path(avis.procedure, avis), class: 'cell-link') + %td= link_to(avis.dossier.user_email_for(:display), expert_avis_path(avis.procedure, avis), class: 'cell-link') + %td= link_to(avis.procedure.libelle, expert_avis_path(avis.procedure, avis), class: 'cell-link') = paginate(@avis) - else %h2.empty-text Aucun avis diff --git a/app/views/instructeurs/avis/shared/_form.html.haml b/app/views/instructeurs/avis/_form.html.haml similarity index 100% rename from app/views/instructeurs/avis/shared/_form.html.haml rename to app/views/instructeurs/avis/_form.html.haml diff --git a/app/views/instructeurs/avis/_header.html.haml b/app/views/instructeurs/avis/_header.html.haml deleted file mode 100644 index 5e5adba89..000000000 --- a/app/views/instructeurs/avis/_header.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -.sub-header - .container - %ul.breadcrumbs - %li= link_to('Avis', instructeur_all_avis_path) - %li - = link_to(procedure.libelle, procedure_instructeur_avis_index_path(avis.procedure), class: "fr-link") - = procedure_badge(dossier.procedure) - %li= link_to("Dossier nº #{dossier.id}", instructeur_avis_path(avis.procedure, avis)) - - %nav.tabs - %ul - = dynamic_tab_item('Demande', instructeur_avis_path(avis.procedure, avis)) - = dynamic_tab_item('Avis', instruction_instructeur_avis_path(avis.procedure, avis), notification: avis.answer.blank?) - = dynamic_tab_item('Messagerie', messagerie_instructeur_avis_path(avis.procedure, avis)) diff --git a/app/views/instructeurs/avis/shared/_list.html.haml b/app/views/instructeurs/avis/_list.html.haml similarity index 100% rename from app/views/instructeurs/avis/shared/_list.html.haml rename to app/views/instructeurs/avis/_list.html.haml diff --git a/app/views/instructeurs/avis/index.html.haml b/app/views/instructeurs/avis/index.html.haml deleted file mode 100644 index 7b8838a3e..000000000 --- a/app/views/instructeurs/avis/index.html.haml +++ /dev/null @@ -1,41 +0,0 @@ -- content_for(:title, "Avis") - -.container - %h1.page-title Avis - - %ul.procedure-list - - @avis_by_procedure.each do |p, procedure_avis| - %li.procedure-item.flex.align-start - = link_to(procedure_instructeur_avis_index_path(p)) do - .flex - - .procedure-logo{ style: "background-image: url(#{p.logo_url})" } - - .procedure-details - %p.procedure-title - = procedure_libelle p - %ul.procedure-stats.flex - %li - %object - = link_to(procedure_instructeur_avis_index_path(p, statut: Instructeurs::AvisController::A_DONNER_STATUS)) do - - without_answer_count = procedure_avis.select { |a| a.answer.nil? }.size - - if without_answer_count > 0 - %span.notifications{ 'aria-label': "notifications" } - .stats-number - = without_answer_count - .stats-legend - avis à donner - %li - %object - = link_to(procedure_instructeur_avis_index_path(p, statut: Instructeurs::AvisController::DONNES_STATUS)) do - - with_answer_count = procedure_avis.select { |a| a.answer.present? }.size - .stats-number= with_answer_count - .stats-legend - = pluralize(with_answer_count, "avis donné") - - - if p.close? - .procedure-status - %span.label Close - - elsif p.depubliee? - .procedure-status - %span.label Dépubliée diff --git a/app/views/instructeurs/avis/messagerie.html.haml b/app/views/instructeurs/avis/messagerie.html.haml deleted file mode 100644 index 46e64e69a..000000000 --- a/app/views/instructeurs/avis/messagerie.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -- content_for(:title, "Messagerie · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") - -= render partial: 'header', locals: { avis: @avis, dossier: @dossier } - -= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, connected_user: current_instructeur, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_instructeur_avis_path(@avis) } diff --git a/app/views/instructeurs/avis/procedure.html.haml b/app/views/instructeurs/avis/procedure.html.haml deleted file mode 100644 index 7334ecd96..000000000 --- a/app/views/instructeurs/avis/procedure.html.haml +++ /dev/null @@ -1,46 +0,0 @@ -- avis_statut = (@statut == Instructeurs::AvisController::A_DONNER_STATUS) ? 'à donner' : 'rendus' -- content_for(:title, "Avis #{avis_statut}") - -#procedure-show - .sub-header - .container.flex - - .procedure-logo{ style: "background-image: url(#{@procedure.logo_url})", - role: 'img', 'aria-label': "logo de la démarche #{@procedure.libelle}" } - - .procedure-header - %h1= procedure_libelle @procedure - - %nav.tabs - %ul - = tab_item('avis à donner', - procedure_instructeur_avis_index_path(statut: Instructeurs::AvisController::A_DONNER_STATUS), - active: @statut == Instructeurs::AvisController::A_DONNER_STATUS, - badge: @avis_a_donner.count, - notification: @avis_a_donner.any?) - - = tab_item("avis #{'donné'.pluralize(@avis_donnes.count)}", - procedure_instructeur_avis_index_path(statut: Instructeurs::AvisController::DONNES_STATUS), - active: @statut == Instructeurs::AvisController::DONNES_STATUS, - badge: @avis_donnes.count) - -.container - - if @avis.present? - %table.table.dossiers-table.hoverable - %thead - %tr - %th.number-col Nº dossier - %th Demandeur - %th Démarche - %tbody - - @avis.each do |avis| - %tr - %td.number-col - = link_to(instructeur_avis_path(avis.procedure, avis), class: 'cell-link') do - %span.icon.folder - #{avis.dossier.id} - %td= link_to(avis.dossier.user_email_for(:display), instructeur_avis_path(avis.procedure, avis), class: 'cell-link') - %td= link_to(avis.procedure.libelle, instructeur_avis_path(avis.procedure, avis), class: 'cell-link') - = paginate(@avis) - - else - %h2.empty-text Aucun avis diff --git a/app/views/instructeurs/avis/show.html.haml b/app/views/instructeurs/avis/show.html.haml deleted file mode 100644 index b2c53c6a8..000000000 --- a/app/views/instructeurs/avis/show.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -- content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") - -= render partial: 'header', locals: { avis: @avis, dossier: @dossier } - -= render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil, profile: 'instructeur' } diff --git a/app/views/instructeurs/dossiers/avis.html.haml b/app/views/instructeurs/dossiers/avis.html.haml index 7866eb782..b5676c6b0 100644 --- a/app/views/instructeurs/dossiers/avis.html.haml +++ b/app/views/instructeurs/dossiers/avis.html.haml @@ -8,7 +8,7 @@ = render partial: 'instructeurs/avis/sidemenu' .fr-col - if @dossier.avis.present? - = render partial: 'instructeurs/avis/shared/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } + = render partial: 'instructeurs/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } -else %h2.empty-text Aucun avis. diff --git a/app/views/instructeurs/dossiers/avis_new.html.haml b/app/views/instructeurs/dossiers/avis_new.html.haml index 790793db0..31fa08472 100644 --- a/app/views/instructeurs/dossiers/avis_new.html.haml +++ b/app/views/instructeurs/dossiers/avis_new.html.haml @@ -9,6 +9,6 @@ .fr-col - if !@dossier.termine? - if @dossier.procedure.allow_expert_review - = render partial: "instructeurs/avis/shared/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis } + = render partial: "instructeurs/avis/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis } - else %p Cette démarche n’autorise pas la demande d’avis à un expert. Veuillez contacter votre administrateur diff --git a/config/routes.rb b/config/routes.rb index 0dbed9948..687397261 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -392,8 +392,7 @@ Rails.application.routes.draw do end end - resources :avis, only: [:show, :update] do - get '', action: 'procedure', on: :collection, as: :procedure + resources :avis, only: [] do member do patch 'revoquer' get 'remind' diff --git a/spec/views/instructeur/avis/shared/list.html.haml_spec.rb b/spec/views/instructeur/avis/list.html.haml_spec.rb similarity index 89% rename from spec/views/instructeur/avis/shared/list.html.haml_spec.rb rename to spec/views/instructeur/avis/list.html.haml_spec.rb index db37921a2..e6057e033 100644 --- a/spec/views/instructeur/avis/shared/list.html.haml_spec.rb +++ b/spec/views/instructeur/avis/list.html.haml_spec.rb @@ -1,7 +1,7 @@ -describe 'instructeurs/avis/shared/_list.html.haml', type: :view do +describe 'instructeurs/avis/_list.html.haml', type: :view do before { view.extend DossierHelper } - subject { render 'instructeurs/avis/shared/list.html.haml', avis: avis, avis_seen_at: seen_at, current_instructeur: instructeur } + subject { render 'instructeurs/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, current_instructeur: instructeur } let(:instructeur) { create(:instructeur) } let(:instructeur2) { create(:instructeur) } From 4a2982dc37306a7cee0c4235d4952c4a0943e467 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Fri, 17 Mar 2023 11:30:20 +0100 Subject: [PATCH 6/8] fix tests and linter --- app/views/experts/avis/_sidemenu.html.haml | 16 ++++++++-------- .../instructeurs/avis/_sidemenu.html.haml | 18 +++++++++--------- app/views/instructeurs/dossiers/avis.html.haml | 2 +- .../experts/avis_controller_spec.rb | 2 +- spec/system/experts/expert_spec.rb | 2 ++ spec/system/instructeurs/expert_spec.rb | 4 +++- spec/system/instructeurs/instruction_spec.rb | 3 +++ 7 files changed, 27 insertions(+), 20 deletions(-) diff --git a/app/views/experts/avis/_sidemenu.html.haml b/app/views/experts/avis/_sidemenu.html.haml index 88f8aa6d9..ce20e1f58 100644 --- a/app/views/experts/avis/_sidemenu.html.haml +++ b/app/views/experts/avis/_sidemenu.html.haml @@ -1,21 +1,21 @@ -%nav.fr-sidemenu{"aria-labelledby" => "fr-sidemenu-title"} +%nav.fr-sidemenu{ "aria-labelledby" => "fr-sidemenu-title" } .fr-sidemenu__inner - %button.fr-sidemenu__btn{"aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: ""} Dans cette rubrique + %button.fr-sidemenu__btn{ "aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: "" } Dans cette rubrique #fr-sidemenu-wrapper.fr-collapse %ul.fr-sidemenu__list - url = instruction_expert_avis_path(@avis.procedure, @avis) - current_page = current_page?(url) - %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} - %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil, href: url, target: "_self"} Donner votre avis + %li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" } + %a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil, href: url, target: "_self" } Donner votre avis - if @dossier.avis_for_expert(current_expert).present? - url = avis_list_expert_avis_path(@avis.procedure, @avis) - current_page = current_page?(url) - %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} - %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: url, target: "_self"} Voir les avis + %li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" } + %a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil,href: url, target: "_self" } Voir les avis - if !@dossier.termine? - url = avis_new_expert_avis_path(@avis.procedure, @avis) - current_page = current_page?(url) - %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} - %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: url, target: "_self"} Demander un nouvel avis + %li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" } + %a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil,href: url, target: "_self" } Demander un nouvel avis diff --git a/app/views/instructeurs/avis/_sidemenu.html.haml b/app/views/instructeurs/avis/_sidemenu.html.haml index 8c73d86f2..341c90cdd 100644 --- a/app/views/instructeurs/avis/_sidemenu.html.haml +++ b/app/views/instructeurs/avis/_sidemenu.html.haml @@ -1,14 +1,14 @@ -%nav.fr-sidemenu{"aria-labelledby" => "fr-sidemenu-title"} +%nav.fr-sidemenu{ "aria-labelledby" => "fr-sidemenu-title" } .fr-sidemenu__inner - %button.fr-sidemenu__btn{"aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: ""} Dans cette rubrique + %button.fr-sidemenu__btn{ "aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: "" } Dans cette rubrique #fr-sidemenu-wrapper.fr-collapse %ul.fr-sidemenu__list - - url = avis_new_instructeur_dossier_path(@dossier.procedure, @dossier) - - current_page = current_page?(url) - %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} - %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil, href: url, target: "_self"} Demander un avis - - url = avis_instructeur_dossier_path(@dossier.procedure, @dossier) - current_page = current_page?(url) - %li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"} - %a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: url, target: "_self"} Voir les avis + %li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" } + %a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil,href: url, target: "_self" } Voir les avis + + - url = avis_new_instructeur_dossier_path(@dossier.procedure, @dossier) + - current_page = current_page?(url) + %li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" } + %a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil, href: url, target: "_self" } Demander un avis diff --git a/app/views/instructeurs/dossiers/avis.html.haml b/app/views/instructeurs/dossiers/avis.html.haml index b5676c6b0..666788e9b 100644 --- a/app/views/instructeurs/dossiers/avis.html.haml +++ b/app/views/instructeurs/dossiers/avis.html.haml @@ -10,6 +10,6 @@ - if @dossier.avis.present? = render partial: 'instructeurs/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } - -else + - else %h2.empty-text Aucun avis. %p.empty-text-details Aucun avis n’a été demandé sur ce dossier. diff --git a/spec/controllers/experts/avis_controller_spec.rb b/spec/controllers/experts/avis_controller_spec.rb index 40d271562..eae41ab32 100644 --- a/spec/controllers/experts/avis_controller_spec.rb +++ b/spec/controllers/experts/avis_controller_spec.rb @@ -82,7 +82,7 @@ describe Experts::AvisController, type: :controller do before { get :bilans_bdf, params: { id: avis, procedure_id: } } - it { expect(response).to redirect_to(instructeur_avis_path(avis_without_answer)) } + it { expect(response).to redirect_to(expert_avis_path(avis_without_answer)) } context 'with a revoked avis' do let(:avis) { revoked_avis } diff --git a/spec/system/experts/expert_spec.rb b/spec/system/experts/expert_spec.rb index 9fe482596..f9538921b 100644 --- a/spec/system/experts/expert_spec.rb +++ b/spec/system/experts/expert_spec.rb @@ -189,6 +189,7 @@ describe 'Inviting an expert:' do click_on avis_1.dossier.user.email within('.tabs') { click_on 'Avis' } expect(page).to have_text("Demandeur : #{avis_1.claimant.email}") + click_on 'Voir les avis' expect(page).to have_text("Vous") expect(page).to have_text(avis_2.expert.email.to_s) end @@ -204,6 +205,7 @@ describe 'Inviting an expert:' do click_on avis_2.dossier.user.email within('.tabs') { click_on 'Avis' } expect(page).to have_text("Demandeur : #{avis_2.claimant.email}") + click_on 'Voir les avis' expect(page).to have_text("Vous") expect(page).not_to have_text(avis_1.expert.email.to_s) end diff --git a/spec/system/instructeurs/expert_spec.rb b/spec/system/instructeurs/expert_spec.rb index a2c0f64f8..c30aa4fc7 100644 --- a/spec/system/instructeurs/expert_spec.rb +++ b/spec/system/instructeurs/expert_spec.rb @@ -26,13 +26,15 @@ describe 'Inviting an expert:', js: true do click_on 'Avis externes' expect(page).to have_current_path(avis_instructeur_dossier_path(procedure, dossier)) + within('.fr-sidemenu') { click_on 'Demander un avis' } + expect(page).to have_current_path(avis_new_instructeur_dossier_path(procedure, dossier)) page.execute_script("document.querySelector('#avis_emails').value = '[\"#{expert.email}\",\"#{expert2.email}\"]'") fill_in 'avis_introduction', with: 'Bonjour, merci de me donner votre avis sur ce dossier.' check 'avis_invite_linked_dossiers' page.select 'confidentiel', from: 'avis_confidentiel' - click_on 'Demander un avis' + within('form#new_avis') { click_on 'Demander un avis' } perform_enqueued_jobs expect(page).to have_content('Une demande d’avis a été envoyée') diff --git a/spec/system/instructeurs/instruction_spec.rb b/spec/system/instructeurs/instruction_spec.rb index 95d19b767..48f8cb35b 100644 --- a/spec/system/instructeurs/instruction_spec.rb +++ b/spec/system/instructeurs/instruction_spec.rb @@ -139,6 +139,8 @@ describe 'Instructing a dossier:', js: true do click_on 'Avis externes' expect(page).to have_current_path(avis_instructeur_dossier_path(procedure, dossier)) + within('.fr-sidemenu') { click_on 'Demander un avis' } + expect(page).to have_current_path(avis_new_instructeur_dossier_path(procedure, dossier)) expert_email_formated = "[\"expert@tps.com\"]" expert_email = 'expert@tps.com' @@ -270,6 +272,7 @@ describe 'Instructing a dossier:', js: true do page.execute_script("document.querySelector('#avis_emails').value = '#{to}'") fill_in 'avis_introduction', with: introduction select 'confidentiel', from: 'avis_confidentiel' + within('form#new_avis') { click_on 'Demander un avis' } click_on 'Demander un avis' end From a01564adcd71f4a3dba591c20ee94e393cfe2327 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Mon, 20 Mar 2023 17:50:05 +0100 Subject: [PATCH 7/8] create component for sidemenu and add locales for raw text --- app/components/dsfr/sidemenu_component.rb | 15 ++++ .../sidemenu_component.en.yml | 3 + .../sidemenu_component.fr.yml | 3 + .../sidemenu_component.html.haml | 9 ++ app/views/experts/avis/_sidemenu.html.haml | 23 +----- app/views/experts/avis/avis_list.html.haml | 6 ++ app/views/experts/avis/avis_new.html.haml | 5 ++ app/views/experts/avis/instruction.html.haml | 82 ++++++++++--------- .../instructeurs/avis/_sidemenu.html.haml | 16 +--- .../instructeurs/dossiers/avis.html.haml | 6 +- .../instructeurs/dossiers/avis_new.html.haml | 10 ++- config/locales/models/avis/en.yml | 12 +++ config/locales/models/avis/fr.yml | 12 +++ 13 files changed, 126 insertions(+), 76 deletions(-) create mode 100644 app/components/dsfr/sidemenu_component.rb create mode 100644 app/components/dsfr/sidemenu_component/sidemenu_component.en.yml create mode 100644 app/components/dsfr/sidemenu_component/sidemenu_component.fr.yml create mode 100644 app/components/dsfr/sidemenu_component/sidemenu_component.html.haml diff --git a/app/components/dsfr/sidemenu_component.rb b/app/components/dsfr/sidemenu_component.rb new file mode 100644 index 000000000..d448f7852 --- /dev/null +++ b/app/components/dsfr/sidemenu_component.rb @@ -0,0 +1,15 @@ +class Dsfr::SidemenuComponent < ApplicationComponent + renders_many :links, "LinkComponent" + + class LinkComponent < ApplicationComponent + attr_reader :name, :url + def initialize(name:, url:) + @name = name + @url = url + end + end + + def active?(url) + current_page?(url) + end +end diff --git a/app/components/dsfr/sidemenu_component/sidemenu_component.en.yml b/app/components/dsfr/sidemenu_component/sidemenu_component.en.yml new file mode 100644 index 000000000..54dac542d --- /dev/null +++ b/app/components/dsfr/sidemenu_component/sidemenu_component.en.yml @@ -0,0 +1,3 @@ +--- +fr: + btn_collapse_text: In this section diff --git a/app/components/dsfr/sidemenu_component/sidemenu_component.fr.yml b/app/components/dsfr/sidemenu_component/sidemenu_component.fr.yml new file mode 100644 index 000000000..7c8926b7d --- /dev/null +++ b/app/components/dsfr/sidemenu_component/sidemenu_component.fr.yml @@ -0,0 +1,3 @@ +--- +fr: + btn_collapse_text: Dans cette rubrique diff --git a/app/components/dsfr/sidemenu_component/sidemenu_component.html.haml b/app/components/dsfr/sidemenu_component/sidemenu_component.html.haml new file mode 100644 index 000000000..2e2a70014 --- /dev/null +++ b/app/components/dsfr/sidemenu_component/sidemenu_component.html.haml @@ -0,0 +1,9 @@ + +%nav.fr-sidemenu{ "aria-labelledby" => "fr-sidemenu-title" } + .fr-sidemenu__inner + %button.fr-sidemenu__btn{ "aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: "" }= t('.btn_collapse_text') + #fr-sidemenu-wrapper.fr-collapse + %ul.fr-sidemenu__list + - links.each do |link| + %li{ class: "fr-sidemenu__item fr-sidemenu__item#{active?(link.url) ? '--active' : ''}" } + = link_to link.name, link.url, class: 'fr-sidemenu__link', 'aria-current': active?(link.url) ? 'page' : nil, target: "_self" diff --git a/app/views/experts/avis/_sidemenu.html.haml b/app/views/experts/avis/_sidemenu.html.haml index ce20e1f58..65ed8293e 100644 --- a/app/views/experts/avis/_sidemenu.html.haml +++ b/app/views/experts/avis/_sidemenu.html.haml @@ -1,21 +1,2 @@ -%nav.fr-sidemenu{ "aria-labelledby" => "fr-sidemenu-title" } - .fr-sidemenu__inner - %button.fr-sidemenu__btn{ "aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: "" } Dans cette rubrique - #fr-sidemenu-wrapper.fr-collapse - %ul.fr-sidemenu__list - - url = instruction_expert_avis_path(@avis.procedure, @avis) - - current_page = current_page?(url) - %li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" } - %a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil, href: url, target: "_self" } Donner votre avis - - - if @dossier.avis_for_expert(current_expert).present? - - url = avis_list_expert_avis_path(@avis.procedure, @avis) - - current_page = current_page?(url) - %li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" } - %a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil,href: url, target: "_self" } Voir les avis - - - if !@dossier.termine? - - url = avis_new_expert_avis_path(@avis.procedure, @avis) - - current_page = current_page?(url) - %li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" } - %a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil,href: url, target: "_self" } Demander un nouvel avis += render(Dsfr::SidemenuComponent.new) do |component| + - component.with_links([{ name: t('helpers.sidemenu.give_avis'), url: instruction_expert_avis_path(@avis.procedure, @avis) }, { name: t('helpers.sidemenu.see_avis'), url: avis_list_expert_avis_path(@avis.procedure, @avis) }, { name: t('helpers.sidemenu.ask_new_avis'), url: avis_new_expert_avis_path(@avis.procedure, @avis) }]) diff --git a/app/views/experts/avis/avis_list.html.haml b/app/views/experts/avis/avis_list.html.haml index 0479010fe..52a1df0f1 100644 --- a/app/views/experts/avis/avis_list.html.haml +++ b/app/views/experts/avis/avis_list.html.haml @@ -9,3 +9,9 @@ .fr-col - if @dossier.avis_for_expert(current_expert).present? = render partial: 'experts/avis/shared/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil } + + - else + %h2.empty-text + = t('helpers.information_text.empty_text') + %p.empty-text-details + = t('helpers.information_text.empty_text_detail') diff --git a/app/views/experts/avis/avis_new.html.haml b/app/views/experts/avis/avis_new.html.haml index d5e29041c..a42af6b72 100644 --- a/app/views/experts/avis/avis_new.html.haml +++ b/app/views/experts/avis/avis_new.html.haml @@ -9,3 +9,8 @@ .fr-col - if !@dossier.termine? = render partial: "experts/avis/shared/form", locals: { url: avis_expert_avis_path(@avis.procedure, @avis), linked_dossiers: @dossier.linked_dossiers_for(current_expert), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis } + - else + %h2.empty-text + = t('helpers.information_text.no_new_avis_text') + %p.empty-text-details + = t('helpers.information_text.no_new_avis_text_detail') diff --git a/app/views/experts/avis/instruction.html.haml b/app/views/experts/avis/instruction.html.haml index 465d8441b..5d8ce4e88 100644 --- a/app/views/experts/avis/instruction.html.haml +++ b/app/views/experts/avis/instruction.html.haml @@ -7,49 +7,55 @@ .fr-col.fr-col-12.fr-col-md-3 = render partial: 'sidemenu' .fr-col - %section.give-avis - %h1.tab-title Donner votre avis - %h2.claimant - Demandeur : - %span.email.font-weight-normal= safe_claimant_email(@avis.claimant) - %span.date.font-weight-normal Demande d’avis envoyée le #{l(@avis.created_at, format: '%d/%m/%y')} - %p.introduction= @avis.introduction + - if !@dossier.termine? + %section.give-avis + %h1.tab-title Donner votre avis + %h2.claimant + Demandeur : + %span.email.font-weight-normal= safe_claimant_email(@avis.claimant) + %span.date.font-weight-normal Demande d’avis envoyée le #{l(@avis.created_at, format: '%d/%m/%y')} + %p.introduction= @avis.introduction - - if @avis.introduction_file.attached? - = render Attachment::ShowComponent.new(attachment: @avis.introduction_file.attachment) - %br/ - = render Attachment::DeleteFormComponent.new - = form_for @avis, url: expert_avis_path(@avis.procedure, @avis), html: { data: { controller: 'persisted-form', persisted_form_key_value: dom_id(@avis) }, multipart: true } do |f| + - if @avis.introduction_file.attached? + = render Attachment::ShowComponent.new(attachment: @avis.introduction_file.attachment) + %br/ + = render Attachment::DeleteFormComponent.new + = form_for @avis, url: expert_avis_path(@avis.procedure, @avis), html: { data: { controller: 'persisted-form', persisted_form_key_value: dom_id(@avis) }, multipart: true } do |f| - - if @avis.question_label - .fr-form-group - %fieldset.fr-fieldset.fr-fieldset--inline - %legend#radio-inline-legend.fr-fieldset__legend.fr-text--regular - = @avis.question_label - .fr-fieldset__content - .fr-radio-group - = f.radio_button :question_answer, true - = f.label :question_answer, 'oui', value: true, class: 'fr-label' + - if @avis.question_label + .fr-form-group + %fieldset.fr-fieldset.fr-fieldset--inline + %legend#radio-inline-legend.fr-fieldset__legend.fr-text--regular + = @avis.question_label + .fr-fieldset__content + .fr-radio-group + = f.radio_button :question_answer, true + = f.label :question_answer, 'oui', value: true, class: 'fr-label' - .fr-radio-group - = f.radio_button :question_answer, false - = f.label :question_answer, 'non', value: false, class: 'fr-label' + .fr-radio-group + = f.radio_button :question_answer, false + = f.label :question_answer, 'non', value: false, class: 'fr-label' - .fr-select-group - = f.text_area :answer, rows: 3, class: 'fr-input', placeholder: 'Votre avis', required: true + .fr-select-group + = f.text_area :answer, rows: 3, class: 'fr-input', placeholder: 'Votre avis', required: true - = render Attachment::EditComponent.new(attached_file: @avis.piece_justificative_file, view_as: :download) + = render Attachment::EditComponent.new(attached_file: @avis.piece_justificative_file, view_as: :download) - .flex.justify-between.align-baseline - %p.confidentiel.flex - - if @avis.confidentiel? - %span.icon.lock - %span - Cet avis est confidentiel et n’est pas affiché aux autres experts consultés - - else - %span - Cet avis est partagé avec les autres experts - .send-wrapper - = f.submit 'Envoyer votre avis', class: 'fr-btn' + .flex.justify-between.align-baseline + %p.confidentiel.flex + - if @avis.confidentiel? + %span.icon.lock + %span + Cet avis est confidentiel et n’est pas affiché aux autres experts consultés + - else + %span + Cet avis est partagé avec les autres experts + .send-wrapper + = f.submit 'Envoyer votre avis', class: 'fr-btn' + - else + %h2.empty-text + = t('helpers.information_text.no_new_avis_text') + %p.empty-text-details + = t('helpers.information_text.no_new_avis_text_detail') diff --git a/app/views/instructeurs/avis/_sidemenu.html.haml b/app/views/instructeurs/avis/_sidemenu.html.haml index 341c90cdd..4446b240d 100644 --- a/app/views/instructeurs/avis/_sidemenu.html.haml +++ b/app/views/instructeurs/avis/_sidemenu.html.haml @@ -1,14 +1,2 @@ -%nav.fr-sidemenu{ "aria-labelledby" => "fr-sidemenu-title" } - .fr-sidemenu__inner - %button.fr-sidemenu__btn{ "aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: "" } Dans cette rubrique - #fr-sidemenu-wrapper.fr-collapse - %ul.fr-sidemenu__list - - url = avis_instructeur_dossier_path(@dossier.procedure, @dossier) - - current_page = current_page?(url) - %li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" } - %a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil,href: url, target: "_self" } Voir les avis - - - url = avis_new_instructeur_dossier_path(@dossier.procedure, @dossier) - - current_page = current_page?(url) - %li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" } - %a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil, href: url, target: "_self" } Demander un avis += render(Dsfr::SidemenuComponent.new) do |component| + - component.with_links([{ name: t('helpers.sidemenu.see_avis'), url: avis_instructeur_dossier_path(@dossier.procedure, @dossier) }, { name: t('helpers.sidemenu.ask_avis'), url: avis_new_instructeur_dossier_path(@dossier.procedure, @dossier) }]) diff --git a/app/views/instructeurs/dossiers/avis.html.haml b/app/views/instructeurs/dossiers/avis.html.haml index 666788e9b..d7a589ac2 100644 --- a/app/views/instructeurs/dossiers/avis.html.haml +++ b/app/views/instructeurs/dossiers/avis.html.haml @@ -11,5 +11,7 @@ = render partial: 'instructeurs/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } - else - %h2.empty-text Aucun avis. - %p.empty-text-details Aucun avis n’a été demandé sur ce dossier. + %h2.empty-text + = t('helpers.information_text.empty_text') + %p.empty-text-details + = t('helpers.information_text.empty_text_detail') diff --git a/app/views/instructeurs/dossiers/avis_new.html.haml b/app/views/instructeurs/dossiers/avis_new.html.haml index 31fa08472..3d9c19ee6 100644 --- a/app/views/instructeurs/dossiers/avis_new.html.haml +++ b/app/views/instructeurs/dossiers/avis_new.html.haml @@ -11,4 +11,12 @@ - if @dossier.procedure.allow_expert_review = render partial: "instructeurs/avis/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis } - else - %p Cette démarche n’autorise pas la demande d’avis à un expert. Veuillez contacter votre administrateur + %h2.empty-text + = t('helpers.information_text.unauthorized_avis_text') + %p.empty-text-details + = t('helpers.information_text.unauthorized_avis_text_detail') + - else + %h2.empty-text + = t('helpers.information_text.no_new_avis_text') + %p.empty-text-details + = t('helpers.information_text.no_new_avis_text_detail') diff --git a/config/locales/models/avis/en.yml b/config/locales/models/avis/en.yml index bcc51ae19..5947165cb 100644 --- a/config/locales/models/avis/en.yml +++ b/config/locales/models/avis/en.yml @@ -26,3 +26,15 @@ en: confirmation: revoke: "Would you like to revoke the opinion request to %{email} ?" remind: "Would you like to remind %{email} ?" + sidemenu: + give_avis: Give your opinion + see_avis: Read opinions + ask_avis: Ask for an opinion + ask_new_avis: Ask for a new opinion + information_text: + no_new_avis_text: The file has been proceed + no_new_avis_text_detail: Opinion requests are closed + unauthorized_avis_text: This procedure does not allowed expert opinions + unauthorized_avis_text_detail: Would you please contact your administrator + empty_text: No opinion. + empty_text_detail: No opinion available on this file diff --git a/config/locales/models/avis/fr.yml b/config/locales/models/avis/fr.yml index 1a3c8b6d4..2ebf2c2d1 100644 --- a/config/locales/models/avis/fr.yml +++ b/config/locales/models/avis/fr.yml @@ -26,3 +26,15 @@ fr: confirmation: revoke: "Souhaitez-vous révoquer la demande d’avis à %{email} ?" remind: "Souhaitez-vous relancer %{email} ?" + sidemenu: + give_avis: Donner votre avis + see_avis: Voir les avis + ask_avis: Demander un avis + ask_new_avis: Demander un nouvel avis + information_text: + no_new_avis_text: Le dossier a été traité + no_new_avis_text_detail: Les demandes d'avis ne sont plus autorisées + unauthorized_avis_text: Cette démarche n’autorise pas la demande d’avis à un expert. + unauthorized_avis_text_detail: Veuillez contacter votre administrateur + empty_text: Aucun avis. + empty_text_detail: Aucun avis n’est disponible sur ce dossier. From aa9c94a20e378978e48e818672e00cc2c7d2173b Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Wed, 22 Mar 2023 11:56:52 +0100 Subject: [PATCH 8/8] fix display in view and export if answer is 'no' --- app/views/dossiers/show.pdf.prawn | 2 +- app/views/experts/avis/shared/_list.html.haml | 2 +- app/views/instructeurs/avis/_list.html.haml | 2 +- spec/system/experts/expert_spec.rb | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/dossiers/show.pdf.prawn b/app/views/dossiers/show.pdf.prawn index a2a451765..bf1396868 100644 --- a/app/views/dossiers/show.pdf.prawn +++ b/app/views/dossiers/show.pdf.prawn @@ -212,7 +212,7 @@ def add_avis(pdf, avis) format_in_2_lines(pdf, "Avis de #{avis.email_to_display}#{avis.confidentiel? ? ' (confidentiel)' : ''}", avis.answer || 'En attente de réponse') - if avis.question_answer.present? + if [true, false].include? avis.question_answer format_in_2_columns(pdf, "Réponse oui/non ", t("question_answer.#{avis.question_answer}", scope: 'helpers.label')) end end diff --git a/app/views/experts/avis/shared/_list.html.haml b/app/views/experts/avis/shared/_list.html.haml index 962d6813d..d6d38b166 100644 --- a/app/views/experts/avis/shared/_list.html.haml +++ b/app/views/experts/avis/shared/_list.html.haml @@ -37,6 +37,6 @@ - if avis.piece_justificative_file.attached? = render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment) .answer-body - - if avis.question_answer + - if [true, false].include? avis.question_answer %p= t("question_answer.#{avis.question_answer}", scope: 'helpers.label') = render SimpleFormatComponent.new(avis.answer, allow_a: false) diff --git a/app/views/instructeurs/avis/_list.html.haml b/app/views/instructeurs/avis/_list.html.haml index 91577ddbf..34afa12ae 100644 --- a/app/views/instructeurs/avis/_list.html.haml +++ b/app/views/instructeurs/avis/_list.html.haml @@ -53,7 +53,7 @@ - if avis.piece_justificative_file.attached? = render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment) .answer-body - - if avis.question_answer + - if [true, false].include? avis.question_answer %p= t("question_answer.#{avis.question_answer}", scope: 'helpers.label') = render SimpleFormatComponent.new(avis.answer, allow_a: false) diff --git a/spec/system/experts/expert_spec.rb b/spec/system/experts/expert_spec.rb index f9538921b..67fb2eb90 100644 --- a/spec/system/experts/expert_spec.rb +++ b/spec/system/experts/expert_spec.rb @@ -110,6 +110,10 @@ describe 'Inviting an expert:' do expect(page).to have_content('Ma réponse d’expert.') expect(page).to have_content('non') + click_on 'Voir les avis' + expect(page).to have_text('Vous') + expect(page).to have_text('non') + within('.breadcrumbs') { click_on 'Avis' } expect(page).to have_text('1 avis donné') end