[Fix #762] split annotations and avis
This commit is contained in:
parent
87293b29ad
commit
a421f0257e
6 changed files with 32 additions and 19 deletions
|
@ -19,6 +19,11 @@ module NewGestionnaire
|
|||
dossier.notifications.instruction.mark_as_read
|
||||
end
|
||||
|
||||
def avis
|
||||
@dossier = dossier
|
||||
dossier.notifications.instruction.mark_as_read
|
||||
end
|
||||
|
||||
def follow
|
||||
current_gestionnaire.follow(dossier)
|
||||
dossier.next_step!('gestionnaire', 'follow')
|
||||
|
@ -67,7 +72,7 @@ module NewGestionnaire
|
|||
|
||||
def create_avis
|
||||
Avis.create(avis_params.merge(claimant: current_gestionnaire, dossier: dossier))
|
||||
redirect_to instruction_dossier_path(dossier.procedure, dossier)
|
||||
redirect_to avis_dossier_path(dossier.procedure, dossier)
|
||||
end
|
||||
|
||||
def update_annotations
|
||||
|
|
|
@ -16,9 +16,11 @@
|
|||
%span.notifications{ 'aria-label': 'notifications' }
|
||||
= link_to "Demande", dossier_path(dossier.procedure, dossier)
|
||||
%li{ class: current_page?(instruction_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
|
||||
= link_to "Annotations Privées", instruction_dossier_path(dossier.procedure, dossier)
|
||||
%li{ class: current_page?(avis_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
|
||||
- if notifications_summary[:instruction]
|
||||
%span.notifications{ 'aria-label': 'notifications' }
|
||||
= link_to "Instruction", instruction_dossier_path(dossier.procedure, dossier)
|
||||
= link_to "Avis Externes", avis_dossier_path(dossier.procedure, dossier)
|
||||
%li{ class: current_page?(messagerie_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
|
||||
- if notifications_summary[:messagerie]
|
||||
%span.notifications{ 'aria-label': 'notifications' }
|
||||
|
|
18
app/views/new_gestionnaire/dossiers/avis.html.haml
Normal file
18
app/views/new_gestionnaire/dossiers/avis.html.haml
Normal file
|
@ -0,0 +1,18 @@
|
|||
= render partial: "header", locals: { dossier: @dossier }
|
||||
|
||||
.container
|
||||
%section.ask-avis
|
||||
%h1 Inviter une personne à donner son avis
|
||||
%p.avis-notice L'invité pourra consulter, donner un avis sur le dossier et contribuer au fil de messagerie, mais il ne pourra le modifier.
|
||||
|
||||
= form_for Avis.new, url: avis_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f|
|
||||
= f.email_field :email, placeholder: 'Adresse email', required: true
|
||||
= f.text_area :introduction, rows: 3, value: 'Bonjour, merci de me donner votre avis sur ce dossier.', required: true
|
||||
.flex.justify-between.align-baseline
|
||||
.confidentiel-wrapper
|
||||
= f.label :confidentiel, 'Cet avis est'
|
||||
= f.select :confidentiel, [['partagé avec les autres experts', false], ['confidentiel', true]]
|
||||
.send-wrapper
|
||||
= f.submit 'Demander un avis', class: 'button send'
|
||||
|
||||
= render partial: 'new_gestionnaire/avis/avis_list', locals: { avis: @dossier.avis }
|
|
@ -1,22 +1,6 @@
|
|||
= render partial: "header", locals: { dossier: @dossier }
|
||||
|
||||
#dossier-instruction.container
|
||||
%section.ask-avis
|
||||
%h1 Inviter une personne à donner son avis
|
||||
%p.avis-notice L'invité pourra consulter, donner un avis sur le dossier et contribuer au fil de messagerie, mais il ne pourra le modifier.
|
||||
|
||||
= form_for Avis.new, url: avis_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f|
|
||||
= f.email_field :email, placeholder: 'Adresse email', required: true
|
||||
= f.text_area :introduction, rows: 3, value: 'Bonjour, merci de me donner votre avis sur ce dossier.', required: true
|
||||
.flex.justify-between.align-baseline
|
||||
.confidentiel-wrapper
|
||||
= f.label :confidentiel, 'Cet avis est'
|
||||
= f.select :confidentiel, [['partagé avec les autres experts', false], ['confidentiel', true]]
|
||||
.send-wrapper
|
||||
= f.submit 'Demander un avis', class: 'button send'
|
||||
|
||||
= render partial: 'new_gestionnaire/avis/avis_list', locals: { avis: @dossier.avis }
|
||||
|
||||
- if @dossier.ordered_champs_private.present?
|
||||
%section
|
||||
%h1.private-annotations Annotations privées
|
||||
|
@ -29,3 +13,6 @@
|
|||
|
||||
.send-wrapper
|
||||
= f.submit 'Sauvegarder', class: 'button send'
|
||||
|
||||
- else
|
||||
%h2.empty-text Aucune annotation privée
|
||||
|
|
|
@ -244,6 +244,7 @@ Rails.application.routes.draw do
|
|||
get 'attestation'
|
||||
get 'messagerie'
|
||||
get 'instruction'
|
||||
get 'avis'
|
||||
patch 'follow'
|
||||
patch 'unfollow'
|
||||
patch 'archive'
|
||||
|
|
|
@ -133,7 +133,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
it { expect(saved_avis.confidentiel).to eq(true) }
|
||||
it { expect(saved_avis.dossier).to eq(dossier) }
|
||||
it { expect(saved_avis.claimant).to eq(gestionnaire) }
|
||||
it { expect(response).to redirect_to(instruction_dossier_path(dossier.procedure, dossier)) }
|
||||
it { expect(response).to redirect_to(avis_dossier_path(dossier.procedure, dossier)) }
|
||||
end
|
||||
|
||||
describe "#update_annotations" do
|
||||
|
|
Loading…
Reference in a new issue