Update routing critéria name
This commit is contained in:
parent
d136d023cd
commit
35bba62297
4 changed files with 38 additions and 0 deletions
|
@ -80,6 +80,13 @@ module NewAdministrateur
|
|||
redirect_to procedure_groupe_instructeur_path(procedure, groupe_instructeur)
|
||||
end
|
||||
|
||||
def update_routing_criteria_name
|
||||
procedure.update!(routing_criteria_name: routing_criteria_name)
|
||||
|
||||
redirect_to procedure_groupe_instructeurs_path(procedure),
|
||||
notice: "Le libellé est maintenant « #{procedure.routing_criteria_name} »."
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_instructeur(email)
|
||||
|
@ -130,5 +137,9 @@ module NewAdministrateur
|
|||
.per(ITEMS_PER_PAGE)
|
||||
.order(:email)
|
||||
end
|
||||
|
||||
def routing_criteria_name
|
||||
params[:procedure][:routing_criteria_name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,17 @@
|
|||
'Groupes d’instructeurs'] }
|
||||
|
||||
.container.groupe-instructeur
|
||||
.card
|
||||
= form_for @procedure,
|
||||
url: { action: :update_routing_criteria_name },
|
||||
html: { class: 'form' } do |f|
|
||||
|
||||
= f.label :routing_criteria_name do
|
||||
Libellé du routage
|
||||
%span.notice Ce texte apparaitra sur le formulaire usager comme le libellé d'une liste
|
||||
= f.text_field :routing_criteria_name, placeholder: 'Votre ville', required: true
|
||||
= f.submit 'Renommer', class: 'button primary send'
|
||||
|
||||
.card
|
||||
.card-title Gestion des Groupes
|
||||
|
||||
|
|
|
@ -355,6 +355,10 @@ Rails.application.routes.draw do
|
|||
post 'add_instructeur'
|
||||
delete 'remove_instructeur'
|
||||
end
|
||||
|
||||
collection do
|
||||
patch 'update_routing_criteria_name'
|
||||
end
|
||||
end
|
||||
|
||||
resources :administrateurs, controller: 'procedure_administrateurs', only: [:index, :create, :destroy]
|
||||
|
|
|
@ -147,4 +147,16 @@ describe NewAdministrateur::GroupeInstructeursController, type: :controller do
|
|||
it { expect(response).to redirect_to(procedure_groupe_instructeur_path(procedure, gi_1_1)) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#update_routing_criteria_name' do
|
||||
before do
|
||||
patch :update_routing_criteria_name,
|
||||
params: {
|
||||
procedure_id: procedure.id,
|
||||
procedure: { routing_criteria_name: 'new name !' }
|
||||
}
|
||||
end
|
||||
|
||||
it { expect(procedure.reload.routing_criteria_name).to eq('new name !') }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue