Skip to content

Remove obsolete standalone leaf creation forms - #498

Open
dersam wants to merge 1 commit into
basecamp:mainfrom
dersam:experiment/remove-leafable-new-flow
Open

dersam wants to merge 1 commit into
basecamp:mainfrom
dersam:experiment/remove-leafable-new-flow

Conversation

@dersam

@dersam dersam commented Oct 15, 2026 •

Copy link
Copy Markdown

The book controls create a Leaf and its content record directly. They do not use the separate new pages.

The old routes remained after the UI changed. On the checked branch base (057f098), all three creation pages failed. The action assigned @leafable, but the templates expected @page, @picture, or @section. The shared forms also required an existing Leaf and submitted PUT requests.

This PR removes the broken flow.

History

Dates below are the upstream PR merge dates.

Date Change References
2024-04-15 Replaced links to all three new routes with forms that create pages directly from the type picker. PR #56 — New page creation flow, commit 4774da5
2024-05-29 Added drag creation and extracted book_part_create_button. The PR describes click-to-create as existing behavior. PR #96 — Drag to add, commit a6710d0
2024-05-29 Extracted LeafablesController. The new action used @leafable, while the templates retained their named variables. PR #97 — Move title to leaf, commit 0f45743
2024-06-06 Changed the shared forms to PUT to leafable_path(record.leaf), which requires an existing Leaf. PR #104 — Autosave, commit 20a6da8

PR #56 states the intended flow:

Adds a dynamic flow that allows you to add and name pages as you go, right on the TOC (books#show).

Compatibility

The former /books/:book_id/pages/new, /books/:book_id/pictures/new, and /books/:book_id/sections/new URLs return HTTP 404.

The history shows that the current UI does not require these URLs.

@dersam
dersam marked this pull request as ready for review October 15, 2026 18:58
Copilot AI balanced review requested due to automatic review settings October 15, 2026 18:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

Static review found no blocking issues in this focused removal; regression coverage is added, but tests were not executed.

0 open findings

What changed in this PR

Removes obsolete standalone creation forms while preserving the existing book-control creation flow.

Changes:

  • Removes the shared new action, routes, and three templates.
  • Adds regression tests for retired URLs and picture creation.
  • Documents the supported creation flow and HTTP 404 behavior.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
test/​controllers/​sections_controller_test.rb Tests retired URL returns 404.
test/​controllers/​pictures_controller_test.rb Tests retired URL and direct creation.
test/​controllers/​pages_controller_test.rb Tests retired URL returns 404.
README.md Documents supported creation flow.
config/​routes.rb Removes three new routes.
app/​views/​sections/​new.html.erb Deletes obsolete section form.
app/​views/​pictures/​new.html.erb Deletes obsolete picture form.
app/​views/​pages/​new.html.erb Deletes obsolete page form.
app/​controllers/​leafables_controller.rb Removes unused new action.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants