Add DossiersController#repasser_en_construction
This commit is contained in:
parent
eb55dfc0c8
commit
a5b4b20a7d
4 changed files with 27 additions and 1 deletions
|
@ -60,6 +60,13 @@ module NewGestionnaire
|
|||
redirect_to dossier_path(procedure, dossier)
|
||||
end
|
||||
|
||||
def repasser_en_construction
|
||||
dossier.initiated!
|
||||
flash.notice = 'Dossier repassé en construction.'
|
||||
|
||||
redirect_to dossier_path(procedure, dossier)
|
||||
end
|
||||
|
||||
def create_commentaire
|
||||
commentaire_hash = commentaire_params.merge(email: current_gestionnaire.email, dossier: dossier)
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
- if dossier.en_instruction?
|
||||
%li
|
||||
= link_to backoffice_dossier_reopen_path(dossier, new_ui: true), method: :post, data: { confirm: "Confirmer vous la réouverture de ce dossier ?" } do
|
||||
= link_to repasser_en_construction_dossier_path(dossier.procedure, dossier), method: :post, data: { confirm: "Confirmer vous le passage en construction de ce dossier ?" } do
|
||||
.icon.edit
|
||||
.description
|
||||
%h4 Repasser en construction
|
||||
|
|
|
@ -255,6 +255,7 @@ Rails.application.routes.draw do
|
|||
patch 'annotations' => 'dossiers#update_annotations'
|
||||
post 'commentaire' => 'dossiers#create_commentaire'
|
||||
post 'passer-en-instruction' => 'dossiers#passer_en_instruction'
|
||||
post 'repasser-en-construction' => 'dossiers#repasser_en_construction'
|
||||
scope :carte do
|
||||
get 'position'
|
||||
end
|
||||
|
|
|
@ -90,6 +90,24 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
it { expect(gestionnaire.follow?(dossier)).to be true }
|
||||
end
|
||||
|
||||
describe '#repasser_en_construction' do
|
||||
before do
|
||||
dossier.received!
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
subject { post :repasser_en_construction, params: { procedure_id: procedure.id, dossier_id: dossier.id} }
|
||||
|
||||
it 'change state to initiated' do
|
||||
subject
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('initiated')
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to dossier_path(procedure, dossier) }
|
||||
end
|
||||
|
||||
describe '#show #messagerie #annotations_privees #avis' do
|
||||
before do
|
||||
dossier.notifications = %w(champs annotations_privees avis commentaire).map{ |type| Notification.create!(type_notif: type) }
|
||||
|
|
Loading…
Reference in a new issue