Answered by
benkoshy
May 3, 2024
Replies: 1 comment 2 replies
Yes. If all you want is to render the first and last pages in addition to the others, all the time, you can do this by changing the pagy = Pagy.new count: 1000, page: 10, size: [1, 4, 4,1] # etc
pagy.series
#=>[1, :gap, 6, 7, 8, 9, "10", 11, 12, 13, 14, :gap, 50]
# so you may want to do something like in your FoosController.rb
@pagy, @foos = pagy(Foo.all, size: [1, 4, 4, 1])
# or set a default in your pagy.rb initialiser if you want it globally set.
Pagy::DEFAULT[:size] = [1, 4, 4,1]Referencehttps://ddnexus.github.io/pagy/docs/how-to/#control-the-page-links and checkout the session on "classic nav". Try it out:Run the interactive demo from your terminal: bundle exec pagy demoand point your browser to (see pagy playground) Targeting ClassesLooks like you're using bootstrap (?) but for anyone else, who wants to target the first / last link via css.
Credit@ddnexus who suggested the references. |
2 replies
Answer selected by
benkoshy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment





Yes.
If all you want is to render the first and last pages in addition to the others, all the time, you can do this by changing the
sizearray:Reference
https://ddnexus.github.io/pagy/docs/how-to/#control-the-page-links and checkout the session on "cla…