AI Implementation feature(896): Admin Area General Settings and Categories 1.14 (#36)

This commit was merged in pull request #36.
This commit is contained in:
2026-07-22 18:38:15 +00:00
parent f827a3a69c
commit ef9926dfc1
8 changed files with 483 additions and 301 deletions
+24 -1
View File
@@ -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