QLFW-88: добавить редактируемый текст контактов
This commit is contained in:
parent
7fa143a889
commit
ecf1898e9d
@ -69,3 +69,4 @@
|
||||
| Контакты и соцсети | почта, телефон, адрес, соцсети | глобал, settings | Заполняются в панели и показываются на странице «Контакты» |
|
||||
| Адрес страницы проекта | адрес страницы | slug | У каждого проекта свой адрес. Адрес книги уже занят. |
|
||||
| Подпись фотографии книги | разворот, выходные данные, фотография книги | Фото 1, Photo 1 | Короткое описание того, что видно на снимке |
|
||||
| Текст страницы контактов | Вводный текст страницы «Контакты» / «Байланыс» бетінің кіріспе мәтіні / Contacts page introduction | — | Текст под заголовком страницы на выбранном языке |
|
||||
|
||||
2
openspec/changes/qlfw-88-admin-workflow/.openspec.yaml
Normal file
2
openspec/changes/qlfw-88-admin-workflow/.openspec.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
schema: spec-driven
|
||||
created: 2026-11-25
|
||||
5
openspec/changes/qlfw-88-admin-workflow/design.md
Normal file
5
openspec/changes/qlfw-88-admin-workflow/design.md
Normal file
@ -0,0 +1,5 @@
|
||||
## Решения
|
||||
|
||||
Добавляем локализованное необязательное поле в существующий раздел «Контакты и соцсети». При пустом значении используется текущий текст словаря на языке страницы. Обратимая миграция добавляет столбец без перезаписи существующих данных.
|
||||
|
||||
Новость и событие проверяем как две записи раздела «Новости и события». Сценарий использует настоящие интерфейс, миграции, хранение фото и страницы сайта. Отдельная база и локальный запуск сборки позволяют создавать и удалять записи без вмешательства в общий сайт фонда.
|
||||
16
openspec/changes/qlfw-88-admin-workflow/proposal.md
Normal file
16
openspec/changes/qlfw-88-admin-workflow/proposal.md
Normal file
@ -0,0 +1,16 @@
|
||||
## Зачем
|
||||
|
||||
QLFW-88. Владелец фонда должен увидеть, как сотрудник меняет сайт через панель управления.
|
||||
|
||||
## Что меняем
|
||||
|
||||
- Делается редактируемым вводный текст страницы «Контакты».
|
||||
- Записывается сквозная проверка входа, работы с проектом, новостью, событием, фото и страницами фонда на отдельной проверочной копии.
|
||||
|
||||
## Вне задачи
|
||||
|
||||
Доступы сотрудников и содержимое общей базы фонда.
|
||||
|
||||
## Вопросы к владельцу
|
||||
|
||||
Нет.
|
||||
@ -0,0 +1,15 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Редактируемый вводный текст страницы контактов
|
||||
|
||||
Раздел «Контакты и соцсети» SHALL позволять сотруднику менять вводный текст страницы «Контакты» отдельно для каждого языка.
|
||||
|
||||
#### Scenario: Сохранён новый вводный текст
|
||||
- **GIVEN** сотрудник сохранил для русского языка текст «По вопросам выставок напишите фонду.»
|
||||
- **WHEN** посетитель открывает /ru/contacts
|
||||
- **THEN** под заголовком «Контакты» виден текст «По вопросам выставок напишите фонду.»
|
||||
|
||||
#### Scenario: Вводный текст на английском пуст
|
||||
- **GIVEN** сотрудник заполнил русский текст и оставил английское поле пустым
|
||||
- **WHEN** посетитель открывает /en/contacts
|
||||
- **THEN** показан штатный английский вводный текст из словаря сайта
|
||||
5
openspec/changes/qlfw-88-admin-workflow/tasks.md
Normal file
5
openspec/changes/qlfw-88-admin-workflow/tasks.md
Normal file
@ -0,0 +1,5 @@
|
||||
## 1. Панель управления
|
||||
|
||||
- [x] 1.1 Добавить локализованный вводный текст страницы «Контакты» и миграцию.
|
||||
- [ ] 1.2 Проверить через браузер вход, работу с тремя видами материалов, фото и страницами фонда. Приложить снимки.
|
||||
- [ ] 1.3 Запустить проверки проекта, проверить /healthz и выполнить openspec validate.
|
||||
@ -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: 'Чтобы отправить обращение, нужна отметка о согласии.',
|
||||
|
||||
@ -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
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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user