routes: nest ExpertsProcedures routes in a resource
This commit is contained in:
parent
586028d064
commit
3f25624a5a
3 changed files with 7 additions and 4 deletions
|
@ -33,7 +33,7 @@ module NewAdministrateur
|
|||
end
|
||||
|
||||
def revoke_expert_from_procedure
|
||||
expert_procedure = ExpertsProcedure.find_by!(procedure: @procedure, id: params[:expert_procedure][:id])
|
||||
expert_procedure = ExpertsProcedure.find_by!(procedure: @procedure, id: params[:id])
|
||||
expert_email = expert_procedure.expert.email
|
||||
expert_procedure.update!(revoked_at: Time.zone.now)
|
||||
flash[:notice] = "#{expert_email} a été révoqué de la démarche et ne pourra plus déposer d'avis."
|
||||
|
|
|
@ -408,8 +408,6 @@ Rails.application.routes.draw do
|
|||
post 'transfer' => 'procedures#transfer', as: :transfer
|
||||
get 'invited_expert_list'
|
||||
put 'update_allow_decision_access' => 'procedures#update_allow_decision_access', as: :update_allow_decision_access
|
||||
post 'add_expert_to_procedure' => 'experts_procedures#add_expert_to_procedure', as: :add_expert_to_procedure
|
||||
put 'revoke_expert_from_procedure' => 'experts_procedures#revoke_expert_from_procedure', as: :revoke_expert_from_procedure
|
||||
resources :mail_templates, only: [:edit, :update]
|
||||
|
||||
resources :groupe_instructeurs, only: [:index, :show, :create, :update, :destroy] do
|
||||
|
@ -427,6 +425,11 @@ Rails.application.routes.draw do
|
|||
|
||||
resources :administrateurs, controller: 'procedure_administrateurs', only: [:index, :create, :destroy]
|
||||
|
||||
resources :experts, controller: 'experts_procedures', only: [] do
|
||||
post :add_expert_to_procedure, on: :collection
|
||||
delete :revoke_expert_from_procedure, on: :member
|
||||
end
|
||||
|
||||
resources :types_de_champ, only: [:create, :update, :destroy] do
|
||||
member do
|
||||
patch :move
|
||||
|
|
|
@ -32,7 +32,7 @@ describe NewAdministrateur::ExpertsProceduresController, type: :controller do
|
|||
let(:expert_procedure) { ExpertsProcedure.create(expert: expert, procedure: procedure) }
|
||||
|
||||
subject do
|
||||
put :revoke_expert_from_procedure, params: { procedure_id: procedure.id, expert_procedure: { id: expert_procedure.id } }
|
||||
delete :revoke_expert_from_procedure, params: { procedure_id: procedure.id, id: expert_procedure.id }
|
||||
end
|
||||
|
||||
before do
|
||||
|
|
Loading…
Reference in a new issue