Templates can now contain nested templates, so that creating a document
from a template produces a matching document hierarchy.
Backend:
- Add parentDocumentId to the Template model with parent/child
associations, cycle detection, and child traversal helpers
- templates.create and templates.update accept parentDocumentId; nested
templates always inherit the collection of their parent
- templates.duplicate recursively copies nested templates
- templates.delete and templates.restore cascade through the subtree
- Moving a root template to another collection moves nested templates
- templates.list supports filtering by parentDocumentId and returns a
childCount for each template
- documents.create from a template recursively instantiates nested
templates as child documents when publishing
- documents.templatize accepts a recursive flag to convert a document
subtree into a nested template tree, preserving structure order
Frontend:
- Templates settings table renders an expandable tree of root templates
- Template editor shows ancestor breadcrumbs and a nested templates
section with the ability to create nested templates
- New nested template action in template menus
- Templatize dialog offers to include nested documents
- Template pickers only list root templates
Closesoutline/outline#8577
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tn2fWK73sGUVsMZ8XoLAY1