Skip to content

OBJ-105 — UI: template picker + Save as template - #47

Merged
objectgyan merged 1 commit into
mainfrom
objectgyan/obj-105-m114-ui-template-picker-save-as-template-on-editor
May 17, 2026
Merged

objectgyan merged 1 commit into
mainfrom
objectgyan/obj-105-m114-ui-template-picker-save-as-template-on-editor

Conversation

@objectgyan

Copy link
Copy Markdown
Owner

Summary

  • New-document flow with "Start from" template dropdown (GET /api/templates → POST /api/documents?fromTemplate={id})
  • "Save as template" button + dialog on the document editor (POST /api/templates) with success toast
  • /templates manage page: list, edit name/description (PUT), delete with confirm

Test plan

  • pnpm lint passes
  • pnpm typecheck passes
  • pnpm build passes
  • Playwright: pick-template → create-doc → editor pre-populated with template sections
  • Playwright: blank document creation (default "Blank document" option)
  • Playwright: Save as Template dialog → toast → template visible in API
  • Playwright: /templates page list/edit/delete
  • Playwright: snapshot semantics — doc body unchanged after template mutation
  • scripts/validate-obj-105.ps1 exits 0

- DocumentsPage: New-document form with "Start from" dropdown (GET /api/templates)
  and Create button that calls POST /api/documents?fromTemplate={id} or blank doc
- DocumentPage: "Save as template" button opens SaveAsTemplateDialog (POST /api/templates)
  with name + description; success toast on completion
- TemplatesPage at /templates: list, edit name/description (PUT), delete with confirm
- api.ts: fetchTemplates, fetchTemplate, createTemplate, updateTemplate, deleteTemplate,
  createDocumentFromTemplate, createDocument API client functions
- App.tsx: /templates route added
- Playwright tests (template-picker.spec.ts): 5 tests covering all acceptance criteria
  including snapshot semantics (doc body unchanged after template mutation)
- scripts/validate-obj-105.ps1: full validation with DB + Playwright assertions, exit 0
@linear-code

linear-code Bot commented May 17, 2026 •

Copy link
Copy Markdown
OBJ-105 M11.4 — UI: template picker + "Save as template" on editor

Milestone: M11 · Wave: 3 (UI; depends on M11.2 + M11.3 + OBJ-91 editor)

Summary

Add template UX to the test UI:

  1. Template picker on the "new document" flow — a dropdown lists templates from GET /api/templates; selecting one calls POST /api/documents?fromTemplate=…; "Blank document" remains the default option.
  2. "Save as template" button on the editor (OBJ-91) — opens a small dialog asking for template name + description, then POSTs the current document body to /api/templates.
  3. Manage screen /templates — list, edit name/description, delete.

Acceptance

  • New-document flow shows a dropdown with available templates + "Blank" default
  • Selecting a template + clicking Create lands on the editor pre-populated with the template body
  • "Save as template" from the editor creates a row in document_templates and shows a toast with the new template's name
  • /templates page lists, edits, and deletes templates
  • Validation failures from M11.2 surface inline

Validation

  • DB check: Playwright UI test → "Save as template" → SELECT body FROM document_templates WHERE name=… matches the editor state
  • Live API check: UI test exercises pick-template → create-doc → mutate-template → reopen-doc and asserts the doc body unchanged (instantiation snapshot semantics)
  • Script: scripts/validate-obj-NNN.ps1

Branch / PR

Branch from main; target main. No trailers/footer.

Review in Linear

@objectgyan
objectgyan merged commit 7bfe9b5 into main May 17, 2026
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