feat(mail): one admin record per mail template with a locale switcher
Gap G-35-1 (supersedes D-05), tracer slice: - postcard: migration 202611130001_mail_template_base_code (base_code column and index); SyncIndex writes base_code; EnsureLocaleRows creates the <template>-<locale> rows of locales that ship no file; TemplateBase and Catalog.TemplateFor; send, preview and validation resolve a missing <template>-<locale> to the locale's customization, else the base's customization, else the base file. Names with their own file send as before. - cabana: mail locales are the translator's plus the TranslationWriter's enabled locales; sync ensures the locale rows and re-syncs when the locale set changes; record lookups admit fallback-locale rows; the record title is the base code; RecordMeta.LocaleVariants (RecordLocaleVariant) on the show and update responses. - admin: LocaleVariantSwitcher in the update form header, from meta.localeVariants, behind the unsaved-changes confirm. - tests: TestMailOverrideSmoke/locale_fallback, TestMailScreensSmoke/locales, LocaleVariantSwitcher.test.ts.
This commit is contained in:
@@ -107,6 +107,26 @@ describe('FormView mail footer actions and meta.deletable', () => {
|
||||
expect(absent.wrapper.find('[data-action="delete"]').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('shows the locale switcher from meta.localeVariants when there are two or more', async () => {
|
||||
const two = await mountApp(
|
||||
'/summercms/cabana/mailtemplates/7',
|
||||
routes({
|
||||
[`GET ${RECORD}`]: mailRecord({
|
||||
localeVariants: [
|
||||
{ id: 7, locale: '', label: 'Default', states: [], current: true },
|
||||
{ id: 9, locale: 'de', label: 'de', states: ['Customized'], current: false },
|
||||
],
|
||||
}),
|
||||
}),
|
||||
)
|
||||
const select = two.wrapper.find<HTMLSelectElement>('header select[data-locale-variant]')
|
||||
expect(select.exists()).toBe(true)
|
||||
expect(select.findAll('option').map((option) => option.text())).toEqual(['Default', 'de — Customized'])
|
||||
|
||||
const none = await mountApp('/summercms/cabana/mailtemplates/7', routes())
|
||||
expect(none.wrapper.find('[data-locale-variant]').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('toasts 403 and 409 paths from record actions', async () => {
|
||||
const forbidden = await mountApp(
|
||||
'/summercms/cabana/mailtemplates/7',
|
||||
|
||||
Reference in New Issue
Block a user