[openstreetmap/openstreetmap-website] Rewrite history page url when scrolling (PR #5826)
Anton Khorev
notifications at github.com
Wed Mar 19 23:38:05 UTC 2025
The goal here is when viewing history to be able to go back to roughly the same place after visiting a changeset page. It works like this:
- when the changeset list is scrolled down and some item leaves the viewport, the current page location gets changed to include a `before=:changeset_id` parameter, `:changeset_id` being the id of the changeset that left the viewport
- when the changeset list is scrolled up, same thing happens with `after=:changeset_id`
- when the history page is visited and its url includes a `before` parameter, the sidebar is scrolled so the first item is at the top of the viewport
- when the history page is visited and its url includes an `after` parameter, the sidebar is scrolled so the last item is at the bottom of the viewport
With these changes you can open a history page, scroll and load more if necessary, click on a changeset, then click back and arrive at a view that includes roughly the same changesets.
Fixes #647. Also fixes the main issue from #1089 which is the same as #647.
Kind of fixes #933. Clicking *Load more* won't rewrite the url, but scrolling will. *Load more* is actually a link but it doesn't do the expected thing when used as a link, that's to be fixed later.
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/5826
-- Commit Summary --
* Rewrite history page url when scrolling
* Scroll to first/last changeset in history list if before/after param is given
* Rename changeset loader functions
* Remove params from url when viewing place history and map is moved
-- File Changes --
M app/assets/javascripts/index/history.js (91)
M test/system/history_test.rb (24)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/5826.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5826.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5826
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5826 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250319/ea144248/attachment.htm>
More information about the rails-dev
mailing list