diff --git a/openspec/specs/admin-settings/spec.md b/openspec/specs/admin-settings/spec.md index a3f0a20..fe21470 100644 --- a/openspec/specs/admin-settings/spec.md +++ b/openspec/specs/admin-settings/spec.md @@ -1,17 +1,18 @@ --- -status: reviewed +status: enriched reviewed_date: 2026-02-28 +enriched_date: 2026-03-20 --- # Admin Settings Specification ## Purpose -Defines the admin settings panel for the NL Design app. The settings panel is located in Nextcloud's administration area under the Theming section. It provides controls for selecting the active token set, toggling the hide slogan feature, toggling show menu labels, and previewing the selected theme. The UI is built with vanilla PHP templates and vanilla JavaScript (no Vue or webpack). +Defines the admin settings panel for the NL Design app. The settings panel is located in Nextcloud's administration area under the Theming section. It provides controls for selecting the active token set, toggling the hide slogan feature, toggling show menu labels, and previewing the selected theme. The UI is built with vanilla PHP templates and vanilla JavaScript (no Vue or webpack). Additionally, the panel hosts the token editor for customizing individual Nextcloud CSS tokens, and triggers the theming sync dialog when a token set with theming metadata is selected. ## Requirements ### REQ-ASET-001: Settings Panel Registration -The admin settings panel MUST be registered in the Nextcloud Theming section. +The admin settings panel MUST be registered in the Nextcloud Theming section with a defined priority. #### Scenario: Settings panel appears in admin area - GIVEN the nldesign app is enabled @@ -20,37 +21,85 @@ The admin settings panel MUST be registered in the Nextcloud Theming section. - AND it MUST have priority 50 (via `Admin::getPriority()`) - AND it MUST be in the `theming` section (via `Admin::getSection()`) -#### Scenario: Settings panel loads template +#### Scenario: Settings panel position relative to Nextcloud theming +- GIVEN Nextcloud's built-in theming settings have default priority +- WHEN the admin views the Theming settings page +- THEN the NL Design section MUST appear below the default Nextcloud theming section +- AND both sections MUST be independently scrollable + +#### Scenario: Settings panel is absent when app is disabled +- GIVEN the nldesign app is not enabled +- WHEN the admin navigates to Settings -> Administration -> Theming +- THEN the "NL Design System Theme" section MUST NOT appear +- AND no nldesign CSS MUST be injected into the page + +### REQ-ASET-002: Template Response and Parameters +The settings form MUST return a `TemplateResponse` with all required parameters for the admin template. + +#### Scenario: Settings panel loads template with all parameters - GIVEN the admin opens the NL Design settings panel - WHEN `Admin::getForm()` is called - THEN it MUST return a `TemplateResponse` for `settings/admin` -- AND the template parameters MUST include `tokenSets` (array of all available token sets) -- AND the template parameters MUST include `currentTokenSet` (string, current active token set id) -- AND the template parameters MUST include `hideSlogan` (boolean) -- AND the template parameters MUST include `showMenuLabels` (boolean) +- AND the template parameters MUST include `tokenSets` (array of all available token sets from `TokenSetService::getAvailableTokenSets()`) +- AND the template parameters MUST include `currentTokenSet` (string, current active token set id, default `'nextcloud'`) +- AND the template parameters MUST include `hideSlogan` (boolean, from IConfig `hide_slogan` compared with `=== '1'`) +- AND the template parameters MUST include `showMenuLabels` (boolean, from IConfig `show_menu_labels` compared with `=== '1'`) + +#### Scenario: Token sets include design system metadata +- GIVEN `Admin::getForm()` retrieves token sets +- WHEN the `tokenSets` parameter is populated +- THEN each token set object MUST have `id`, `name`, `description`, and `design_system` fields +- AND token sets with theming metadata MUST include the `theming` object + +#### Scenario: Default values for fresh installation +- GIVEN nldesign is freshly installed with no configuration +- WHEN `Admin::getForm()` is called +- THEN `currentTokenSet` MUST be `'nextcloud'` +- AND `hideSlogan` MUST be `false` +- AND `showMenuLabels` MUST be `false` -### REQ-ASET-002: Token Set Selector -The settings panel MUST provide a dropdown for selecting the active design token set. +### REQ-ASET-003: Token Set Selector Dropdown +The settings panel MUST provide a searchable dropdown for selecting the active design token set from all available sets. #### Scenario: Dropdown populated with token sets - GIVEN the settings panel is loaded - AND there are multiple token sets available (discovered from `css/tokens/` directory) - WHEN the dropdown renders -- THEN it MUST contain an `