mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Customise partial used for showing pagination links
This commit is contained in:
19
app/views/admin/shared/_pagy_links.html.haml
Normal file
19
app/views/admin/shared/_pagy_links.html.haml
Normal 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)
|
||||
@@ -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")
|
||||
|
||||
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user