feat(16.2-01): translatable plugin fields, element uploads and save notices in the admin
- MLPluginField wraps PluginField in the MLField locale switcher; the
element gets the active content locale and that locale's string
- isMLField treats a translatable plugin field as a locale map in the form
state, FormView adopt and the relation child modal
- summer-upload posts the file with the admin session to the field upload
route and answers summer-upload-result {id, url} or {id, error}
- noticeLines shows meta.notices under each field as a warning status line
(text only) and in the saved toast; the stored value is reloaded
- docs/backend/field-types.md documents the full element contract;
modules/boardwalk/dist rebuilt
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
focusField,
|
||||
initialValues,
|
||||
mergeMLValue,
|
||||
noticeLines,
|
||||
panelDomId,
|
||||
presetUpdates,
|
||||
presetValue,
|
||||
@@ -302,3 +303,24 @@ describe('recordDisplayName', () => {
|
||||
expect(recordDisplayName(fields, { notify: true, tags: [1], title: { en: 'Post', pl: '' }, name: 'Anna' }, locales)).toBe('Post')
|
||||
})
|
||||
})
|
||||
|
||||
describe('noticeLines', () => {
|
||||
it('maps notices to lines per field, prefixing the content locale', () => {
|
||||
expect(
|
||||
noticeLines([
|
||||
{ field: 'content', locale: 'pl', message: '2 elements were removed: style, iframe' },
|
||||
{ field: 'content', locale: 'en', message: 'A script was removed' },
|
||||
{ field: 'notes', message: 'Trimmed' },
|
||||
]),
|
||||
).toEqual({
|
||||
content: ['PL: 2 elements were removed: style, iframe', 'EN: A script was removed'],
|
||||
notes: ['Trimmed'],
|
||||
})
|
||||
})
|
||||
|
||||
it('is empty without notices', () => {
|
||||
expect(noticeLines(undefined)).toEqual({})
|
||||
expect(noticeLines([])).toEqual({})
|
||||
expect(noticeLines([{ field: 'x', message: '' }])).toEqual({})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user