[Fix #762] split annotations and avis

This commit is contained in:
Simon Lehericey 2017-09-26 14:38:16 +02:00
parent 87293b29ad
commit a421f0257e
6 changed files with 32 additions and 19 deletions

View file

@ -19,6 +19,11 @@ module NewGestionnaire
dossier.notifications.instruction.mark_as_read dossier.notifications.instruction.mark_as_read
end end
def avis
@dossier = dossier
dossier.notifications.instruction.mark_as_read
end
def follow def follow
current_gestionnaire.follow(dossier) current_gestionnaire.follow(dossier)
dossier.next_step!('gestionnaire', 'follow') dossier.next_step!('gestionnaire', 'follow')
@ -67,7 +72,7 @@ module NewGestionnaire
def create_avis def create_avis
Avis.create(avis_params.merge(claimant: current_gestionnaire, dossier: dossier)) 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 end
def update_annotations def update_annotations

View file

@ -16,9 +16,11 @@
%span.notifications{ 'aria-label': 'notifications' } %span.notifications{ 'aria-label': 'notifications' }
= link_to "Demande", dossier_path(dossier.procedure, dossier) = link_to "Demande", dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(instruction_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } %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] - if notifications_summary[:instruction]
%span.notifications{ 'aria-label': 'notifications' } %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 } %li{ class: current_page?(messagerie_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
- if notifications_summary[:messagerie] - if notifications_summary[:messagerie]
%span.notifications{ 'aria-label': 'notifications' } %span.notifications{ 'aria-label': 'notifications' }

View 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 }

View file

@ -1,22 +1,6 @@
= render partial: "header", locals: { dossier: @dossier } = render partial: "header", locals: { dossier: @dossier }
#dossier-instruction.container #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? - if @dossier.ordered_champs_private.present?
%section %section
%h1.private-annotations Annotations privées %h1.private-annotations Annotations privées
@ -29,3 +13,6 @@
.send-wrapper .send-wrapper
= f.submit 'Sauvegarder', class: 'button send' = f.submit 'Sauvegarder', class: 'button send'
- else
%h2.empty-text Aucune annotation privée

View file

@ -244,6 +244,7 @@ Rails.application.routes.draw do
get 'attestation' get 'attestation'
get 'messagerie' get 'messagerie'
get 'instruction' get 'instruction'
get 'avis'
patch 'follow' patch 'follow'
patch 'unfollow' patch 'unfollow'
patch 'archive' patch 'archive'

View file

@ -133,7 +133,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
it { expect(saved_avis.confidentiel).to eq(true) } it { expect(saved_avis.confidentiel).to eq(true) }
it { expect(saved_avis.dossier).to eq(dossier) } it { expect(saved_avis.dossier).to eq(dossier) }
it { expect(saved_avis.claimant).to eq(gestionnaire) } 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 end
describe "#update_annotations" do describe "#update_annotations" do