From 864b98c6dc4bbdc783241df129703c6c0b65d26f Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 15:45:21 +0100 Subject: [PATCH] Gestionnaire: various missing avis urls --- app/controllers/new_gestionnaire/avis_controller.rb | 4 ++-- app/controllers/new_gestionnaire/procedures_controller.rb | 2 +- app/views/avis_mailer/avis_invitation.html.haml | 2 +- app/views/layouts/_new_header.haml | 2 +- app/views/new_gestionnaire/avis/_header.html.haml | 2 +- app/views/new_gestionnaire/avis/index.html.haml | 4 ++-- app/views/new_gestionnaire/avis/instruction.html.haml | 2 +- spec/controllers/new_gestionnaire/avis_controller_spec.rb | 6 +++--- .../new_gestionnaire/procedures_controller_spec.rb | 2 +- spec/features/new_gestionnaire/gestionnaire_spec.rb | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/controllers/new_gestionnaire/avis_controller.rb b/app/controllers/new_gestionnaire/avis_controller.rb index 84441723a..9e1257063 100644 --- a/app/controllers/new_gestionnaire/avis_controller.rb +++ b/app/controllers/new_gestionnaire/avis_controller.rb @@ -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 diff --git a/app/controllers/new_gestionnaire/procedures_controller.rb b/app/controllers/new_gestionnaire/procedures_controller.rb index 5b377c709..8fedf4d06 100644 --- a/app/controllers/new_gestionnaire/procedures_controller.rb +++ b/app/controllers/new_gestionnaire/procedures_controller.rb @@ -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 diff --git a/app/views/avis_mailer/avis_invitation.html.haml b/app/views/avis_mailer/avis_invitation.html.haml index 046076949..7384c5ed5 100644 --- a/app/views/avis_mailer/avis_invitation.html.haml +++ b/app/views/avis_mailer/avis_invitation.html.haml @@ -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 diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index b43b29ada..3f73c7cba 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -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 diff --git a/app/views/new_gestionnaire/avis/_header.html.haml b/app/views/new_gestionnaire/avis/_header.html.haml index 8a8f69b78..aac10ae17 100644 --- a/app/views/new_gestionnaire/avis/_header.html.haml +++ b/app/views/new_gestionnaire/avis/_header.html.haml @@ -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 diff --git a/app/views/new_gestionnaire/avis/index.html.haml b/app/views/new_gestionnaire/avis/index.html.haml index 597a1e1d0..2a7c6c0a3 100644 --- a/app/views/new_gestionnaire/avis/index.html.haml +++ b/app/views/new_gestionnaire/avis/index.html.haml @@ -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 diff --git a/app/views/new_gestionnaire/avis/instruction.html.haml b/app/views/new_gestionnaire/avis/instruction.html.haml index 499da3ce5..943764c97 100644 --- a/app/views/new_gestionnaire/avis/instruction.html.haml +++ b/app/views/new_gestionnaire/avis/instruction.html.haml @@ -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 } diff --git a/spec/controllers/new_gestionnaire/avis_controller_spec.rb b/spec/controllers/new_gestionnaire/avis_controller_spec.rb index d95875bfc..c34f1ed79 100644 --- a/spec/controllers/new_gestionnaire/avis_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/avis_controller_spec.rb @@ -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 diff --git a/spec/controllers/new_gestionnaire/procedures_controller_spec.rb b/spec/controllers/new_gestionnaire/procedures_controller_spec.rb index aca6bec8b..daa5aea35 100644 --- a/spec/controllers/new_gestionnaire/procedures_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/procedures_controller_spec.rb @@ -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 diff --git a/spec/features/new_gestionnaire/gestionnaire_spec.rb b/spec/features/new_gestionnaire/gestionnaire_spec.rb index af1035f36..c67cbe71f 100644 --- a/spec/features/new_gestionnaire/gestionnaire_spec.rb +++ b/spec/features/new_gestionnaire/gestionnaire_spec.rb @@ -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)