-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CTSKF-486] Replace Kaminari with Pagy #7915
Open
mpw5
wants to merge
7
commits into
master
Choose a base branch
from
ctskf-486-kaminari-to-pagy
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mpw5
force-pushed
the
ctskf-486-kaminari-to-pagy
branch
8 times, most recently
from
December 20, 2024 12:34
2677462
to
f9c2826
Compare
Replaces the uses of the Kaminari gem for pagination with Pagy on the superadmin 'All users' page.
mpw5
force-pushed
the
ctskf-486-kaminari-to-pagy
branch
from
December 20, 2024 12:38
f9c2826
to
4df1d11
Compare
Replaces the uses of the Kaminari gem for pagination with Pagy on the provider 'Your claims', 'Your claim archive', 'Your outstanding claims' and 'Your authorised claims' pages.
mpw5
force-pushed
the
ctskf-486-kaminari-to-pagy
branch
from
December 20, 2024 12:41
4df1d11
to
3e92c41
Compare
Replaces the uses of the Kaminari gem for pagination with Pagy on the caseworker claims pages. This is more complex than the change to the provider claims pages due to the way claims data is fetched from the API. Pagination is currently done by the API, so it is necessary to make changes there too. This commit * updates `API::V2::CaseWorkers::Claim` to use Pagy to paginate claims and pass the resulting Pagy object to `API::Entities::PaginatedCollection` * updates `API::Entities::PaginatedCollection` to read pagination data from the Pagy object and include it in the API response * updates `CaseWorkers::ClaimsController` to create a new Pagy object on the client side based on pagination data received from the API * updates views to use the Pagy object when displaying pagination controls
Replaces the uses of the Kaminari gem for pagination with Pagy on the caseworker allocation pages. This is more complex than the change to the provider claims pages due to the way claims data is fetched from the API. Pagination is currently done by the API, so it is necessary to make changes there too. Similar to the previous commit it is necessary to create a new Pagy object in the CaseWorkers::Admin::AllocationsController based on pagination data received from the API. This also fixes a bug(?) where the `sort_and_paginate` method was never being called in that controller.
Tidies up the views a little by moving the code to generate pagination controls to a reusable shared partial. This also adds some extra control to hide the pagination links when only one page is displayed, in line with GDS guidelines.
mpw5
force-pushed
the
ctskf-486-kaminari-to-pagy
branch
from
December 20, 2024 14:49
3e92c41
to
ae127ae
Compare
Requests to the API have changed as Pagy indexes pages from 1, not 0 used by Kaminari. This means the `pages` parameter in API calls to the `caseworker/claims` endpoint now use 1 instead of 0, and VCR cassettes need to be updated to reflect this. This also updates a feature test which had become inaccurate to a change of onscreen wording as a result of the use of the @pagy_info helper method to display pagination data.
mpw5
force-pushed
the
ctskf-486-kaminari-to-pagy
branch
from
December 20, 2024 14:52
ae127ae
to
8bf7608
Compare
Quality Gate passedIssues Measures |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Replace the Kaminari pagination gem with Pagy
Ticket
CTSKF-486
Why
The
govuk-components
gem offers a pagination component which depends on the use of Pagy. By adopting Pagy now we will have the option of using thegovuk-components
pagination component in future, allowing us to better conform with GDS design standards.How
.per
and.page
methods withpagy
pagy_nav
helper method to display pagination navigation - this results in navigation which is slightly different to what users currently see (no First or Last links, for example) but should hopefully have little impact (see below for examples). Implementing the govuk pagination component would allow us to standardise the experiencepagy_info
helper method to display information about pagination - again, this is slightly different to the current wording but (in my opinion) gives more useful information (see below for examples)Screenshots
Kaminari navigation controls:
Pagy navigation controls:
Kaminari pagination info:
Pagy pagination info: