Merge pull request #752 from sgmap/paginate_dossiers

Paginate dossiers
This commit is contained in:
Mathieu Magnin 2017-09-22 10:29:28 +02:00 committed by GitHub
commit 769e45eb15
7 changed files with 20 additions and 1 deletions

View file

@ -37,6 +37,7 @@ gem 'bootstrap-sass', '~> 3.3.5'
# Pagination
gem 'will_paginate-bootstrap'
gem 'kaminari'
# Decorators
gem 'draper', '~> 3.0.0.pre1'

View file

@ -710,6 +710,7 @@ DEPENDENCIES
haml-rails
hashie
jquery-rails
kaminari
launchy
leaflet-draw-rails
leaflet-markercluster-rails (~> 0.7.0)

View file

@ -0,0 +1,10 @@
@import "constants";
.pagination {
text-align: center;
margin-bottom: 3 * $default-spacer;
> span {
margin: 0 $default-spacer;
}
}

View file

@ -7,7 +7,8 @@ module NewGestionnaire
def index
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
@ -17,6 +18,8 @@ module NewGestionnaire
when DONNES_STATUS
@avis_donnes
end
@avis = @avis.page([params[:page].to_i, 1].max)
end
def show

View file

@ -63,6 +63,8 @@ module NewGestionnaire
when 'archives'
@archived_dossiers
end
@dossiers = @dossiers.page([params[:page].to_i, 1].max)
end
private

View file

@ -33,5 +33,6 @@
#{avis.dossier.id}
%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')
= paginate(@avis)
- else
%h2.empty-text Aucun avis

View file

@ -73,5 +73,6 @@
= link_to(dossier_path(@procedure, dossier), class: 'cell-link') do
= render partial: 'status', locals: { dossier: dossier }
%td.follow-col= render partial: 'dossier_actions', locals: { procedure: @procedure, dossier: dossier, dossier_is_followed: @followed_dossiers_id.include?(dossier.id) }
= paginate @dossiers
- else
%h2.empty-text Aucun dossier