Add previous/next entry navigation to diary pages #6901#7038
Conversation
d009b97 to
8bf648a
Compare
Insert a nav bar above the comments with 'Previous Entry' and 'Next Entry' they serve as UI placeholders and still need logic implemented.
Adds logic to select adjacent diary entries for a user and links the navigation buttons accordingly. Uses Arel predicates for previous/next queries to avoid raw SQL and satisfy linting rules.
Add tests covering diary entry navigation behaviour, including cases for first and last entries. Includes minor updates to navigation markup and missing locale keys required for tests to pass.
8bf648a to
4f763ca
Compare
|
Update: The implementation now includes backend logic and tests for previous/next diary entry navigation. The PR is now fully functional and fetches adjacent entries. |
|
Thanks for the feedback! I've updated the button styling to match the existing buttons. I'll also look into moving the logic to I do see what you mean about it feeling a bit busy. do you have any suggestions on how to make it feel less messy? |
|
Not sure, but it's more a question for the maintainers. I'd want to hear their opinion. Incidentally, I just had a look and saw a diary that could benefit from something like this: https://www.openstreetmap.org/user/pussreboots/diary In fact if instead of "Previous/Next entry" we had the title of the entry it would be great in this specific case. But don't go implement that yet. Let's wait for more feedback. For one, this example is not really representative of the typical diaries. |



Description
Addresses #6901 — diary pages currently have no previous/next navigation, requiring users to return to the diary overview to move between entries.
This PR adds a navigation bar above the comments section with Previous Entry and Next Entry links. The links are conditionally rendered. If there is no previous or next entry, the corresponding button is hidden.
The adjacent entries are looked up in the controller using the diary entry's ID to find the nearest entry before and after in the same user's diary.
How has this been tested?
Manually verified the nav bar renders correctly above the comments section on a diary entry page.
Three test cases were added to the diary entries controller test:
Screenshot