From 72d27ffdb2e99908c265244a176c94f7dc985ec9 Mon Sep 17 00:00:00 2001 From: Christophe Robillard Date: Thu, 16 Apr 2020 17:52:58 +0200 Subject: [PATCH] replace instructeur_avis_index url by instructeur_all_avis url --- app/controllers/instructeurs/avis_controller.rb | 2 +- app/controllers/instructeurs/procedures_controller.rb | 2 +- app/views/instructeurs/avis/_header.html.haml | 2 +- app/views/instructeurs/avis/index.html.haml | 4 ++-- app/views/layouts/_new_header.haml | 2 +- config/routes.rb | 1 + spec/controllers/instructeurs/avis_controller_spec.rb | 2 +- spec/controllers/instructeurs/procedures_controller_spec.rb | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/controllers/instructeurs/avis_controller.rb b/app/controllers/instructeurs/avis_controller.rb index e85e301f1..578ae1505 100644 --- a/app/controllers/instructeurs/avis_controller.rb +++ b/app/controllers/instructeurs/avis_controller.rb @@ -99,7 +99,7 @@ module Instructeurs sign_in(user) Avis.link_avis_to_instructeur(user.instructeur) - redirect_to url_for(instructeur_avis_index_path) + redirect_to url_for(instructeur_all_avis_path) else flash[:alert] = user.errors.full_messages redirect_to url_for(sign_up_instructeur_avis_path(params[:id], email)) diff --git a/app/controllers/instructeurs/procedures_controller.rb b/app/controllers/instructeurs/procedures_controller.rb index c5c7e948b..68e01c1b0 100644 --- a/app/controllers/instructeurs/procedures_controller.rb +++ b/app/controllers/instructeurs/procedures_controller.rb @@ -284,7 +284,7 @@ module Instructeurs def redirect_to_avis_if_needed if current_instructeur.procedures.count == 0 && current_instructeur.avis.count > 0 - redirect_to instructeur_avis_index_path + redirect_to instructeur_all_avis_path end end diff --git a/app/views/instructeurs/avis/_header.html.haml b/app/views/instructeurs/avis/_header.html.haml index f0bfcd50d..8f0e601a8 100644 --- a/app/views/instructeurs/avis/_header.html.haml +++ b/app/views/instructeurs/avis/_header.html.haml @@ -1,7 +1,7 @@ .sub-header .container %ul.breadcrumbs - %li= link_to('Avis', instructeur_avis_index_path) + %li= link_to('Avis', instructeur_all_avis_path) %li= "#{dossier.procedure.libelle}, dossier nº #{dossier.id}" %ul.tabs diff --git a/app/views/instructeurs/avis/index.html.haml b/app/views/instructeurs/avis/index.html.haml index 329995b7d..cf1232d47 100644 --- a/app/views/instructeurs/avis/index.html.haml +++ b/app/views/instructeurs/avis/index.html.haml @@ -7,13 +7,13 @@ %h1.tab-title Avis %ul.tabs = tab_item('avis à donner', - instructeur_avis_index_path(statut: Instructeurs::AvisController::A_DONNER_STATUS), + instructeur_all_avis_path(statut: Instructeurs::AvisController::A_DONNER_STATUS), active: @statut == Instructeurs::AvisController::A_DONNER_STATUS, badge: @avis_a_donner.count, notification: @avis_a_donner.any?) = tab_item("avis #{'donné'.pluralize(@avis_donnes.count)}", - instructeur_avis_index_path(statut: Instructeurs::AvisController::DONNES_STATUS), + instructeur_all_avis_path(statut: Instructeurs::AvisController::DONNES_STATUS), active: @statut == Instructeurs::AvisController::DONNES_STATUS, badge: @avis_donnes.count) diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index 02cd3e321..31497d84a 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -32,7 +32,7 @@ = active_link_to "Démarches", instructeur_procedures_path, active: :inclusive, class: 'tab-link' - if current_instructeur.avis.count > 0 %li - = active_link_to instructeur_avis_index_path, active: :inclusive, class: 'tab-link' do + = active_link_to instructeur_all_avis_path, active: :inclusive, class: 'tab-link' do Avis - avis_counter = current_instructeur.avis.without_answer.count - if avis_counter > 0 diff --git a/config/routes.rb b/config/routes.rb index f33c91bd2..75f669a41 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -300,6 +300,7 @@ Rails.application.routes.draw do # scope module: 'instructeurs', as: 'instructeur' do + get 'avis', to: 'avis#all', as: 'all_avis' resources :procedures, only: [:index, :show], param: :procedure_id do member do resources :groupes, only: [:index, :show], controller: 'groupe_instructeurs' do diff --git a/spec/controllers/instructeurs/avis_controller_spec.rb b/spec/controllers/instructeurs/avis_controller_spec.rb index aeef6fff9..581244e38 100644 --- a/spec/controllers/instructeurs/avis_controller_spec.rb +++ b/spec/controllers/instructeurs/avis_controller_spec.rb @@ -358,7 +358,7 @@ describe Instructeurs::AvisController, type: :controller do it { expect(Avis).to have_received(:link_avis_to_instructeur) } it { expect(subject.current_instructeur).to eq(created_instructeur) } - it { is_expected.to redirect_to instructeur_avis_index_path } + it { is_expected.to redirect_to instructeur_all_avis_path } it 'creates a corresponding user account for the email' do user = User.find_by(email: invited_email) diff --git a/spec/controllers/instructeurs/procedures_controller_spec.rb b/spec/controllers/instructeurs/procedures_controller_spec.rb index 9b91ed178..f48b9df44 100644 --- a/spec/controllers/instructeurs/procedures_controller_spec.rb +++ b/spec/controllers/instructeurs/procedures_controller_spec.rb @@ -76,7 +76,7 @@ describe Instructeurs::ProceduresController, type: :controller do end it "redirects avis" do - expect(@controller).to have_received(:redirect_to).with(instructeur_avis_index_path) + expect(@controller).to have_received(:redirect_to).with(instructeur_all_avis_path) end end end