Add pagination to admin source list pages#103
Merged
mbuckingham74 merged 5 commits intomainfrom Dec 2, 2025
Merged
Conversation
- Add pagination controls (Prev/Next) to all admin source list pages - Show 20 sources per page with "Showing X-Y of Z sources" info - Pagination appears at both top and bottom of long lists - Controls only appear when there's more than one page - Works for Active, Disabled, Needs Configuration, and Robots Blocked pages - Uses HTMX for seamless page navigation without full page reload 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Code review fixes: - Create _get_paginated_sources() helper to share pagination logic - Update mutation endpoints (delete, toggle, mark-disabled, recheck-robots, create) to return paginated results instead of unpaginated lists - Replace hard-coded page size (20) in template with page_size variable - Add page_size to all GET list endpoint responses This ensures pagination controls persist after actions like delete/toggle, and the template will automatically reflect any changes to SOURCES_PER_PAGE. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Address code review feedback on PR #103: - Thread current page from HX-Current-URL header through mutation endpoints (delete, toggle, mark-disabled, recheck-robots) so users don't lose their place after actions - Refactor all four GET list endpoints to use _get_paginated_sources helper, ensuring consistent page clamping to prevent invalid ranges like "Showing 21-10 of 10" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The HX-Current-URL header contains the browser URL (e.g., /admin) which
never has a page param since pagination doesn't push to browser URL.
Fix by:
- Adding hx-vals='{"page": "{{ page }}"}' to all mutation buttons
(recheck-robots, delete, mark-disabled, toggle)
- Update _get_current_page_from_request to read from query params
(DELETE) or form data (POST) where htmx sends hx-vals
- Make mutation endpoints async to await form parsing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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
Test plan
🤖 Generated with Claude Code