QLFW-88: показать работу панели управления #79
@ -35,6 +35,7 @@
|
||||
- QLFW-53: адрес книги ermek-serkebayev зарезервирован за отдельной страницей; loadBookCover проверяет файл на главной, в каталоге и на странице книги, при ENOENT колонки обложки нет.
|
||||
- QLFW-82: .gitea/peppa-deploy.sh проверяет HTTP 200 по уникальному сетевому SERVICE_ALIAS из Compose после up --wait; образ для отката ищется по сервису Compose, поэтому переименование контейнера не ломает проверку и откат.
|
||||
- QLFW-84: .home-card-grid заполняет неполные ряды направлений и проектов на главной. Снимки и проверка геометрии трёх языков воспроизводятся через evidence/capture.mjs в архиве change.
|
||||
- QLFW-88: вводный текст «Контактов» хранится в локализованном SiteSettings.intro; пустое поле использует словарь. Для проверки CRUD новости и события создаются отдельными записями в изолированной базе, снимки и сценарий находятся в архиве change.
|
||||
|
||||
## Грабли
|
||||
- QLFW-6: админка — коллекции Projects/Media, глобалы About (текст на /about) и SiteSettings (контакты); у новостей поле cover приоритетнее imageUrl (newsImage). Миграции пишем руками (снапшотов нет). Тесты страниц мокают ./content — новые загрузчики (loadProjects/loadSettings/loadAbout) добавлять в моки. Инструкция: docs/admin-guide.md.
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
3. Если почта или пароль введены неверно, панель так и скажет — проверьте раскладку клавиатуры и попробуйте ещё раз.
|
||||
|
||||
## Три языка
|
||||
Вверху страницы редактирования есть переключатель языка: «Русский», «Қазақша», «English». Заполните каждый язык отдельно и сохраните. Панель запоминает последний выбранный язык — перед вводом текста проверьте, какой язык выбран сейчас. Если на каком-то языке текст не заполнен, на сайте на этом языке он не показывается (чужой язык вместо него не подставляется).
|
||||
Вверху страницы редактирования есть переключатель языка: «Русский», «Қазақша», «English». Заполните каждый язык отдельно и сохраните. Панель запоминает последний выбранный язык — перед вводом текста проверьте, какой язык выбран сейчас. Сайт показывает содержимое на языке страницы. Если вводный текст «Контактов» оставить пустым, сайт покажет стандартный текст на этом языке.
|
||||
|
||||
## Как добавить проект
|
||||
1. «Проекты» → «Создать».
|
||||
@ -34,7 +34,7 @@
|
||||
|
||||
## Как изменить «О фонде» и «Контакты»
|
||||
- «О фонде» — вступительный текст и фото страницы «О фонде» на трёх языках. Он показывается над остальными разделами страницы; пока он не заполнен, его просто нет. Учредитель, директор и попечительский совет — в разделе «Руководство фонда».
|
||||
- «Контакты и соцсети» — почта, телефон, адрес и ссылки на соцсети (ссылка начинается с `https://`). Они показываются на странице «Контакты».
|
||||
- «Контакты и соцсети» — вводный текст страницы «Контакты», почта, телефон, адрес и ссылки на соцсети (ссылка начинается с `https://`). Вводный текст и адрес можно заполнить отдельно на каждом языке.
|
||||
|
||||
## Как поменять руководство фонда
|
||||
1. В меню слева откройте «Руководство фонда».
|
||||
|
||||
@ -69,3 +69,4 @@
|
||||
| Контакты и соцсети | почта, телефон, адрес, соцсети | глобал, settings | Заполняются в панели и показываются на странице «Контакты» |
|
||||
| Адрес страницы проекта | адрес страницы | slug | У каждого проекта свой адрес. Адрес книги уже занят. |
|
||||
| Подпись фотографии книги | разворот, выходные данные, фотография книги | Фото 1, Photo 1 | Короткое описание того, что видно на снимке |
|
||||
| Текст страницы контактов | Вводный текст страницы «Контакты» / «Байланыс» бетінің кіріспе мәтіні / Contacts page introduction | — | Текст под заголовком страницы на выбранном языке |
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
schema: spec-driven
|
||||
created: 2026-11-25
|
||||
@ -0,0 +1,5 @@
|
||||
## Решения
|
||||
|
||||
Добавляем локализованное необязательное поле в существующий раздел «Контакты и соцсети». При пустом значении используется текущий текст словаря на языке страницы. Обратимая миграция добавляет столбец без перезаписи существующих данных.
|
||||
|
||||
Новость и событие проверяем как две записи раздела «Новости и события». Сценарий использует настоящие интерфейс, миграции, хранение фото и страницы сайта. Отдельная база и локальный запуск сборки позволяют создавать и удалять записи без вмешательства в общий сайт фонда.
|
||||
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 311 KiB |
|
After Width: | Height: | Size: 311 KiB |
|
After Width: | Height: | Size: 313 KiB |
|
After Width: | Height: | Size: 312 KiB |
|
After Width: | Height: | Size: 312 KiB |
|
After Width: | Height: | Size: 314 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 310 KiB |
|
After Width: | Height: | Size: 312 KiB |
|
After Width: | Height: | Size: 315 KiB |
|
After Width: | Height: | Size: 311 KiB |
|
After Width: | Height: | Size: 311 KiB |
|
After Width: | Height: | Size: 311 KiB |
|
After Width: | Height: | Size: 312 KiB |
|
After Width: | Height: | Size: 315 KiB |
|
After Width: | Height: | Size: 317 KiB |
|
After Width: | Height: | Size: 314 KiB |
|
After Width: | Height: | Size: 314 KiB |
|
After Width: | Height: | Size: 313 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 144 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 31 KiB |
@ -0,0 +1,28 @@
|
||||
# Как сотрудник меняет сайт фонда
|
||||
|
||||
На общей версии для проверки открывается [создание первого сотрудника](00-staging-first-user.png). Вход и работа с материалами записаны на отдельной копии с чистой базой. Все изменения сделаны в панели, а страницы сайта проверены в отдельном окне без входа.
|
||||
|
||||
| Снимки | Что посмотреть |
|
||||
|---|---|
|
||||
| [Вход](01-login.png) · [Неверный пароль](02-login-wrong-password.png) · [Панель](03-dashboard.png) | Вход, сообщение о неверном пароле и разделы панели после входа |
|
||||
| [Загрузка фото](04-photo-uploaded.png) · [Проект](05-project-ru.png) · [Выбор языка](06-project-kk-language-switcher.png) | Загруженное фото, проект в панели и переключатель языка |
|
||||
| [Проект на сайте](07-project-ru.png) · После правки [ru](08-project-edited-ru.png), [kk](08-project-edited-kk.png), [en](08-project-edited-en.png) | Проект до и после правки на русском, казахском и английском |
|
||||
| [Новость в панели](09-news-admin-ru.png) · [Событие в панели](09-event-admin-ru.png) · [Новость после правки](11-news-edited-ru.png) · [Событие после правки](11-event-edited-ru.png) | Новость и отдельное событие в панели, на сайте и после правки на каждом языке |
|
||||
| [О фонде в панели](12-about-admin.png) и [на сайте](13-site-about-ru.png) · [Контакты в панели](14-contacts-admin.png) и [на сайте](15-site-contacts-ru.png) | Правка «О фонде» и «Контактов», включая почту, телефон, адрес и социальную сеть |
|
||||
| [Проект](16-project-deleted.png) · [Новость](16-news-deleted.png) · [Событие](16-event-deleted.png) · [Журнал проверки](run.log) | Проект, новость и событие удалены. В журнале проверки видно, что страницы исчезли на всех трёх языках |
|
||||
|
||||
## Повторить проверку
|
||||
|
||||
Соберите сайт и запустите его из чистой рабочей копии. База и фото проверочных записей должны храниться отдельно от данных фонда.
|
||||
|
||||
```sh
|
||||
pnpm build
|
||||
demo_dir=$(mktemp -d)
|
||||
DATABASE_URI="file:$demo_dir/site.db" pnpm start -H 127.0.0.1 -p 18388
|
||||
```
|
||||
|
||||
В отдельной папке установите `playwright-core`, скопируйте туда `capture.mjs` и запустите его с путём к Chromium. В качестве фотографии можно использовать `public/books/serkebayev/photo-1.jpg` из проекта. Папка снимков должна существовать.
|
||||
|
||||
```sh
|
||||
CHROMIUM_PATH=/path/to/chromium node capture.mjs /path/to/shots /path/to/photo.jpg
|
||||
```
|
||||
@ -0,0 +1,198 @@
|
||||
// QLFW-88: сквозная проверка панели /admin на локальном запуске (чистая база).
|
||||
// node capture.mjs <папка снимков> <путь к фото>
|
||||
import { chromium } from 'playwright-core'
|
||||
const [out, photo] = process.argv.slice(2)
|
||||
const B = process.env.BASE ?? 'http://localhost:18388'
|
||||
if (!['localhost', '127.0.0.1'].includes(new URL(B).hostname)) throw new Error('Use an isolated local instance')
|
||||
const mockEmail = 'staff@example.org', mockPassword = 's3cret-pass'
|
||||
const b = await chromium.launch({ executablePath: process.env.CHROMIUM_PATH ?? '/tmp/chromium', args: ['--no-sandbox', '--headless=new', '--disable-gpu', '--use-angle=swiftshader'] })
|
||||
const ctx = await b.newContext({ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 1, reducedMotion: 'reduce', locale: 'ru-RU' })
|
||||
const publicContext = await b.newContext({ viewport: { width: 1440, height: 900 }, reducedMotion: 'reduce' })
|
||||
const p = await ctx.newPage()
|
||||
p.setDefaultTimeout(20000)
|
||||
process.on('uncaughtException', async (e) => { console.log('ERR', e.message.split('\n')[0], e.stack.split('\n').find((l) => l.includes('capture.mjs')), 'url', p.url()); await p.screenshot({ path: `${out}/zz-error.png` }).catch(() => {}); process.exit(1) })
|
||||
const shot = async (name, full = false) => { await p.waitForTimeout(600); await p.screenshot({ path: `${out}/${name}.png`, fullPage: full }); console.log('shot', name) }
|
||||
const go = async (url) => { await p.goto(url.startsWith('http') ? url : B + url, { waitUntil: 'networkidle' }); await p.waitForTimeout(1500) }
|
||||
const idAfterSave = async () => { await p.waitForURL(/\/\d+(\?|$)/); return p.url().split('?')[0].split('/').pop() }
|
||||
const save = async () => { const r = p.waitForResponse((res) => /\/api\//.test(res.url()) && ['POST', 'PATCH'].includes(res.request().method())); await p.locator('#action-save').click(); const res = await r; if (!res.ok()) throw new Error('save ' + res.status()); await p.waitForTimeout(1200) }
|
||||
const site = async (path, name, expectText, present = true, image = false) => {
|
||||
const sp = await publicContext.newPage()
|
||||
const r = await sp.goto(B + path, { waitUntil: 'networkidle' })
|
||||
const txt = await sp.evaluate(() => document.body.innerText)
|
||||
const ok = (present ? r.ok() && txt.includes(expectText) : r.status() === 404 && !txt.includes(expectText))
|
||||
if (image) {
|
||||
const img = sp.locator('main img').first()
|
||||
await img.scrollIntoViewIfNeeded()
|
||||
await img.evaluate((node) => node.decode())
|
||||
}
|
||||
console.log('site', path, r.status(), present ? 'has' : 'lacks', JSON.stringify(expectText), ok ? 'OK' : 'FAIL')
|
||||
if (!ok) throw new Error('Unexpected public page: ' + path)
|
||||
if (name) await sp.screenshot({ path: `${out}/${name}.png`, fullPage: true })
|
||||
await sp.close()
|
||||
}
|
||||
|
||||
// 1. Первый сотрудник и вход
|
||||
await go(B + '/admin')
|
||||
if (p.url().includes('create-first-user')) {
|
||||
await p.fill('#field-email', mockEmail); await p.fill('#field-password', mockPassword); await p.fill('#field-confirm-password', mockPassword)
|
||||
await p.locator('button[type=submit]').click(); await p.waitForURL((u) => !u.pathname.includes('create-first-user'))
|
||||
await p.waitForLoadState('networkidle'); await p.context().clearCookies()
|
||||
}
|
||||
await go(B + '/admin/login')
|
||||
await shot('01-login')
|
||||
await p.fill('#field-email', mockEmail); await p.fill('#field-password', 'wrong')
|
||||
await p.locator('button[type=submit]').click()
|
||||
await p.getByText(/пароль неверен/i).first().waitFor()
|
||||
if (new URL(p.url()).pathname !== '/admin/login') throw new Error('Wrong password admitted')
|
||||
console.log('wrong password stays on /admin/login')
|
||||
await shot('02-login-wrong-password')
|
||||
await p.fill('#field-password', mockPassword); await p.locator('button[type=submit]').click()
|
||||
await p.waitForURL((u) => !u.pathname.includes('login')); await p.getByText('Новости и события').first().waitFor()
|
||||
await p.locator('.toast-close-button, [class*=toast] button').first().click().catch(() => {}); await p.waitForTimeout(1500)
|
||||
await shot('03-dashboard')
|
||||
|
||||
// 2. Фото
|
||||
await go(B + '/admin/collections/media/create?locale=ru')
|
||||
await p.locator('input[type=file]').setInputFiles(photo)
|
||||
await p.fill('#field-alt', 'Выставка в Алматы')
|
||||
await save()
|
||||
const mediaId = await idAfterSave()
|
||||
for (const [l, alt] of [['kk', 'Алматыдағы көрме'], ['en', 'Exhibition in Almaty']]) {
|
||||
await go(`${B}/admin/collections/media/${mediaId}?locale=${l}`)
|
||||
await p.fill('#field-alt', alt); await save()
|
||||
}
|
||||
await shot('04-photo-uploaded')
|
||||
console.log('media', mediaId)
|
||||
|
||||
// 3. Проект на трёх языках
|
||||
const proj = {
|
||||
ru: ['Выставка 2027', 'Выставка наследия казахских мастеров.', 'Первая часть выставки.\n\nВторая часть выставки.'],
|
||||
kk: ['Көрме 2027', 'Қазақ шеберлерінің мұрасы көрмесі.', 'Көрменің бірінші бөлімі.'],
|
||||
en: ['Exhibition 2027', 'An exhibition of Kazakh masters’ heritage.', 'The first part of the exhibition.'],
|
||||
}
|
||||
await go(B + '/admin/collections/projects/create?locale=ru')
|
||||
await p.fill('#field-title', proj.ru[0]); await p.fill('#field-slug', 'exhibition-2027')
|
||||
await p.fill('#field-summary', proj.ru[1]); await p.fill('#field-body', proj.ru[2])
|
||||
await save()
|
||||
const projId = await idAfterSave()
|
||||
for (const l of ['kk', 'en']) {
|
||||
await go(`${B}/admin/collections/projects/${projId}?locale=${l}`)
|
||||
await p.fill('#field-title', proj[l][0]); await p.fill('#field-summary', proj[l][1]); await p.fill('#field-body', proj[l][2])
|
||||
await save()
|
||||
}
|
||||
// обложка — через выбор существующего фото
|
||||
await go(`${B}/admin/collections/projects/${projId}?locale=ru`)
|
||||
await p.getByRole('button', { name: /существующ/i }).first().click()
|
||||
await p.locator('.list-drawer').getByText(/\.(jpe?g|png)/i).first().click()
|
||||
await p.waitForTimeout(800)
|
||||
await save()
|
||||
await shot('05-project-ru', true)
|
||||
await go(`${B}/admin/collections/projects/${projId}?locale=kk`)
|
||||
await p.locator('.localizer button, .localizer .popup-button, button:has-text("Локаль")').first().click({ timeout: 5000 }).catch(() => p.getByText('Қазақша').first().click()); await p.waitForTimeout(800)
|
||||
await shot('06-project-kk-language-switcher')
|
||||
|
||||
for (const [locale, [title, , body]] of Object.entries(proj)) {
|
||||
await site(`/${locale}/projects/exhibition-2027`, `07-project-${locale}`, body, true, true)
|
||||
await go(`/admin/collections/projects/${projId}?locale=${locale}`)
|
||||
await p.fill('#field-title', title + ' — 2028')
|
||||
await save()
|
||||
await site(`/${locale}/projects/exhibition-2027`, `08-project-edited-${locale}`, title + ' — 2028')
|
||||
}
|
||||
|
||||
const materials = [
|
||||
{
|
||||
kind: 'news',
|
||||
texts: {
|
||||
ru: ['Открытие выставки', 'Фонд открыл выставку в Алматы.'],
|
||||
kk: ['Көрменің ашылуы', 'Қор Алматыда көрме ашты.'],
|
||||
en: ['Exhibition opening', 'The foundation opened an exhibition in Almaty.'],
|
||||
},
|
||||
},
|
||||
{
|
||||
kind: 'event',
|
||||
texts: {
|
||||
ru: ['Встреча с художником', 'Фонд приглашает на встречу в Алматы.'],
|
||||
kk: ['Суретшімен кездесу', 'Қор Алматыдағы кездесуге шақырады.'],
|
||||
en: ['Meet the artist', 'The foundation invites visitors to a meeting in Almaty.'],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
for (const material of materials) {
|
||||
const { kind, texts } = material
|
||||
await go('/admin/collections/news/create?locale=ru')
|
||||
await p.fill('#field-title', texts.ru[0])
|
||||
await p.fill('#field-body', texts.ru[1])
|
||||
if (kind === 'event') {
|
||||
await p.locator('#field-kind').click()
|
||||
await p.getByText('Событие', { exact: true }).last().click()
|
||||
await p.fill('#field-place', 'Алматы')
|
||||
}
|
||||
await p.locator('#field-date input, .react-datepicker__input-container input').first().click()
|
||||
await p.locator('.react-datepicker__day--015:not(.react-datepicker__day--outside-month)').first().click()
|
||||
await p.keyboard.press('Escape')
|
||||
await p.getByRole('button', { name: /существующ/i }).first().click()
|
||||
await p.locator('.list-drawer').getByText(/\.(jpe?g|png)/i).first().click()
|
||||
await save()
|
||||
material.id = await idAfterSave()
|
||||
|
||||
for (const [locale, [title, body]] of Object.entries(texts)) {
|
||||
if (locale !== 'ru') {
|
||||
await go(`/admin/collections/news/${material.id}?locale=${locale}`)
|
||||
await p.fill('#field-title', title)
|
||||
await p.fill('#field-body', body)
|
||||
await save()
|
||||
}
|
||||
const path = `/${locale}/news/${material.id}`
|
||||
await shot(`09-${kind}-admin-${locale}`, true)
|
||||
await site(path, `10-${kind}-site-${locale}`, body, true, true)
|
||||
await p.fill('#field-title', title + ' — 2028')
|
||||
await save()
|
||||
await site(path, `11-${kind}-edited-${locale}`, title + ' — 2028')
|
||||
}
|
||||
}
|
||||
|
||||
// 5. О фонде и Контакты
|
||||
await go(B + '/admin/globals/about?locale=ru')
|
||||
await p.fill('#field-text', 'Фонд хранит и изучает наследие казахских мастеров.')
|
||||
await save()
|
||||
await shot('12-about-admin')
|
||||
await site('/ru/about', '13-site-about-ru', 'Фонд хранит и изучает наследие')
|
||||
await go(B + '/admin/globals/site-settings?locale=ru')
|
||||
await p.fill('#field-intro', 'По вопросам выставок напишите фонду.')
|
||||
await p.fill('#field-email', 'exhibitions@example.org')
|
||||
await p.fill('#field-phone', '+7 700 000 00 00')
|
||||
await p.fill('#field-address', 'Алматы, проспект Абая, 1')
|
||||
await p.getByRole('button', { name: /добавить/i }).last().click()
|
||||
await p.fill('#field-socials__0__label', 'Facebook')
|
||||
await p.fill('#field-socials__0__url', 'https://www.facebook.com/example')
|
||||
await save()
|
||||
await shot('14-contacts-admin', true)
|
||||
await site('/ru/contacts', '15-site-contacts-ru', 'По вопросам выставок напишите фонду.')
|
||||
for (const text of ['exhibitions@example.org', '+7 700 000 00 00', 'Алматы, проспект Абая, 1', 'Facebook']) {
|
||||
await site('/ru/contacts', null, text)
|
||||
}
|
||||
await site('/en/contacts', null, 'Write to us')
|
||||
await go('/admin/globals/site-settings?locale=en')
|
||||
await p.fill('#field-intro', 'Email the foundation about exhibitions.')
|
||||
await save()
|
||||
await site('/en/contacts', '15-site-contacts-en', 'Email the foundation about exhibitions.')
|
||||
await site('/ru/contacts', null, 'По вопросам выставок напишите фонду.')
|
||||
|
||||
// 6. Удаление
|
||||
const records = [
|
||||
{ collection: 'projects', id: projId, kind: 'project', path: 'projects/exhibition-2027', texts: proj },
|
||||
...materials.map(({ kind, id, texts }) => ({ collection: 'news', id, kind, path: `news/${id}`, texts })),
|
||||
]
|
||||
for (const { collection, id, kind, path, texts } of records) {
|
||||
await go(`/admin/collections/${collection}/${id}?locale=ru`)
|
||||
await p.locator('.doc-controls__popup button, .popup-button').last().click()
|
||||
await p.getByRole('button', { name: /удалить/i }).first().click()
|
||||
await p.locator('.confirmation-modal, [class*=modal]').getByRole('button', { name: /подтвердить|удалить/i }).last().click()
|
||||
await p.waitForURL((url) => url.pathname.replace(/\/$/, '') === `/admin/collections/${collection}`)
|
||||
await shot(`16-${kind}-deleted`)
|
||||
for (const [locale, [title]] of Object.entries(texts)) {
|
||||
await site(`/${locale}/${path}`, null, title, false)
|
||||
}
|
||||
}
|
||||
await b.close()
|
||||
@ -0,0 +1,55 @@
|
||||
shot 01-login
|
||||
wrong password stays on /admin/login
|
||||
shot 02-login-wrong-password
|
||||
shot 03-dashboard
|
||||
shot 04-photo-uploaded
|
||||
media 1
|
||||
shot 05-project-ru
|
||||
shot 06-project-kk-language-switcher
|
||||
site /ru/projects/exhibition-2027 200 has "Первая часть выставки.\n\nВторая часть выставки." OK
|
||||
site /ru/projects/exhibition-2027 200 has "Выставка 2027 — 2028" OK
|
||||
site /kk/projects/exhibition-2027 200 has "Көрменің бірінші бөлімі." OK
|
||||
site /kk/projects/exhibition-2027 200 has "Көрме 2027 — 2028" OK
|
||||
site /en/projects/exhibition-2027 200 has "The first part of the exhibition." OK
|
||||
site /en/projects/exhibition-2027 200 has "Exhibition 2027 — 2028" OK
|
||||
shot 09-news-admin-ru
|
||||
site /ru/news/1 200 has "Фонд открыл выставку в Алматы." OK
|
||||
site /ru/news/1 200 has "Открытие выставки — 2028" OK
|
||||
shot 09-news-admin-kk
|
||||
site /kk/news/1 200 has "Қор Алматыда көрме ашты." OK
|
||||
site /kk/news/1 200 has "Көрменің ашылуы — 2028" OK
|
||||
shot 09-news-admin-en
|
||||
site /en/news/1 200 has "The foundation opened an exhibition in Almaty." OK
|
||||
site /en/news/1 200 has "Exhibition opening — 2028" OK
|
||||
shot 09-event-admin-ru
|
||||
site /ru/news/2 200 has "Фонд приглашает на встречу в Алматы." OK
|
||||
site /ru/news/2 200 has "Встреча с художником — 2028" OK
|
||||
shot 09-event-admin-kk
|
||||
site /kk/news/2 200 has "Қор Алматыдағы кездесуге шақырады." OK
|
||||
site /kk/news/2 200 has "Суретшімен кездесу — 2028" OK
|
||||
shot 09-event-admin-en
|
||||
site /en/news/2 200 has "The foundation invites visitors to a meeting in Almaty." OK
|
||||
site /en/news/2 200 has "Meet the artist — 2028" OK
|
||||
shot 12-about-admin
|
||||
site /ru/about 200 has "Фонд хранит и изучает наследие" OK
|
||||
shot 14-contacts-admin
|
||||
site /ru/contacts 200 has "По вопросам выставок напишите фонду." OK
|
||||
site /ru/contacts 200 has "exhibitions@example.org" OK
|
||||
site /ru/contacts 200 has "+7 700 000 00 00" OK
|
||||
site /ru/contacts 200 has "Алматы, проспект Абая, 1" OK
|
||||
site /ru/contacts 200 has "Facebook" OK
|
||||
site /en/contacts 200 has "Write to us" OK
|
||||
site /en/contacts 200 has "Email the foundation about exhibitions." OK
|
||||
site /ru/contacts 200 has "По вопросам выставок напишите фонду." OK
|
||||
shot 16-project-deleted
|
||||
site /ru/projects/exhibition-2027 404 lacks "Выставка 2027" OK
|
||||
site /kk/projects/exhibition-2027 404 lacks "Көрме 2027" OK
|
||||
site /en/projects/exhibition-2027 404 lacks "Exhibition 2027" OK
|
||||
shot 16-news-deleted
|
||||
site /ru/news/1 404 lacks "Открытие выставки" OK
|
||||
site /kk/news/1 404 lacks "Көрменің ашылуы" OK
|
||||
site /en/news/1 404 lacks "Exhibition opening" OK
|
||||
shot 16-event-deleted
|
||||
site /ru/news/2 404 lacks "Встреча с художником" OK
|
||||
site /kk/news/2 404 lacks "Суретшімен кездесу" OK
|
||||
site /en/news/2 404 lacks "Meet the artist" OK
|
||||
@ -0,0 +1,16 @@
|
||||
## Why
|
||||
|
||||
[QLFW-88](https://forge.telecom.quest/t/QLFW-88). Владелец фонда должен увидеть, как сотрудник меняет сайт через панель управления.
|
||||
|
||||
## What Changes
|
||||
|
||||
- Делается редактируемым вводный текст страницы «Контакты».
|
||||
- Записывается сквозная проверка входа, работы с проектом, новостью, событием, фото и страницами фонда на отдельной проверочной копии.
|
||||
|
||||
## Вне задачи
|
||||
|
||||
Доступы сотрудников и содержимое общей базы фонда.
|
||||
|
||||
## Вопросы к владельцу
|
||||
|
||||
Нет.
|
||||
@ -0,0 +1,15 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Редактируемый вводный текст страницы контактов
|
||||
|
||||
Раздел «Контакты и соцсети» SHALL позволять сотруднику менять вводный текст страницы «Контакты» отдельно для каждого языка.
|
||||
|
||||
#### Scenario: Сохранён новый вводный текст
|
||||
- **GIVEN** сотрудник сохранил для русского языка текст «По вопросам выставок напишите фонду.»
|
||||
- **WHEN** посетитель открывает /ru/contacts
|
||||
- **THEN** под заголовком «Контакты» виден текст «По вопросам выставок напишите фонду.»
|
||||
|
||||
#### Scenario: Вводный текст на английском пуст
|
||||
- **GIVEN** сотрудник заполнил русский текст и оставил английское поле пустым
|
||||
- **WHEN** посетитель открывает /en/contacts
|
||||
- **THEN** показан штатный английский вводный текст из словаря сайта
|
||||
@ -0,0 +1,5 @@
|
||||
## 1. Панель управления
|
||||
|
||||
- [x] 1.1 Добавить локализованный вводный текст страницы «Контакты» и миграцию.
|
||||
- [x] 1.2 Проверить через браузер вход, работу с тремя видами материалов, фото и страницами фонда. Приложить снимки.
|
||||
- [x] 1.3 Запустить проверки проекта, проверить /healthz и выполнить openspec validate.
|
||||
@ -107,3 +107,17 @@ TBD - created by archiving change qlfw-6-admin-panel. Update Purpose after archi
|
||||
- **GIVEN** список компонентов панели не содержит карточек разделов
|
||||
- **WHEN** запускаются проверки проекта
|
||||
- **THEN** тест главной страницы панели падает
|
||||
|
||||
### Requirement: Редактируемый вводный текст страницы контактов
|
||||
|
||||
Раздел «Контакты и соцсети» SHALL позволять сотруднику менять вводный текст страницы «Контакты» отдельно для каждого языка.
|
||||
|
||||
#### Scenario: Сохранён новый вводный текст
|
||||
- **GIVEN** сотрудник сохранил для русского языка текст «По вопросам выставок напишите фонду.»
|
||||
- **WHEN** посетитель открывает /ru/contacts
|
||||
- **THEN** под заголовком «Контакты» виден текст «По вопросам выставок напишите фонду.»
|
||||
|
||||
#### Scenario: Вводный текст на английском пуст
|
||||
- **GIVEN** сотрудник заполнил русский текст и оставил английское поле пустым
|
||||
- **WHEN** посетитель открывает /en/contacts
|
||||
- **THEN** показан штатный английский вводный текст из словаря сайта
|
||||
|
||||
@ -34,7 +34,8 @@ export default async function ContactsPage({ params }: Props) {
|
||||
const t = getDict(locale)
|
||||
const { home, news } = await loadContent(locale)
|
||||
const legal = await loadLegal(locale)
|
||||
const c = buildContacts(await loadSettings(locale), home?.contactEmail)
|
||||
const settings = await loadSettings(locale)
|
||||
const c = buildContacts(settings, home?.contactEmail)
|
||||
const email = c.email || FALLBACK_EMAIL
|
||||
return (
|
||||
<>
|
||||
@ -43,7 +44,7 @@ export default async function ContactsPage({ params }: Props) {
|
||||
<Link href={`/${locale}`} className="text-sm text-muted hover:text-burgundy">← {t.legal.back}</Link>
|
||||
<h1 className="mt-6 font-serif text-4xl leading-tight text-burgundy sm:text-5xl">{t.contacts.title}</h1>
|
||||
<div className="mt-10 h-px w-24 bg-burgundy" aria-hidden />
|
||||
<p className="mt-10 max-w-2xl text-lg text-muted">{t.contacts.lead}</p>
|
||||
<p className="mt-10 max-w-2xl text-lg text-muted">{settings?.intro?.trim() || t.contacts.lead}</p>
|
||||
<p className="mt-4">
|
||||
{t.contacts.emailLabel}: <span dangerouslySetInnerHTML={{ __html: emailLinkHtml(email, 'text-burgundy underline underline-offset-4 hover:no-underline') }} />
|
||||
</p>
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
import type { GlobalConfig } from 'payload'
|
||||
import { getDict } from '../i18n'
|
||||
|
||||
export const SiteSettings: GlobalConfig = {
|
||||
slug: 'site-settings',
|
||||
label: 'Контакты и соцсети',
|
||||
access: { read: () => true },
|
||||
fields: [
|
||||
{ name: 'intro', label: { ru: getDict('ru').contacts.adminIntroLabel, kk: getDict('kk').contacts.adminIntroLabel, en: getDict('en').contacts.adminIntroLabel }, type: 'textarea', localized: true },
|
||||
{ name: 'email', label: 'Почта для связи', type: 'email' },
|
||||
{ name: 'phone', label: 'Телефон', type: 'text' },
|
||||
{ name: 'address', label: 'Адрес', type: 'text', localized: true },
|
||||
|
||||
@ -57,7 +57,7 @@ export const en: Dict = {
|
||||
text: 'If our goal is close to yours, we would be glad to discuss joint projects, partnerships and ideas.',
|
||||
write: 'Write to us',
|
||||
},
|
||||
contacts: { title: 'Contacts', description: 'Get in touch with Qazaq Legacy Foundation: a message form and an email address.', lead: 'Write to us — we will read your message and reply to the email you give. You can also propose a partnership or a joint project here.', emailLabel: 'Email', phoneLabel: 'Phone', addressLabel: 'Address', socialsLabel: 'We are on social media' },
|
||||
contacts: { adminIntroLabel: 'Contacts page introduction', title: 'Contacts', description: 'Get in touch with Qazaq Legacy Foundation: a message form and an email address.', lead: 'Write to us — we will read your message and reply to the email you give. You can also propose a partnership or a joint project here.', emailLabel: 'Email', phoneLabel: 'Phone', addressLabel: 'Address', socialsLabel: 'We are on social media' },
|
||||
form: {
|
||||
name: 'Your name', email: 'Email', organization: 'Organization', optional: 'optional', message: 'Your message',
|
||||
consent: 'I agree to the processing of my personal data.', consentPolicyBefore: 'I agree to the processing of my personal data in accordance with the ', consentPolicyLink: 'Privacy Policy', consentPolicyAfter: '.', consentNeed: 'To send the message, please tick the consent box.',
|
||||
|
||||
@ -57,7 +57,7 @@ export const kk: Dict = {
|
||||
text: 'Біздің мақсат сізге жақын болса, бірлескен жобаларды, серіктестікті және идеяларды талқылауға қуанамыз.',
|
||||
write: 'Бізге жазыңыз',
|
||||
},
|
||||
contacts: { title: 'Байланыс', description: 'Qazaq Legacy Foundation қорымен байланысыңыз: өтініш формасы және электрондық пошта.', lead: 'Бізге жазыңыз — өтінішті оқып, көрсеткен поштаңызға жауап береміз. Серіктестік немесе бірлескен жоба туралы да осы жерден жаза аласыз.', emailLabel: 'Электрондық пошта', phoneLabel: 'Телефон', addressLabel: 'Мекенжай', socialsLabel: 'Әлеуметтік желілер' },
|
||||
contacts: { adminIntroLabel: '«Байланыс» бетінің кіріспе мәтіні', title: 'Байланыс', description: 'Qazaq Legacy Foundation қорымен байланысыңыз: өтініш формасы және электрондық пошта.', lead: 'Бізге жазыңыз — өтінішті оқып, көрсеткен поштаңызға жауап береміз. Серіктестік немесе бірлескен жоба туралы да осы жерден жаза аласыз.', emailLabel: 'Электрондық пошта', phoneLabel: 'Телефон', addressLabel: 'Мекенжай', socialsLabel: 'Әлеуметтік желілер' },
|
||||
form: {
|
||||
name: 'Атыңыз', email: 'Электрондық пошта', organization: 'Ұйым', optional: 'міндетті емес', message: 'Өтінішіңіз',
|
||||
consent: 'Жеке деректерімді өңдеуге келісемін.', consentPolicyBefore: 'Жеке деректерімді өңдеуге ', consentPolicyLink: 'құпиялылық саясатына', consentPolicyAfter: ' сәйкес келісемін.', consentNeed: 'Өтінішті жіберу үшін келісім белгісі қажет.',
|
||||
|
||||
@ -57,7 +57,7 @@ export const ru: Dict = {
|
||||
text: 'Если вам близка наша цель, мы будем рады обсудить совместные проекты, партнёрства и идеи.',
|
||||
write: 'Написать нам',
|
||||
},
|
||||
contacts: { title: 'Контакты', description: 'Свяжитесь с Qazaq Legacy Foundation: форма обращения и электронная почта.', lead: 'Напишите нам — мы прочитаем обращение и ответим на указанную почту. Здесь же можно предложить партнёрство или совместный проект.', emailLabel: 'Электронная почта', phoneLabel: 'Телефон', addressLabel: 'Адрес', socialsLabel: 'Мы в соцсетях' },
|
||||
contacts: { adminIntroLabel: 'Вводный текст страницы «Контакты»', title: 'Контакты', description: 'Свяжитесь с Qazaq Legacy Foundation: форма обращения и электронная почта.', lead: 'Напишите нам — мы прочитаем обращение и ответим на указанную почту. Здесь же можно предложить партнёрство или совместный проект.', emailLabel: 'Электронная почта', phoneLabel: 'Телефон', addressLabel: 'Адрес', socialsLabel: 'Мы в соцсетях' },
|
||||
form: {
|
||||
name: 'Ваше имя', email: 'Электронная почта', organization: 'Организация', optional: 'необязательно', message: 'Ваше обращение',
|
||||
consent: 'Я согласен(на) на обработку моих персональных данных.', consentPolicyBefore: 'Я согласен(на) на обработку персональных данных в соответствии с ', consentPolicyLink: 'политикой конфиденциальности', consentPolicyAfter: '.', consentNeed: 'Чтобы отправить обращение, нужна отметка о согласии.',
|
||||
|
||||
@ -17,7 +17,7 @@ export type Dict = {
|
||||
book: { title: string; author: string; paragraphs: string[]; get: string; buy: { intro: string; platforms: string[]; storesIntro: string; stores: string[]; note: string } | null; cover: string; photoCaptions: [string, string, string, string]; photoFallback: string; photoClose: string; photoPrev: string; photoNext: string; role: string; translationReview: string; gallery: string; additions: string[] }
|
||||
news: { title: string; news: string; event: string }
|
||||
collaboration: { title: string; text: string; write: string; instagram: string }
|
||||
contacts: { title: string; description: string; lead: string; emailLabel: string; phoneLabel: string; addressLabel: string; socialsLabel: string }
|
||||
contacts: { adminIntroLabel: string; title: string; description: string; lead: string; emailLabel: string; phoneLabel: string; addressLabel: string; socialsLabel: string }
|
||||
form: {
|
||||
name: string
|
||||
email: string
|
||||
|
||||
@ -4,7 +4,7 @@ import { bookProjectSlug } from './project-paths'
|
||||
export type CmsMedia = { url?: string | null; alt?: string | null } | number | string | null | undefined
|
||||
export type CmsProject = { id: string | number; slug: string; title?: string | null; summary?: string | null; body?: string | null; cover?: CmsMedia; order?: number | null }
|
||||
export type CmsAbout = { text?: string | null; photo?: CmsMedia } | null
|
||||
export type CmsSettings = { email?: string | null; phone?: string | null; address?: string | null; socials?: { label?: string | null; url?: string | null }[] | null; bookPhotos?: { photo?: CmsMedia }[] | null } | null
|
||||
export type CmsSettings = { intro?: string | null; email?: string | null; phone?: string | null; address?: string | null; socials?: { label?: string | null; url?: string | null }[] | null; bookPhotos?: { photo?: CmsMedia }[] | null } | null
|
||||
|
||||
const clean = (v?: string | null) => (v && v.trim() ? v.trim() : null)
|
||||
|
||||
|
||||
9
src/migrations/20261125_120000_contacts_intro.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { type MigrateUpArgs, type MigrateDownArgs, sql } from '@payloadcms/db-sqlite'
|
||||
|
||||
export async function up({ db }: MigrateUpArgs): Promise<void> {
|
||||
await db.run(sql`ALTER TABLE site_settings_locales ADD COLUMN intro text`)
|
||||
}
|
||||
|
||||
export async function down({ db }: MigrateDownArgs): Promise<void> {
|
||||
await db.run(sql`ALTER TABLE site_settings_locales DROP COLUMN intro`)
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
import * as migration_contacts_intro from './20261125_120000_contacts_intro';
|
||||
import * as migration_admin_panel from './20261117_200000_admin_panel';
|
||||
import * as migration_book_photos from './20261119_100000_book_photos';
|
||||
import * as migration_news_details from './20261117_170000_news_details';
|
||||
@ -31,4 +32,5 @@ export const migrations = [
|
||||
{ up: migration_foundation.up, down: migration_foundation.down, name: '20261117_190000_foundation' },
|
||||
{ up: migration_admin_panel.up, down: migration_admin_panel.down, name: '20261117_200000_admin_panel' },
|
||||
{ up: migration_book_photos.up, down: migration_book_photos.down, name: '20261119_100000_book_photos' },
|
||||
{ up: migration_contacts_intro.up, down: migration_contacts_intro.down, name: '20261125_120000_contacts_intro' },
|
||||
];
|
||||
|
||||
@ -493,6 +493,7 @@ export interface About {
|
||||
*/
|
||||
export interface SiteSetting {
|
||||
id: number;
|
||||
intro?: string | null;
|
||||
email?: string | null;
|
||||
phone?: string | null;
|
||||
address?: string | null;
|
||||
@ -609,6 +610,7 @@ export interface AboutSelect<T extends boolean = true> {
|
||||
* via the `definition` "site-settings_select".
|
||||
*/
|
||||
export interface SiteSettingsSelect<T extends boolean = true> {
|
||||
intro?: T;
|
||||
email?: T;
|
||||
phone?: T;
|
||||
address?: T;
|
||||
|
||||