Gestionnaire: various missing avis urls

This commit is contained in:
simon lehericey 2018-02-21 15:45:21 +01:00
parent 9db5e82b41
commit 864b98c6dc
10 changed files with 15 additions and 15 deletions

View file

@ -76,7 +76,7 @@ module NewGestionnaire
sign_in(gestionnaire, scope: :gestionnaire)
Avis.link_avis_to_gestionnaire(gestionnaire)
avis = Avis.find(params[:id])
redirect_to url_for(avis_index_path)
redirect_to url_for(gestionnaire_avis_index_path)
else
flash[:alert] = gestionnaire.errors.full_messages
redirect_to url_for(sign_up_gestionnaire_avis_path(params[:id], email))
@ -96,7 +96,7 @@ module NewGestionnaire
if current_gestionnaire.present?
# a gestionnaire is authenticated ... lets see if it can view the dossier
redirect_to avis_url(avis)
redirect_to gestionnaire_avis_url(avis)
elsif avis.gestionnaire.present? && avis.gestionnaire.email == params[:email]
# the avis gestionnaire has already signed up and it sould sign in

View file

@ -203,7 +203,7 @@ module NewGestionnaire
def redirect_to_avis_if_needed
if current_gestionnaire.procedures.count == 0 && current_gestionnaire.avis.count > 0
redirect_to avis_index_path
redirect_to gestionnaire_avis_index_path
end
end

View file

@ -15,7 +15,7 @@
= link_to "Connectez-vous pour donner votre avis", dossier_url(@avis.dossier.procedure, @avis.dossier)
- else
%p
= link_to "Inscrivez-vous pour donner votre avis", sign_up_avis_url(@avis.id, @avis.email)
= link_to "Inscrivez-vous pour donner votre avis", sign_up_gestionnaire_avis_url(@avis.id, @avis.email)
Bonne journée,
%br

View file

@ -15,7 +15,7 @@
= link_to "Procédures", gestionnaire_procedures_path, class: (controller_name != 'avis') ? "tab-link active" : 'tab-link'
- if current_gestionnaire.avis.count > 0
%li
= link_to avis_index_path, class: (controller_name == 'avis') ? "tab-link active" : 'tab-link' do
= link_to gestionnaire_avis_index_path, class: (controller_name == 'avis') ? "tab-link active" : 'tab-link' do
Avis
- avis_counter = current_gestionnaire.avis.without_answer.count
- if avis_counter > 0

View file

@ -1,7 +1,7 @@
.accompagnateur-header
.container
%ul.breadcrumbs
%li= link_to('Avis', avis_index_path)
%li= link_to('Avis', gestionnaire_avis_index_path)
%li= "#{dossier.procedure.libelle}, dossier nº #{dossier.id}"
%ul.tabs

View file

@ -7,14 +7,14 @@
%h1.tab-title Avis
%ul.tabs
%li{ class: (@statut == NewGestionnaire::AvisController::A_DONNER_STATUS) ? 'active' : nil }>
= link_to(avis_index_path(statut: NewGestionnaire::AvisController::A_DONNER_STATUS)) do
= link_to(gestionnaire_avis_index_path(statut: NewGestionnaire::AvisController::A_DONNER_STATUS)) do
avis à donner
%span.badge= @avis_a_donner.count
- if @avis_a_donner.any?
%span.notifications
%li{ class: (@statut == NewGestionnaire::AvisController::DONNES_STATUS) ? 'active' : nil }>
= link_to(avis_index_path(statut: NewGestionnaire::AvisController::DONNES_STATUS)) do
= link_to(gestionnaire_avis_index_path(statut: NewGestionnaire::AvisController::DONNES_STATUS)) do
avis #{'donné'.pluralize(@avis_donnes.count)}
%span.badge= @avis_donnes.count

View file

@ -21,6 +21,6 @@
.send-wrapper
= f.submit 'Envoyer votre avis', class: 'button send'
= render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_avis_path(@avis), must_be_confidentiel: @avis.confidentiel? }
= render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_gestionnaire_avis_path(@avis), must_be_confidentiel: @avis.confidentiel? }
= render partial: 'new_gestionnaire/shared/avis/list', locals: { avis: @dossier.avis_for(current_gestionnaire), avis_seen_at: nil }

View file

@ -179,7 +179,7 @@ describe NewGestionnaire::AvisController, type: :controller do
get :sign_up, params: { id: avis.id, email: invited_email }
end
it { is_expected.to redirect_to avis_url(avis) }
it { is_expected.to redirect_to gestionnaire_avis_url(avis) }
end
context 'when the gestionnaire is not authenticated' do
@ -201,7 +201,7 @@ describe NewGestionnaire::AvisController, type: :controller do
end
# redirected to dossier but then the gestionnaire gonna be banished !
it { is_expected.to redirect_to avis_url(avis) }
it { is_expected.to redirect_to gestionnaire_avis_url(avis) }
end
end
@ -243,7 +243,7 @@ describe NewGestionnaire::AvisController, type: :controller do
it { expect(Avis).to have_received(:link_avis_to_gestionnaire) }
it { expect(subject.current_gestionnaire).to eq(created_gestionnaire) }
it { is_expected.to redirect_to avis_index_path }
it { is_expected.to redirect_to gestionnaire_avis_index_path }
end
context 'when the gestionnaire creation fails' do

View file

@ -78,7 +78,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do
end
it "redirects avis" do
expect(@controller).to have_received(:redirect_to).with(avis_index_path)
expect(@controller).to have_received(:redirect_to).with(gestionnaire_avis_index_path)
end
end
end

View file

@ -75,7 +75,7 @@ feature 'The gestionnaire part' do
avis_sign_up(avis, expert_email, 'a good password')
expect(page).to have_current_path(avis_index_path)
expect(page).to have_current_path(gestionnaire_avis_index_path)
expect(page).to have_text('avis à donner 1')
expect(page).to have_text('avis donnés 0')
@ -172,7 +172,7 @@ feature 'The gestionnaire part' do
visit sign_up_gestionnaire_avis_path(avis, email)
fill_in 'gestionnaire_password', with: 'a good password'
click_on 'Créer un compte'
expect(page).to have_current_path(avis_index_path)
expect(page).to have_current_path(gestionnaire_avis_index_path)
end
def dossier_present?(id, statut)