add dsfr style pagination for all users

This commit is contained in:
Lisa Durand 2023-04-21 17:19:17 +02:00
parent 1b02857662
commit 1c20a9160c
24 changed files with 26 additions and 25 deletions

View 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'

View file

@ -0,0 +1,2 @@
%li
= link_to '...', '#', class: 'fr-pagination__link fr-displayed-lg'

View 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'

View 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'

View 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'

View file

@ -0,0 +1,12 @@
= paginator.render do
%nav.fr-pagination.fr-mt-2w{ 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?

View 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'