docs(quick-261007-qgx): record heading from translatable fields

This commit is contained in:
Jakub Zych
2026-10-07 19:07:34 +02:00
parent b6b194e5eb
commit 40a2a6584c
3 changed files with 53 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
---
quick_id: 261007-qgx
mode: quick
---
# Quick 261007-qgx: admin record heading uses translatable (mltext) fields
The admin record heading, breadcrumb record crumb and document title read the
first `text` field only, so records whose name field is `mltext` (journal Post
title, Category name) fall back to "Edit record".
## Task 1: shared recordDisplayName helper
- files: admin/src/components/form/formState.ts, admin/src/views/FormView.vue, admin/src/views/PreviewView.vue
- action: add `recordDisplayName(fields, values, enabledLocales)`: first field
of type `text` or an ML type (`isMLFieldType`) in schema order; plain values
as today (string/number, trimmed); ML values use the default (first enabled)
locale, else the first non-empty locale, else ''. Both views use it with
`schemaEnabledLocales(schema.meta)`.
- done: plain `text` behaviour unchanged; an mltext first field names the record.
## Task 2: tests
- files: admin/tests/form/formState.test.ts, admin/tests/form/FormView.test.ts, admin/tests/form/PreviewView.test.ts
- action: helper cases (plain, default locale filled, default empty + other
filled, all empty, non-text first field skipped); FormView and PreviewView
show the default-locale value as heading and record crumb for an mltext field.
- verify: `npm test`, `vue-tsc --noEmit`.
## Task 3: ship
- rebuild the embedded admin shell (`npm run build` → modules/boardwalk/dist),
`go vet ./... && go test ./...`, tag and push v0.1.12.

View File

@@ -0,0 +1,18 @@
---
quick_id: 261007-qgx
status: complete
commits: [a714bb4, b6b194e]
---
# Quick 261007-qgx: admin record heading uses translatable (mltext) fields
- `recordDisplayName(fields, values, enabledLocales)` in
`admin/src/components/form/formState.ts`: the first `text` or ML field in
schema order names the record; an ML value reads the default (first enabled)
locale, then the first non-empty locale, else '' (the generic message stays).
- FormView and PreviewView both use it with `schemaEnabledLocales(schema.meta)`;
plain `text` behaviour is unchanged.
- Tests: five helper cases in `formState.test.ts`; FormView and PreviewView
cases for an mltext first field (heading and record crumb). Both view tests
fail without the fix. Admin suite 1090/1090, `go vet` and `go test ./...` green.
- Embedded admin shell rebuilt (`modules/boardwalk/dist`), shipped as v0.1.12.