Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a vendorization of the pagy gem version 43.0.0.rc1 - the best pagination gem out there.
pagy is MIT licensed, see https://github.com/ddnexus/pagy/blob/d70e443872a5b18da4e482454b3c8b4a1c86cb6b/LICENSE.txt.
Vendoring it allows us to avoid a dependency, and also lets us move it under the Uchi namespace, so we can be included into projects that already depend on pagy without causing conflicts.
It also allows us to pare down the pagy gem to just the bits that we need and use. Since we rely on the :offset paginator only, so we can remove the other paginators and the optimist dependency.
The offset paginator works out of the box with Rails, ActiveRecord and has UI support without the need for Javascript or clientside storage. That makes it the best fit for our needs where we need to integrate into various applications with minimal dependencies and assumptions.
We also don't need their helper methods for generating Bulma/Bootstrap HTML as we have our own rendering for that.