Add pagination on avis

This commit is contained in:
Mathieu Magnin 2017-09-21 17:19:15 +02:00
parent 3b3f4efa18
commit 6a58873ba7
2 changed files with 5 additions and 1 deletions

View file

@ -7,7 +7,8 @@ module NewGestionnaire
def index def index
gestionnaire_avis = current_gestionnaire.avis.includes(dossier: [:procedure, :user]) gestionnaire_avis = current_gestionnaire.avis.includes(dossier: [:procedure, :user])
@avis_a_donner, @avis_donnes = gestionnaire_avis.partition { |avis| avis.answer.nil? } @avis_a_donner = gestionnaire_avis.without_answer
@avis_donnes = gestionnaire_avis.with_answer
@statut = params[:statut].present? ? params[:statut] : A_DONNER_STATUS @statut = params[:statut].present? ? params[:statut] : A_DONNER_STATUS
@ -17,6 +18,8 @@ module NewGestionnaire
when DONNES_STATUS when DONNES_STATUS
@avis_donnes @avis_donnes
end end
@avis = @avis.page([params[:page].to_i, 1].max)
end end
def show def show

View file

@ -33,5 +33,6 @@
#{avis.dossier.id} #{avis.dossier.id}
%td= link_to(avis.dossier.user.email, avis_path(avis), class: 'cell-link') %td= link_to(avis.dossier.user.email, avis_path(avis), class: 'cell-link')
%td= link_to(avis.dossier.procedure.libelle, avis_path(avis), class: 'cell-link') %td= link_to(avis.dossier.procedure.libelle, avis_path(avis), class: 'cell-link')
= paginate(@avis)
- else - else
%h2.empty-text Aucun avis %h2.empty-text Aucun avis