feat(spa): detail page opens read-only details by default (#682) + 1.13.0#683
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
initialEditing: the/changeroute now renders the same<DetailPage />as the bare/<pk>route. Edit mode derives solely from?edit=1.?edit=1still 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".?edit=1deep-links to edit./add/.DetailPagetests pin read-default, the/changealias,?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.tsxmode tests + the existingexamples/jobsfixture, which already exercises FK/choice/JSON/textarea field kinds. Happy to add Storybook separately if you want the visual-snapshot harness.Validation
DetailPagesuite 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