Dossier instruction: can ask for a confidentiel avis
This commit is contained in:
parent
caaa3169e5
commit
3c3e303a59
3 changed files with 11 additions and 4 deletions
|
@ -87,7 +87,7 @@ module NewGestionnaire
|
||||||
end
|
end
|
||||||
|
|
||||||
def avis_params
|
def avis_params
|
||||||
params.require(:avis).permit(:email, :introduction)
|
params.require(:avis).permit(:email, :introduction, :confidentiel)
|
||||||
end
|
end
|
||||||
|
|
||||||
def champs_private_params
|
def champs_private_params
|
||||||
|
|
|
@ -8,8 +8,12 @@
|
||||||
= form_for Avis.new, url: avis_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f|
|
= 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.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
|
= f.text_area :introduction, rows: 3, value: 'Bonjour, merci de me donner votre avis sur ce dossier.', required: true
|
||||||
.send-wrapper
|
.flex.justify-between.align-baseline
|
||||||
= f.submit 'Demander un avis', class: 'button send'
|
.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 }
|
= render partial: 'new_gestionnaire/avis/avis_list', locals: { avis: @dossier.avis }
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe NewGestionnaire::DossiersController, type: :controller do
|
describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
|
render_views
|
||||||
|
|
||||||
let(:gestionnaire) { create(:gestionnaire) }
|
let(:gestionnaire) { create(:gestionnaire) }
|
||||||
let(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
|
let(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
|
||||||
let(:dossier) { create(:dossier, :replied, procedure: procedure) }
|
let(:dossier) { create(:dossier, :replied, procedure: procedure) }
|
||||||
|
@ -122,12 +124,13 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
post :create_avis, params: {
|
post :create_avis, params: {
|
||||||
procedure_id: procedure.id,
|
procedure_id: procedure.id,
|
||||||
dossier_id: dossier.id,
|
dossier_id: dossier.id,
|
||||||
avis: { email: 'email@a.com', introduction: 'intro' }
|
avis: { email: 'email@a.com', introduction: 'intro', confidentiel: true }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(saved_avis.email).to eq('email@a.com') }
|
it { expect(saved_avis.email).to eq('email@a.com') }
|
||||||
it { expect(saved_avis.introduction).to eq('intro') }
|
it { expect(saved_avis.introduction).to eq('intro') }
|
||||||
|
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(instruction_dossier_path(dossier.procedure, dossier)) }
|
||||||
|
|
Loading…
Reference in a new issue