add pagination for all demarches view
This commit is contained in:
parent
3f0279ac45
commit
0799c40aaa
10 changed files with 30 additions and 7 deletions
|
@ -335,6 +335,7 @@ module Administrateurs
|
|||
@procedures = Procedure.joins(:procedures_zones).publiees_ou_closes
|
||||
@procedures = @procedures.where(procedures_zones: { zone_id: @zone_ids }) if @zone_ids && @zone_ids.any?
|
||||
@procedures = @procedures.where(aasm_state: @statuses) if @statuses && @statuses.any?
|
||||
@procedures = @procedures.page(params[:page]).per(ITEMS_PER_PAGE).order(published_at: :desc)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -28,3 +28,4 @@
|
|||
@import '@gouvfr/dsfr/dist/component/footer/footer.css';
|
||||
@import '@gouvfr/dsfr/dist/component/search/search.css';
|
||||
@import '@gouvfr/dsfr/dist/component/translate/translate.css';
|
||||
@import '@gouvfr/dsfr/dist/component/pagination/pagination.css';
|
||||
|
|
2
app/views/administrateurs/kaminari/_first_page.html.haml
Normal file
2
app/views/administrateurs/kaminari/_first_page.html.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
%li
|
||||
= link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, remote: remote, class: 'fr-pagination__link fr-pagination__link--first', 'aria-disabled': true, title: 'Première page', role: 'link'
|
2
app/views/administrateurs/kaminari/_gap.html.haml
Normal file
2
app/views/administrateurs/kaminari/_gap.html.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
%li
|
||||
= link_to '...', '#', class: 'fr-pagination__link fr-displayed-lg'
|
2
app/views/administrateurs/kaminari/_last_page.html.haml
Normal file
2
app/views/administrateurs/kaminari/_last_page.html.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
%li
|
||||
= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, rel: 'next', remote: remote, class: 'fr-pagination__link fr-pagination__link--last', 'aria-disabled': true, title: "Dernière page", role: 'link'
|
2
app/views/administrateurs/kaminari/_next_page.html.haml
Normal file
2
app/views/administrateurs/kaminari/_next_page.html.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
%li
|
||||
= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, rel: 'next', remote: remote, class: 'fr-pagination__link fr-pagination__link--next fr-pagination__link--lg-label', 'aria-disabled': true, role: 'link'
|
3
app/views/administrateurs/kaminari/_page.html.haml
Normal file
3
app/views/administrateurs/kaminari/_page.html.haml
Normal file
|
@ -0,0 +1,3 @@
|
|||
%li
|
||||
= link_to_unless page.current?, page, url, rel: page.rel, remote: remote, class: 'fr-pagination__link', 'aria-current': page.current? ? 'page' : nil, title: "Page #{page}", role: 'link' do
|
||||
= content_tag 'a', page, 'aria-current': 'page', title: "Page #{page}", class: 'fr-pagination__link'
|
12
app/views/administrateurs/kaminari/_paginator.html.haml
Normal file
12
app/views/administrateurs/kaminari/_paginator.html.haml
Normal file
|
@ -0,0 +1,12 @@
|
|||
= paginator.render do
|
||||
%nav.fr-pagination{ role: 'navigation', 'aria-label': 'Pagination' }
|
||||
%ul.fr-pagination__list
|
||||
= first_page_tag unless current_page.first?
|
||||
= prev_page_tag unless current_page.first?
|
||||
- each_page do |page|
|
||||
- if page.display_tag?
|
||||
= page_tag page
|
||||
- elsif !page.was_truncated?
|
||||
= gap_tag
|
||||
= next_page_tag unless current_page.last?
|
||||
= last_page_tag unless current_page.last?
|
2
app/views/administrateurs/kaminari/_prev_page.html.haml
Normal file
2
app/views/administrateurs/kaminari/_prev_page.html.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
%li
|
||||
= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, rel: 'prev', remote: remote, class: 'fr-pagination__link fr-pagination__link--prev fr-pagination__link--lg-label', 'aria-disabled': true, role: 'link'
|
|
@ -8,8 +8,6 @@
|
|||
.fr-highlight.fr-mb-4w
|
||||
%p Ce tableau de bord permet de consulter les informations sur les démarches simplifiées pour toutes les zones. Filtrez par zone et statut. Consultez la liste des démarches et cliquez sur une démarche pour voir la zone et quels sont les administrateurs.
|
||||
|
||||
|
||||
|
||||
.fr-container--fluid
|
||||
.fr-grid-row.fr-grid-row--gutters
|
||||
.fr-col-3
|
||||
|
@ -55,7 +53,7 @@
|
|||
.fr-col-9
|
||||
.fr-table.fr-table--bordered
|
||||
%table#all-demarches
|
||||
%caption= "#{@procedures.count} démarches"
|
||||
%caption= "#{@procedures.total_count} démarches"
|
||||
- if @selected_zones
|
||||
.selected-zones.fr-mb-2w
|
||||
- @selected_zones.each do |zone|
|
||||
|
@ -64,6 +62,7 @@
|
|||
.selected-statuses.fr-mb-2w
|
||||
- @statuses.each do |status|
|
||||
%p.fr-tag.fr-mb-1w.fr--background-alt-blue-france= status
|
||||
= paginate @procedures, views_prefix: 'administrateurs'
|
||||
%thead
|
||||
%tr
|
||||
%th{scope: 'col'}
|
||||
|
@ -92,7 +91,4 @@
|
|||
.fr-col-6
|
||||
- procedure.administrateurs.uniq.each do |admin|
|
||||
= admin.email
|
||||
|
||||
|
||||
|
||||
|
||||
.fr-mt-2w= paginate @procedures, views_prefix: 'administrateurs'
|
||||
|
|
Loading…
Reference in a new issue