Make resources per page configurable on admin index pages (#6520) - #6543
Open
PriteshTrivedi wants to merge 1 commit into
Open
Make resources per page configurable on admin index pages (#6520)#6543PriteshTrivedi wants to merge 1 commit into
PriteshTrivedi wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request makes the number of resources shown per page on Solidus Admin index pages configurable via SolidusAdmin::Config.per_page, replacing the previously hard-coded default of 20 in ResourcesController.
Changes:
- Adds a
per_pagepreference toSolidusAdmin::Configuration(default: 20) and tests for it. - Routes pagination defaults through
SolidusAdmin::BaseController#per_pageand forwards that intoset_page_and_extract_portion_from. - Documents how to configure the global per-page value and how to override it per controller.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| admin/lib/solidus_admin/configuration.rb | Introduces per_page preference (default 20) for admin index pagination. |
| admin/app/controllers/solidus_admin/base_controller.rb | Applies SolidusAdmin::Config.per_page as the default per_page: for geared pagination. |
| admin/app/controllers/solidus_admin/resources_controller.rb | Removes controller-local default per-page constant/method (now uses the base/controller config behavior). |
| admin/spec/solidus_admin/configuration_spec.rb | Adds specs asserting default and configurable per_page. |
| admin/spec/controllers/solidus_admin/base_controller_spec.rb | Adds specs asserting per_page comes from config and is passed into geared pagination. |
| admin/docs/index_pages.md | Documents the new global setting and per-controller overrides. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+43
to
+48
| class SolidusAdmin::UsersController < SolidusAdmin::BaseController | ||
| # ... | ||
| def per_page | ||
| 10 | ||
| end | ||
| end |
This file contains hidden or 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
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.
Summary
Closes #6520.
Makes the number of resources per page on admin index pages globally and locally configurable:
SolidusAdmin::Config.per_pagepreference (defaults to20).SolidusAdmin::BaseController#set_page_and_extract_portion_fromto passper_page: self.per_pageby default.def per_pageor passingper_page:.DEFAULT_PER_PAGEfromSolidusAdmin::ResourcesController.Checklist
admin/docs/index_pages.md).