Skip to content

feat(spa): detail page opens read-only details by default (#682) + 1.13.0#683

Merged
MartinCastroAlvarez merged 1 commit into
mainfrom
feat/detail-default-readonly-682
Jun 2, 2026
Merged

feat(spa): detail page opens read-only details by default (#682) + 1.13.0#683
MartinCastroAlvarez merged 1 commit into
mainfrom
feat/detail-default-readonly-682

Conversation

@MartinCastroAlvarez
Copy link
Copy Markdown
Owner

Closes #682.

Summary

A record page — including the Django-admin /<app>/<model>/<pk>/change/ URL alias — now opens the read-only details view by default instead of the edit form. A shared link is safe to open: the viewer reads the record and clicks the toolbar Edit to flip into edit mode in place.

What changed

  • Dropped the route-forced initialEditing: the /change route now renders the same <DetailPage /> as the bare /<pk> route. Edit mode derives solely from ?edit=1.
  • ?edit=1 still deep-links straight to edit and lands the "Save and continue editing" round-trip there. View-only users never see the Edit button. The add form (/add/) is unaffected.

The read/edit split, FK→linked-label + choice-display rendering (#184), and read-only inlines (#54) already existed — the only real bug was /change/ forcing edit. So this is a small, contained default-mode flip rather than new rendering machinery.

Acceptance criteria (#682)

  • /change/ renders details mode by default — no inputs, no Save, no inline "Add another".
  • Toolbar Edit flips to edit in place (no reload); edit mode shows the form's Cancel + Save row.
  • ?edit=1 deep-links to edit.
  • View-only users see details only, no Edit button.
  • Inlines render read-only in details, editable in edit.
  • FK/M2M/autocomplete render as linked labels in details mode.
  • No regression for /add/.
  • Mode coverage: new DetailPage tests pin read-default, the /change alias, ?edit=1 → edit, and the view-only case.

Note on the "Storybook story" ask

This repo has no Storybook setup (test infra is vitest). Equivalent coverage is the new DetailPage.test.tsx mode tests + the existing examples/jobs fixture, which already exercises FK/choice/JSON/textarea field kinds. Happy to add Storybook separately if you want the visual-snapshot harness.

Validation

DetailPage suite 10 passed; eslint (max-warnings 0), web typecheck, dark-mode coverage all green. Minor release 1.13.0. No backend / form-spec contract change.

🤖 Generated with Claude Code

…13.0

Visiting a record — including the Django-admin `/<pk>/change/` URL alias —
now opens the read-only DETAILS view instead of the edit form. A shared link
is safe to open: the viewer reads the record (FK/M2M as linked labels,
choices as display labels, inlines as read-only tables) and clicks the
toolbar Edit button to flip into edit mode in place. `?edit=1` still
deep-links straight to edit and lands the "Save and continue editing"
round-trip there; view-only users never see Edit. The add form is
unaffected.

Implementation: drop the route-forced `initialEditing` (the `/change` route
now renders the same `<DetailPage />` as `/<pk>`); edit mode derives solely
from `?edit=1`. The read/edit rendering split, FK-link/choice rendering, and
read-only inlines already existed — only the default mode changed. Adds
DetailPage tests for read-default, the `/change` alias, `?edit=1`, and the
view-only case. No backend / form-spec change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MartinCastroAlvarez MartinCastroAlvarez merged commit 1b33019 into main Jun 2, 2026
6 checks passed
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.

Detail-page default: open in read-only details view, not edit mode (Edit button flips to form)

2 participants