docs: update documentation to OKF v0.1 format
This commit is contained in:
@@ -3,7 +3,7 @@ type: guide
|
||||
title: Admin — Categories
|
||||
description: How an admin lists, creates, edits, and deletes challenge categories from the /admin/categories page, including system-row protection and challenge-attached protection.
|
||||
tags: [guide, admin, categories, tester]
|
||||
timestamp: 2026-07-22T12:00:00Z
|
||||
timestamp: 2026-07-22T18:37:00Z
|
||||
---
|
||||
|
||||
# When this view is available
|
||||
@@ -89,6 +89,29 @@ side-nav (categories are also embedded inside the General settings page).
|
||||
file is selected, the new icon is uploaded first and the returned
|
||||
`publicUrl` replaces `iconPath` in the same update.
|
||||
|
||||
### Edit prefill mechanics
|
||||
|
||||
When the parent sets `open=true` + `mode='edit'` + a `category`, a
|
||||
constructor `effect()` runs `syncCategoryForm(form, mode, category)`
|
||||
which:
|
||||
|
||||
* writes `name`, `abbreviation`, `description` via per-control
|
||||
`setValue(..., { emitEvent: false })`,
|
||||
* marks every control pristine + untouched so validators do not flash
|
||||
errors on a freshly opened modal,
|
||||
* returns `{ abbreviationReadonly: category.isSystem === true,
|
||||
iconPreview: category.iconPath || null }` which the effect pushes
|
||||
into `abbreviationReadonly` and `iconPreview` signals and clears
|
||||
`iconFile`,
|
||||
* and triggers `ChangeDetectorRef.markForCheck()` so the OnPush view
|
||||
repaints the freshly-patched `<input>` / `<textarea>` values.
|
||||
|
||||
Switching back to `mode='create'` with `category=null` re-invokes the
|
||||
helper, which resets every control to `''` and unlocks the abbreviation
|
||||
input. `syncCategoryForm` is exported from the modal file so it can be
|
||||
exercised in isolation by
|
||||
`tests/frontend/admin-categories-form-modal.spec.ts`.
|
||||
|
||||
## Delete behavior
|
||||
|
||||
* **System rows:** the delete modal renders
|
||||
|
||||
Reference in New Issue
Block a user