Merge pull request #8770 from demarches-simplifiees/ask-question-in-avis-ux-part
[UX] améliorer UX de la demande d'avis
This commit is contained in:
commit
d079f3ac98
35 changed files with 221 additions and 186 deletions
15
app/components/dsfr/sidemenu_component.rb
Normal file
15
app/components/dsfr/sidemenu_component.rb
Normal file
|
@ -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
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
fr:
|
||||||
|
btn_collapse_text: In this section
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
fr:
|
||||||
|
btn_collapse_text: Dans cette rubrique
|
|
@ -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"
|
|
@ -6,7 +6,7 @@ module Experts
|
||||||
before_action :authenticate_expert!, except: [:sign_up, :update_expert]
|
before_action :authenticate_expert!, except: [:sign_up, :update_expert]
|
||||||
before_action :check_if_avis_revoked, except: [:index, :procedure]
|
before_action :check_if_avis_revoked, except: [:index, :procedure]
|
||||||
before_action :redirect_if_no_sign_up_needed, only: [:sign_up, :update_expert]
|
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, :avis_new, :messagerie, :create_commentaire, :delete_commentaire, :update, :telecharger_pjs]
|
||||||
|
|
||||||
A_DONNER_STATUS = 'a-donner'
|
A_DONNER_STATUS = 'a-donner'
|
||||||
DONNES_STATUS = 'donnes'
|
DONNES_STATUS = 'donnes'
|
||||||
|
@ -56,6 +56,13 @@ module Experts
|
||||||
@new_avis = Avis.new
|
@new_avis = Avis.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def avis_list
|
||||||
|
end
|
||||||
|
|
||||||
|
def avis_new
|
||||||
|
@new_avis = Avis.new
|
||||||
|
end
|
||||||
|
|
||||||
def create_avis
|
def create_avis
|
||||||
@procedure = Procedure.find(params[:procedure_id])
|
@procedure = Procedure.find(params[:procedure_id])
|
||||||
@new_avis = create_avis_from_params(avis.dossier, current_expert, avis.confidentiel)
|
@new_avis = create_avis_from_params(avis.dossier, current_expert, avis.confidentiel)
|
||||||
|
@ -135,7 +142,7 @@ module Experts
|
||||||
extension = params[:format]
|
extension = params[:format]
|
||||||
render extension.to_sym => avis.dossier.etablissement.entreprise_bilans_bdf_to_sheet(extension)
|
render extension.to_sym => avis.dossier.etablissement.entreprise_bilans_bdf_to_sheet(extension)
|
||||||
else
|
else
|
||||||
redirect_to instructeur_avis_path(avis)
|
redirect_to expert_avis_path(avis)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,14 @@ module Instructeurs
|
||||||
end
|
end
|
||||||
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
|
def personnes_impliquees
|
||||||
@following_instructeurs_emails = dossier.followers_instructeurs.map(&:email)
|
@following_instructeurs_emails = dossier.followers_instructeurs.map(&:email)
|
||||||
previous_followers = dossier.previous_followers_instructeurs - dossier.followers_instructeurs
|
previous_followers = dossier.previous_followers_instructeurs - dossier.followers_instructeurs
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
@import '@gouvfr/dsfr/dist/component/header/header.css';
|
@import '@gouvfr/dsfr/dist/component/header/header.css';
|
||||||
@import '@gouvfr/dsfr/dist/component/footer/footer.css';
|
@import '@gouvfr/dsfr/dist/component/footer/footer.css';
|
||||||
@import '@gouvfr/dsfr/dist/component/search/search.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/translate/translate.css';
|
||||||
@import '@gouvfr/dsfr/dist/component/pagination/pagination.css';
|
@import '@gouvfr/dsfr/dist/component/pagination/pagination.css';
|
||||||
@import '@gouvfr/dsfr/dist/component/skiplink/skiplink.css';
|
@import '@gouvfr/dsfr/dist/component/skiplink/skiplink.css';
|
||||||
|
|
|
@ -212,7 +212,7 @@ def add_avis(pdf, avis)
|
||||||
format_in_2_lines(pdf, "Avis de #{avis.email_to_display}#{avis.confidentiel? ? ' (confidentiel)' : ''}",
|
format_in_2_lines(pdf, "Avis de #{avis.email_to_display}#{avis.confidentiel? ? ' (confidentiel)' : ''}",
|
||||||
avis.answer || 'En attente de réponse')
|
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'))
|
format_in_2_columns(pdf, "Réponse oui/non ", t("question_answer.#{avis.question_answer}", scope: 'helpers.label'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,5 +18,5 @@
|
||||||
%nav.tabs
|
%nav.tabs
|
||||||
%ul
|
%ul
|
||||||
= dynamic_tab_item('Demande', expert_avis_path(avis.procedure, avis))
|
= 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), avis_new_expert_avis_path(avis.procedure, avis)], notification: avis.answer.blank?)
|
||||||
= dynamic_tab_item('Messagerie', messagerie_expert_avis_path(avis.procedure, avis))
|
= dynamic_tab_item('Messagerie', messagerie_expert_avis_path(avis.procedure, avis))
|
||||||
|
|
2
app/views/experts/avis/_sidemenu.html.haml
Normal file
2
app/views/experts/avis/_sidemenu.html.haml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
= 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) }])
|
17
app/views/experts/avis/avis_list.html.haml
Normal file
17
app/views/experts/avis/avis_list.html.haml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
- 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 }
|
||||||
|
|
||||||
|
- else
|
||||||
|
%h2.empty-text
|
||||||
|
= t('helpers.information_text.empty_text')
|
||||||
|
%p.empty-text-details
|
||||||
|
= t('helpers.information_text.empty_text_detail')
|
16
app/views/experts/avis/avis_new.html.haml
Normal file
16
app/views/experts/avis/avis_new.html.haml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
- 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 }
|
||||||
|
- 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')
|
|
@ -13,12 +13,12 @@
|
||||||
.procedure-details
|
.procedure-details
|
||||||
%p.fr-mb-2w
|
%p.fr-mb-2w
|
||||||
= procedure_badge(p)
|
= 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
|
%ul.procedure-stats.flex
|
||||||
%li
|
%li
|
||||||
%object
|
%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
|
- without_answer_count = procedure_avis.select { |a| a.answer.nil? }.size
|
||||||
- if without_answer_count > 0
|
- if without_answer_count > 0
|
||||||
%span.notifications{ 'aria-label': "notifications" }
|
%span.notifications{ 'aria-label': "notifications" }
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
avis à donner
|
avis à donner
|
||||||
%li
|
%li
|
||||||
%object
|
%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
|
- with_answer_count = procedure_avis.select { |a| a.answer.present? }.size
|
||||||
.stats-number= with_answer_count
|
.stats-number= with_answer_count
|
||||||
.stats-legend
|
.stats-legend
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
|
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
|
||||||
|
|
||||||
.container
|
.container
|
||||||
|
.fr-grid-row
|
||||||
|
.fr-col.fr-col-12.fr-col-md-3
|
||||||
|
= render partial: 'sidemenu'
|
||||||
|
.fr-col
|
||||||
|
- if !@dossier.termine?
|
||||||
%section.give-avis
|
%section.give-avis
|
||||||
%h1.tab-title Donner votre avis
|
%h1.tab-title Donner votre avis
|
||||||
%h2.claimant
|
%h2.claimant
|
||||||
|
@ -49,9 +54,8 @@
|
||||||
Cet avis est partagé avec les autres experts
|
Cet avis est partagé avec les autres experts
|
||||||
.send-wrapper
|
.send-wrapper
|
||||||
= f.submit 'Envoyer votre avis', class: 'fr-btn'
|
= f.submit 'Envoyer votre avis', class: 'fr-btn'
|
||||||
|
- else
|
||||||
- if !@dossier.termine?
|
%h2.empty-text
|
||||||
= 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 }
|
= t('helpers.information_text.no_new_avis_text')
|
||||||
|
%p.empty-text-details
|
||||||
- if @dossier.avis_for_expert(current_expert).present?
|
= t('helpers.information_text.no_new_avis_text_detail')
|
||||||
= render partial: 'experts/avis/shared/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil }
|
|
||||||
|
|
|
@ -36,11 +36,11 @@
|
||||||
- @avis.each do |avis|
|
- @avis.each do |avis|
|
||||||
%tr
|
%tr
|
||||||
%td.number-col
|
%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
|
%span.icon.folder
|
||||||
#{avis.dossier.id}
|
#{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.dossier.user_email_for(:display), expert_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.procedure.libelle, expert_avis_path(avis.procedure, avis), class: 'cell-link')
|
||||||
= paginate(@avis)
|
= paginate(@avis)
|
||||||
- else
|
- else
|
||||||
%h2.empty-text Aucun avis
|
%h2.empty-text Aucun avis
|
||||||
|
|
|
@ -37,6 +37,6 @@
|
||||||
- if avis.piece_justificative_file.attached?
|
- if avis.piece_justificative_file.attached?
|
||||||
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
|
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
|
||||||
.answer-body
|
.answer-body
|
||||||
- if avis.question_answer
|
- if [true, false].include? avis.question_answer
|
||||||
%p= t("question_answer.#{avis.question_answer}", scope: 'helpers.label')
|
%p= t("question_answer.#{avis.question_answer}", scope: 'helpers.label')
|
||||||
= render SimpleFormatComponent.new(avis.answer, allow_a: false)
|
= render SimpleFormatComponent.new(avis.answer, allow_a: false)
|
||||||
|
|
|
@ -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))
|
|
|
@ -53,7 +53,7 @@
|
||||||
- if avis.piece_justificative_file.attached?
|
- if avis.piece_justificative_file.attached?
|
||||||
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
|
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
|
||||||
.answer-body
|
.answer-body
|
||||||
- if avis.question_answer
|
- if [true, false].include? avis.question_answer
|
||||||
%p= t("question_answer.#{avis.question_answer}", scope: 'helpers.label')
|
%p= t("question_answer.#{avis.question_answer}", scope: 'helpers.label')
|
||||||
|
|
||||||
= render SimpleFormatComponent.new(avis.answer, allow_a: false)
|
= render SimpleFormatComponent.new(avis.answer, allow_a: false)
|
2
app/views/instructeurs/avis/_sidemenu.html.haml
Normal file
2
app/views/instructeurs/avis/_sidemenu.html.haml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
= 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) }])
|
|
@ -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
|
|
|
@ -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) }
|
|
|
@ -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
|
|
|
@ -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' }
|
|
|
@ -12,7 +12,8 @@
|
||||||
notification: notifications_summary[:annotations_privees])
|
notification: notifications_summary[:annotations_privees])
|
||||||
|
|
||||||
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.external_opinion'),
|
= 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])
|
notification: notifications_summary[:avis])
|
||||||
|
|
||||||
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.messaging'),
|
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.messaging'),
|
||||||
|
|
|
@ -3,16 +3,15 @@
|
||||||
= render partial: "header", locals: { dossier: @dossier }
|
= render partial: "header", locals: { dossier: @dossier }
|
||||||
|
|
||||||
.container
|
.container
|
||||||
- if !@dossier.termine?
|
.fr-grid-row
|
||||||
- if @dossier.procedure.allow_expert_review
|
.fr-col.fr-col-12.fr-col-md-3
|
||||||
= 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/sidemenu'
|
||||||
- else
|
.fr-col
|
||||||
%p Cette démarche n’autorise pas la demande d’avis à un expert. Veuillez contacter votre administrateur
|
|
||||||
|
|
||||||
- if @dossier.avis.present?
|
- 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 }
|
||||||
|
|
||||||
- if @dossier.termine? && !@dossier.avis.present?
|
- else
|
||||||
.blank-tab
|
%h2.empty-text
|
||||||
%h2.empty-text Aucun avis.
|
= t('helpers.information_text.empty_text')
|
||||||
%p.empty-text-details Aucun avis n’a été demandé sur ce dossier.
|
%p.empty-text-details
|
||||||
|
= t('helpers.information_text.empty_text_detail')
|
||||||
|
|
22
app/views/instructeurs/dossiers/avis_new.html.haml
Normal file
22
app/views/instructeurs/dossiers/avis_new.html.haml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
- content_for(:title, "Avis · Dossier nº #{@dossier.id} (#{@dossier.owner_name})")
|
||||||
|
|
||||||
|
= render partial: "header", locals: { dossier: @dossier }
|
||||||
|
|
||||||
|
.container
|
||||||
|
.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/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
|
||||||
|
%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')
|
|
@ -26,3 +26,15 @@ en:
|
||||||
confirmation:
|
confirmation:
|
||||||
revoke: "Would you like to revoke the opinion request to %{email} ?"
|
revoke: "Would you like to revoke the opinion request to %{email} ?"
|
||||||
remind: "Would you like to remind %{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
|
||||||
|
|
|
@ -26,3 +26,15 @@ fr:
|
||||||
confirmation:
|
confirmation:
|
||||||
revoke: "Souhaitez-vous révoquer la demande d’avis à %{email} ?"
|
revoke: "Souhaitez-vous révoquer la demande d’avis à %{email} ?"
|
||||||
remind: "Souhaitez-vous relancer %{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.
|
||||||
|
|
|
@ -357,6 +357,8 @@ Rails.application.routes.draw do
|
||||||
get '', action: 'procedure', on: :collection, as: :procedure
|
get '', action: 'procedure', on: :collection, as: :procedure
|
||||||
member do
|
member do
|
||||||
get 'instruction'
|
get 'instruction'
|
||||||
|
get 'avis_list'
|
||||||
|
get 'avis_new'
|
||||||
get 'messagerie'
|
get 'messagerie'
|
||||||
post 'commentaire' => 'avis#create_commentaire'
|
post 'commentaire' => 'avis#create_commentaire'
|
||||||
post 'avis' => 'avis#create_avis'
|
post 'avis' => 'avis#create_avis'
|
||||||
|
@ -392,8 +394,7 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :avis, only: [:show, :update] do
|
resources :avis, only: [] do
|
||||||
get '', action: 'procedure', on: :collection, as: :procedure
|
|
||||||
member do
|
member do
|
||||||
patch 'revoquer'
|
patch 'revoquer'
|
||||||
get 'remind'
|
get 'remind'
|
||||||
|
@ -426,6 +427,7 @@ Rails.application.routes.draw do
|
||||||
get 'messagerie'
|
get 'messagerie'
|
||||||
get 'annotations-privees' => 'dossiers#annotations_privees'
|
get 'annotations-privees' => 'dossiers#annotations_privees'
|
||||||
get 'avis'
|
get 'avis'
|
||||||
|
get 'avis_new'
|
||||||
get 'personnes-impliquees' => 'dossiers#personnes_impliquees'
|
get 'personnes-impliquees' => 'dossiers#personnes_impliquees'
|
||||||
patch 'follow'
|
patch 'follow'
|
||||||
patch 'unfollow'
|
patch 'unfollow'
|
||||||
|
|
|
@ -82,7 +82,7 @@ describe Experts::AvisController, type: :controller do
|
||||||
|
|
||||||
before { get :bilans_bdf, params: { id: avis, procedure_id: } }
|
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
|
context 'with a revoked avis' do
|
||||||
let(:avis) { revoked_avis }
|
let(:avis) { revoked_avis }
|
||||||
|
|
|
@ -110,6 +110,10 @@ describe 'Inviting an expert:' do
|
||||||
expect(page).to have_content('Ma réponse d’expert.')
|
expect(page).to have_content('Ma réponse d’expert.')
|
||||||
expect(page).to have_content('non')
|
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' }
|
within('.breadcrumbs') { click_on 'Avis' }
|
||||||
expect(page).to have_text('1 avis donné')
|
expect(page).to have_text('1 avis donné')
|
||||||
end
|
end
|
||||||
|
@ -189,6 +193,7 @@ describe 'Inviting an expert:' do
|
||||||
click_on avis_1.dossier.user.email
|
click_on avis_1.dossier.user.email
|
||||||
within('.tabs') { click_on 'Avis' }
|
within('.tabs') { click_on 'Avis' }
|
||||||
expect(page).to have_text("Demandeur : #{avis_1.claimant.email}")
|
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("Vous")
|
||||||
expect(page).to have_text(avis_2.expert.email.to_s)
|
expect(page).to have_text(avis_2.expert.email.to_s)
|
||||||
end
|
end
|
||||||
|
@ -204,6 +209,7 @@ describe 'Inviting an expert:' do
|
||||||
click_on avis_2.dossier.user.email
|
click_on avis_2.dossier.user.email
|
||||||
within('.tabs') { click_on 'Avis' }
|
within('.tabs') { click_on 'Avis' }
|
||||||
expect(page).to have_text("Demandeur : #{avis_2.claimant.email}")
|
expect(page).to have_text("Demandeur : #{avis_2.claimant.email}")
|
||||||
|
click_on 'Voir les avis'
|
||||||
expect(page).to have_text("Vous")
|
expect(page).to have_text("Vous")
|
||||||
expect(page).not_to have_text(avis_1.expert.email.to_s)
|
expect(page).not_to have_text(avis_1.expert.email.to_s)
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,13 +26,15 @@ describe 'Inviting an expert:', js: true do
|
||||||
|
|
||||||
click_on 'Avis externes'
|
click_on 'Avis externes'
|
||||||
expect(page).to have_current_path(avis_instructeur_dossier_path(procedure, dossier))
|
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}\"]'")
|
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.'
|
fill_in 'avis_introduction', with: 'Bonjour, merci de me donner votre avis sur ce dossier.'
|
||||||
check 'avis_invite_linked_dossiers'
|
check 'avis_invite_linked_dossiers'
|
||||||
page.select 'confidentiel', from: 'avis_confidentiel'
|
page.select 'confidentiel', from: 'avis_confidentiel'
|
||||||
|
|
||||||
click_on 'Demander un avis'
|
within('form#new_avis') { click_on 'Demander un avis' }
|
||||||
perform_enqueued_jobs
|
perform_enqueued_jobs
|
||||||
|
|
||||||
expect(page).to have_content('Une demande d’avis a été envoyée')
|
expect(page).to have_content('Une demande d’avis a été envoyée')
|
||||||
|
|
|
@ -139,6 +139,8 @@ describe 'Instructing a dossier:', js: true do
|
||||||
|
|
||||||
click_on 'Avis externes'
|
click_on 'Avis externes'
|
||||||
expect(page).to have_current_path(avis_instructeur_dossier_path(procedure, dossier))
|
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_formated = "[\"expert@tps.com\"]"
|
||||||
expert_email = '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}'")
|
page.execute_script("document.querySelector('#avis_emails').value = '#{to}'")
|
||||||
fill_in 'avis_introduction', with: introduction
|
fill_in 'avis_introduction', with: introduction
|
||||||
select 'confidentiel', from: 'avis_confidentiel'
|
select 'confidentiel', from: 'avis_confidentiel'
|
||||||
|
within('form#new_avis') { click_on 'Demander un avis' }
|
||||||
click_on 'Demander un avis'
|
click_on 'Demander un avis'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -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 }
|
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(:instructeur) { create(:instructeur) }
|
||||||
let(:instructeur2) { create(:instructeur) }
|
let(:instructeur2) { create(:instructeur) }
|
Loading…
Add table
Reference in a new issue