Skip to content

Add previous/next record navigation to backend forms - #1510

Merged
LukeTowers merged 1 commit into
wip/1.3from
wip/form-record-navigation
Aug 11, 2026
Merged

Add previous/next record navigation to backend forms#1510
LukeTowers merged 1 commit into
wip/1.3from
wip/form-record-navigation

Conversation

@LukeTowers

@LukeTowers LukeTowers commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

record-nav-closeup record-nav-in-breadcrumb

Adds an optional record navigation control to backend forms: a compact current / total indicator with previous/next arrows pinned to the right of the breadcrumb row on update/preview pages. It lets operators step through the sibling records of the controller's list without returning to it, honouring the list's active filters, search and sorting.

Enabled by default; opt out per controller with recordNavigation: false in config_form.yaml. Renders nothing when the controller has no ListController behaviour or when creating a new record.

Why / cross-database

Projects commonly hand-roll this per controller with a MySQL-only SET @row_num trick that breaks on SQLite/Postgres/SQL Server. This keeps the position math database-agnostic:

  • the ordered keys come from the ListController's already-prepared query, so filters/search/sort are respected for free;
  • they're read once with a portable pluck, and the current record's neighbours are resolved in PHP via the pure resolveRecordPosition() helper — no driver-specific SQL, no window functions, no session variables.

What's included

  • FormController::formGetRecordNavigation() + formRenderRecordNavigation(), and the pure resolveRecordPosition() helper
  • formcontroller/partials/_record_navigation.php, wired into the standard/sidebar/fancy update and preview layouts
  • backend::lang.form.record_navigation / previous_record / next_record
  • Styles in assets/less/controls/record-navigation.less
  • Unit tests: FormControllerRecordNavigationTest (empty / first / middle / last / not-found / loose-typed / string keys)

Screenshots

Notes

  • recordNavigation defaults to true; set false to disable per controller.
  • Hotkeys: ctrl/cmd + up (previous), + down (next).

🤖 Generated with Claude Code

Adds an optional, opt-out `recordNavigation` feature that renders a compact
previous/next control in the breadcrumb row of update/preview forms, letting
operators step through the sibling records of the controller's list while
honouring its active filters, search and sorting.

The position math (`resolveRecordPosition`) is a pure, database-agnostic
helper: the ordered keys are read once via a portable `pluck` and the current
record's neighbours are resolved in PHP — no driver-specific SQL (no `@row_num`
session variables, no version-gated window functions) — so it behaves
identically across every database Winter supports.

- `FormController::formGetRecordNavigation()` / `formRenderRecordNavigation()`
  plus the pure `resolveRecordPosition()` helper
- Rendered via `formcontroller/partials/_record_navigation.php`, wired into the
  standard/sidebar/fancy update and preview layouts
- Enabled by default; opt out with `recordNavigation: false` in config_form.yaml
- Unit tests for the position math; styles in `controls/record-navigation.less`

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9401aa82-c364-4121-b184-59298de12158

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@LukeTowers
LukeTowers merged commit 2bd1ef8 into wip/1.3 Aug 11, 2026
5 of 15 checks passed
@LukeTowers
LukeTowers deleted the wip/form-record-navigation branch August 11, 2026 17:51
@LukeTowers LukeTowers added this to the 1.3.0 milestone Aug 11, 2026
LukeTowers added a commit that referenced this pull request Aug 13, 2026
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant