rename avis#index to avis#procedure
This commit is contained in:
parent
90d6d337a9
commit
bbec76d33b
6 changed files with 12 additions and 11 deletions
|
@ -15,7 +15,7 @@ module Instructeurs
|
|||
@avis_by_procedure = avis.to_a.group_by(&:procedure)
|
||||
end
|
||||
|
||||
def index
|
||||
def procedure
|
||||
@procedure = Procedure.find(params[:procedure_id])
|
||||
instructeur_avis = current_instructeur.avis.includes(:dossier).where(dossiers: { groupe_instructeur: GroupeInstructeur.where(procedure: @procedure.id) })
|
||||
@avis_a_donner = instructeur_avis.without_answer
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
.container
|
||||
%ul.breadcrumbs
|
||||
%li= link_to('Avis', instructeur_all_avis_path)
|
||||
%li= link_to(dossier.procedure.libelle, instructeur_avis_index_path(avis.procedure))
|
||||
%li= link_to(dossier.procedure.libelle, procedure_instructeur_avis_index_path(avis.procedure))
|
||||
%li= link_to("Dossier nº #{dossier.id}", instructeur_avis_path(avis.procedure, avis))
|
||||
|
||||
%ul.tabs
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
%ul.procedure-list
|
||||
- @avis_by_procedure.each do |p, procedure_avis|
|
||||
%li.procedure-item.flex.align-start
|
||||
= link_to(instructeur_avis_index_path(p)) do
|
||||
= link_to(procedure_instructeur_avis_index_path(p)) do
|
||||
.flex
|
||||
|
||||
.procedure-logo{ style: "background-image: url(#{p.logo_url})" }
|
||||
|
@ -17,7 +17,7 @@
|
|||
%ul.procedure-stats.flex
|
||||
%li
|
||||
%object
|
||||
= link_to(instructeur_avis_index_path(p, statut: Instructeurs::AvisController::A_DONNER_STATUS)) do
|
||||
= link_to(procedure_instructeur_avis_index_path(p, statut: Instructeurs::AvisController::A_DONNER_STATUS)) do
|
||||
- without_answer_count = procedure_avis.select { |a| a.answer.nil? }.size
|
||||
- if without_answer_count > 0
|
||||
%span.notifications{ 'aria-label': "notifications" }
|
||||
|
@ -27,7 +27,7 @@
|
|||
avis à donner
|
||||
%li
|
||||
%object
|
||||
= link_to(instructeur_avis_index_path(p, statut: Instructeurs::AvisController::DONNES_STATUS)) do
|
||||
= link_to(procedure_instructeur_avis_index_path(p, statut: Instructeurs::AvisController::DONNES_STATUS)) do
|
||||
- with_answer_count = procedure_avis.select { |a| a.answer.present? }.size
|
||||
.stats-number= with_answer_count
|
||||
.stats-legend
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
|
||||
%ul.tabs
|
||||
= tab_item('avis à donner',
|
||||
instructeur_avis_index_path(statut: Instructeurs::AvisController::A_DONNER_STATUS),
|
||||
procedure_instructeur_avis_index_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),
|
||||
procedure_instructeur_avis_index_path(statut: Instructeurs::AvisController::DONNES_STATUS),
|
||||
active: @statut == Instructeurs::AvisController::DONNES_STATUS,
|
||||
badge: @avis_donnes.count)
|
||||
|
|
@ -316,7 +316,8 @@ Rails.application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
resources :avis, only: [:index, :show, :update] do
|
||||
resources :avis, only: [:show, :update] do
|
||||
get '', action: 'procedure', on: :collection, as: :procedure
|
||||
member do
|
||||
get 'instruction'
|
||||
get 'messagerie'
|
||||
|
|
|
@ -20,8 +20,8 @@ describe Instructeurs::AvisController, type: :controller do
|
|||
it { expect(assigns(:avis_by_procedure).flatten).not_to include(another_procedure) }
|
||||
end
|
||||
|
||||
describe '#index' do
|
||||
before { get :index, params: { procedure_id: procedure.id } }
|
||||
describe '#procedure' do
|
||||
before { get :procedure, params: { procedure_id: procedure.id } }
|
||||
|
||||
it { expect(response).to have_http_status(:success) }
|
||||
it { expect(assigns(:avis_a_donner)).to match([avis_without_answer]) }
|
||||
|
@ -29,7 +29,7 @@ describe Instructeurs::AvisController, type: :controller do
|
|||
it { expect(assigns(:statut)).to eq('a-donner') }
|
||||
|
||||
context 'with a statut equal to donnes' do
|
||||
before { get :index, params: { statut: 'donnes', procedure_id: procedure.id } }
|
||||
before { get :procedure, params: { statut: 'donnes', procedure_id: procedure.id } }
|
||||
|
||||
it { expect(assigns(:statut)).to eq('donnes') }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue