Customise partial used for showing pagination links

This commit is contained in:
Matt-Yorkley
2021-06-29 12:50:10 +01:00
parent 786cb06c7d
commit 4187380225
3 changed files with 22 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
- link = pagy_link_proc(pagy)
%nav.pagy_nav.pagination{"aria-label" => "pager", :role => "navigation"}
- if pagy.prev
%span.page.prev!= link.call(pagy.prev, t(:previous), 'aria-label="previous"')
- else
%span.page.prev.disabled!= t(:previous)
- pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
- if item.is_a?(Integer) # page link
%span.page
!= link.call(item)
- elsif item.is_a?(String) # current page
%span.page.current= item
- elsif item == :gap # page gap
%span.page.gap …
- if pagy.next
%span.page.next!= link.call(pagy.next, t(:next), 'aria-label="next"')
- else
%span.page.next.disabled!= t(:next)

View File

@@ -26,8 +26,9 @@
%td.user_enterprise_limit= user.enterprise_limit
%td.actions
= link_to_delete user, no_text: true
- _with_routes Spree::Core::Engine.routes do
= pagy_nav @pagy
= render partial: 'admin/shared/pagy_links', locals: { pagy: @pagy }
- content_for :sidebar_title do
= t(".search")

View File

@@ -38,4 +38,4 @@
= link_to_delete zone, no_text: true
- _with_routes Spree::Core::Engine.routes do
= pagy_nav @pagy
= render partial: 'admin/shared/pagy_links', locals: { pagy: @pagy }