Manual child order for guides (#37) #40

Merged
miko merged 1 commit from feature/37-manual-guide-order into development 2026-11-02 15:37:53 +01:00
Owner

Closes #37

Guides get a position among the guides of their category. They are arranged separately from subcategories, but the category's single child-order switch governs both lists.

  • Guide.position. The migration numbers existing guides per category alphabetically by title.
  • Category pages list guides in the category's child order. In manual order, the title breaks ties.
  • Switching a category to manual numbers its subcategories and its guides in their current alphabetical order.
  • /admin/categories/[id] lists all non-deleted guides, with drafts marked. Up/down buttons (moveGuide) appear only in manual order. ArrangeChildren is now generic and used for both lists.
  • New, recategorised and restored guides go last. Other saves keep the position, and deleted guides keep theirs.
  • sortChildren and positionOnArrival live in src/categories/childOrder.ts and are shared with the category tree and saveCategory.

Tests: unit tests for the ordering and "goes last" rules. New Playwright test: an admin switches a category to manual, moves a guide up, and a guest sees the new order.

Notes

  • The migration sorts with the database collation, so "Step 10" comes before "Step 2", while the app sorts numbers naturally. This only matters for categories that were already in manual order when the migration ran.
  • In manual order, subcategories with equal positions are now also ordered by title.
  • The image-upload step in authoring.spec.ts and access.spec.ts sometimes fails with a server error when the tests run in parallel. This also happens on development and is unrelated to this change.

🤖 Generated with Claude Code

Closes #37 Guides get a position among the guides of their category. They are arranged separately from subcategories, but the category's single child-order switch governs both lists. - `Guide.position`. The migration numbers existing guides per category alphabetically by title. - Category pages list guides in the category's child order. In manual order, the title breaks ties. - Switching a category to manual numbers its subcategories and its guides in their current alphabetical order. - `/admin/categories/[id]` lists all non-deleted guides, with drafts marked. Up/down buttons (`moveGuide`) appear only in manual order. `ArrangeChildren` is now generic and used for both lists. - New, recategorised and restored guides go last. Other saves keep the position, and deleted guides keep theirs. - `sortChildren` and `positionOnArrival` live in `src/categories/childOrder.ts` and are shared with the category tree and `saveCategory`. **Tests:** unit tests for the ordering and "goes last" rules. New Playwright test: an admin switches a category to manual, moves a guide up, and a guest sees the new order. **Notes** - The migration sorts with the database collation, so "Step 10" comes before "Step 2", while the app sorts numbers naturally. This only matters for categories that were already in manual order when the migration ran. - In manual order, subcategories with equal positions are now also ordered by title. - The image-upload step in `authoring.spec.ts` and `access.spec.ts` sometimes fails with a server error when the tests run in parallel. This also happens on `development` and is unrelated to this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Guides get a position among the guides of their category, arranged
separately from subcategories but governed by the same child-order switch.

- Guide.position; the migration numbers existing guides per category
  alphabetically by title
- Category pages list guides in the category's child order (title breaks
  ties in manual order)
- Switching a category to manual numbers its guides alphabetically
- /admin/categories/[id] lists all non-deleted guides (drafts marked) with
  up/down buttons in manual order (moveGuide)
- New, recategorised and restored guides go last; other saves keep the
  position
- sortChildren and positionOnArrival in childOrder.ts, shared with the
  category tree and saveCategory; ArrangeChildren made generic
- Playwright: admin switches to manual, moves a guide up, guest sees it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
miko merged commit 825929874e into development 2026-11-02 15:37:53 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MassiveDynamic/kataba!40
No description provided.