Merge branch 'develop' into staging
This commit is contained in:
commit
ed4b1efa3c
5 changed files with 27 additions and 1 deletions
|
@ -19,6 +19,7 @@ class Admin::AccompagnateursController < AdminController
|
||||||
partial: "admin/accompagnateurs/list_not_assign",
|
partial: "admin/accompagnateurs/list_not_assign",
|
||||||
array: true
|
array: true
|
||||||
|
|
||||||
|
@gestionnaire ||= Gestionnaire.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
|
@ -13,6 +13,7 @@ class Admin::GestionnairesController < AdminController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@gestionnaire = Gestionnaire.find_by_email(params[:gestionnaire][:email])
|
@gestionnaire = Gestionnaire.find_by_email(params[:gestionnaire][:email])
|
||||||
|
procedure_id = params[:procedure_id]
|
||||||
|
|
||||||
if @gestionnaire.nil?
|
if @gestionnaire.nil?
|
||||||
new_gestionnaire!
|
new_gestionnaire!
|
||||||
|
@ -20,6 +21,7 @@ class Admin::GestionnairesController < AdminController
|
||||||
assign_gestionnaire!
|
assign_gestionnaire!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return redirect_to admin_procedure_accompagnateurs_path(procedure_id: procedure_id) unless procedure_id.nil?
|
||||||
redirect_to admin_gestionnaires_path
|
redirect_to admin_gestionnaires_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,19 @@
|
||||||
%h3.text-info Disponibles
|
%h3.text-info Disponibles
|
||||||
= smart_listing_render :accompagnateurs_not_assign
|
= smart_listing_render :accompagnateurs_not_assign
|
||||||
|
|
||||||
|
%br
|
||||||
|
%h3 Ajouter un accompagnateur
|
||||||
|
#procedure_new.section.section-label
|
||||||
|
= form_for @gestionnaire, url: {controller: 'admin/gestionnaires', action: :create} do |f|
|
||||||
|
.row
|
||||||
|
.col-md-5.col-lg-5
|
||||||
|
= hidden_field_tag :procedure_id, params[:procedure_id]
|
||||||
|
=render partial: 'admin/gestionnaires/informations', locals: {f: f}
|
||||||
|
.col-md-2.col-lg-2
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
=f.submit 'Valider', class: 'btn btn-info', style: 'float:left'
|
||||||
|
|
||||||
.col-md-6.col-lg-6
|
.col-md-6.col-lg-6
|
||||||
%h3.text-success Affectés
|
%h3.text-success Affectés
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,8 @@ describe Admin::GestionnairesController, type: :controller do
|
||||||
|
|
||||||
describe 'POST #create' do
|
describe 'POST #create' do
|
||||||
let(:email) { 'test@plop.com' }
|
let(:email) { 'test@plop.com' }
|
||||||
subject { post :create, gestionnaire: {email: email} }
|
let(:procedure_id) { nil }
|
||||||
|
subject { post :create, gestionnaire: {email: email}, procedure_id: procedure_id }
|
||||||
|
|
||||||
context 'When email is valid' do
|
context 'When email is valid' do
|
||||||
before do
|
before do
|
||||||
|
@ -28,6 +29,14 @@ describe Admin::GestionnairesController, type: :controller do
|
||||||
it { expect(response.status).to eq(302) }
|
it { expect(response.status).to eq(302) }
|
||||||
it { expect(response).to redirect_to admin_gestionnaires_path }
|
it { expect(response).to redirect_to admin_gestionnaires_path }
|
||||||
|
|
||||||
|
context 'when procedure_id params is not null' do
|
||||||
|
let(:procedure) { create :procedure }
|
||||||
|
let(:procedure_id) { procedure.id }
|
||||||
|
|
||||||
|
it { expect(response.status).to eq(302) }
|
||||||
|
it { expect(response).to redirect_to admin_procedure_accompagnateurs_path(procedure_id: procedure_id) }
|
||||||
|
end
|
||||||
|
|
||||||
describe 'Gestionnaire attributs in database' do
|
describe 'Gestionnaire attributs in database' do
|
||||||
it { expect(gestionnaire.email).to eq(email) }
|
it { expect(gestionnaire.email).to eq(email) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,6 +9,7 @@ describe 'admin/accompagnateurs/show.html.haml', type: :view do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
assign(:procedure, procedure)
|
assign(:procedure, procedure)
|
||||||
|
assign(:gestionnaire, Gestionnaire.new)
|
||||||
|
|
||||||
assign(:accompagnateurs_assign, (smart_listing_create :accompagnateurs_assign,
|
assign(:accompagnateurs_assign, (smart_listing_create :accompagnateurs_assign,
|
||||||
assign_gestionnaires,
|
assign_gestionnaires,
|
||||||
|
|
Loading…
Reference in a new issue