diff --git a/docs/specs/2026-06-21-add-book-form-design.md b/docs/specs/2026-06-21-add-book-form-design.md new file mode 100644 index 0000000..f1101c6 --- /dev/null +++ b/docs/specs/2026-06-21-add-book-form-design.md @@ -0,0 +1,169 @@ +# Spine — Add Book Form + +Adds a form to create new books in `spine.org`, plus the write function +to persist them. + +## Architecture + +``` +"Add book" link (index page) + │ + GET /add + │ +templates/add.mustache ←── [spine-index-model] for datalist values + │ + POST /add (form submission) + │ + [spine-add-book] ──→ writes to spine.org + │ + redirect to /index +``` + +## Template: `templates/add.mustache` + +A new Mustache template with the Pico CSS + Tabler Icons shell (matching the +index page) and a `
`. + +**View model:** + +```json +{ + "app_title": "spine", + "existing_authors": ["Ursula K. Le Guin", "Frank Herbert", ...], + "existing_categories": ["scifi", "literary", ...] +} +``` + +`existing_authors` and `existing_categories` are extracted from the current +`spine-books` results. Empty lists are fine — the `` just has no +options. + +**Form fields:** + +| Field | Input type | Required | Notes | +|---|---|---|---| +| date_added | `` | no | defaults to today | +| title | `` | **yes** | | +| author | `` | no | datalist from existing | +| category | `` | no | datalist from existing tags | +| format | `` | no | | +| cover | `` | no | path relative to spine.org | +| rec_by | `` | no | recommender name | +| rec_note | `` | no | why it's on your radar | +| initial_note | `