Switch history page to numbered pagination#12624
Conversation
Compute total pages from page.revision so users can jump to any page instead of stepping through with arrows.
There was a problem hiding this comment.
Pull request overview
Updates the page history view to use the numbered OlPagination component (instead of arrows-only pagination), enabling direct navigation to any page of revisions.
Changes:
- Replaces the history page’s arrow-only pagination UI with the numbered
OlPaginationcomponent (rendered above and below the revisions table). - Updates the history endpoint to compute
page_num/total_pagesand pass them into the history template.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| openlibrary/templates/history.html | Switches template pagination rendering to macros.OlPagination at top and bottom, and updates template args to accept page_num/total_pages. |
| openlibrary/plugins/upstream/recentchanges.py | Computes pagination state (page_num, offset, total_pages) for the history view and updates the render call signature accordingly. |
There was a problem hiding this comment.
Put it on testing and it looks/works beautiful.
Here's a case with a lot of revisions: https://testing.openlibrary.org/works/OL82563W/Harry_Potter_and_the_Philosopher's_Stone?m=history&page=8
One note is that if the page is set higher than the number that exist the UX is off but that's a pretty extreme edge case that's already not looking good in the current state.
So I think this is a nice improvement and good to go!


#12624
Replaces arrow-only pagination on the page-history view with the numbered
OlPaginationcomponent, so users can jump to any page directly.Technical details
The full page count was already available via
page.revision. Easy upgrade.Screenshots
Before
After

Test plan
Visit history page and confirm numbered pagination renders at top and bottom of table