138 lines
No EOL
3.2 KiB
TypeScript
138 lines
No EOL
3.2 KiB
TypeScript
import { CollectionConfig } from 'payload'
|
|
import { hide, isAdminOrEmployee } from '@/collections/access/admin'
|
|
import { ParagraphBlock } from '@/collections/blocks/Paragraph'
|
|
import { DocumentBlock } from '@/collections/blocks/Document'
|
|
import { ContactformBlock } from '@/collections/blocks/Contactform'
|
|
import { GalleryBlock } from '@/collections/blocks/Gallery'
|
|
import { DonationBlock } from '@/collections/blocks/Donation'
|
|
import { ButtonBlock } from '@/collections/blocks/Button'
|
|
import { YoutubePlayerBlock } from '@/collections/blocks/YoutubePlayer'
|
|
import { ImageCardsBlock } from '@/collections/blocks/ImageCards'
|
|
import { isPublishedPublic } from '@/collections/access/public'
|
|
|
|
|
|
export const Blog: CollectionConfig = {
|
|
slug: 'blog',
|
|
labels: {
|
|
singular: {
|
|
de: 'Blogpost',
|
|
},
|
|
plural: {
|
|
de: 'Blog',
|
|
},
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'photo',
|
|
type: 'upload',
|
|
label: {
|
|
de: 'Bild'
|
|
},
|
|
relationTo: 'media',
|
|
},
|
|
{
|
|
name: 'title',
|
|
type: 'text',
|
|
required: true,
|
|
label: {
|
|
de: 'Titel',
|
|
},
|
|
},
|
|
{
|
|
type: 'tabs',
|
|
tabs: [
|
|
{
|
|
name: 'content',
|
|
fields: [
|
|
{
|
|
name: 'excerpt',
|
|
type: 'textarea',
|
|
label: {
|
|
de: 'Auszug',
|
|
},
|
|
required: true,
|
|
},
|
|
{
|
|
name: 'content',
|
|
type: 'blocks',
|
|
minRows: 1,
|
|
maxRows: 20,
|
|
blocks: [
|
|
ParagraphBlock,
|
|
DocumentBlock,
|
|
DonationBlock,
|
|
ContactformBlock,
|
|
GalleryBlock,
|
|
YoutubePlayerBlock,
|
|
ButtonBlock,
|
|
ImageCardsBlock,
|
|
],
|
|
required: true,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'configuration',
|
|
label: {
|
|
de: 'Einstellungen'
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'showOnFrontpage',
|
|
type: 'checkbox',
|
|
label: {
|
|
de: 'Anzeigen auf Startseite?',
|
|
},
|
|
defaultValue: true,
|
|
required: true,
|
|
},
|
|
{
|
|
name: 'displayFromDate',
|
|
type: 'date',
|
|
label: {
|
|
de: 'Anzeigen von',
|
|
},
|
|
required: false,
|
|
},
|
|
{
|
|
name: 'displayTillDate',
|
|
type: 'date',
|
|
label: {
|
|
de: 'Anzeigen bis',
|
|
},
|
|
required: false,
|
|
},
|
|
{
|
|
name: 'parish',
|
|
type: 'relationship',
|
|
relationTo: 'parish',
|
|
hasMany: true,
|
|
label: {
|
|
de: 'Gemeinde',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
|
|
],
|
|
},
|
|
],
|
|
admin: {
|
|
useAsTitle: 'title',
|
|
hidden: hide,
|
|
livePreview: {
|
|
url: ({ data }) => `/api/draft?url=/blog/${data.id}`,
|
|
}
|
|
},
|
|
versions: {
|
|
drafts: {
|
|
validate: true
|
|
}
|
|
},
|
|
access: {
|
|
read: isPublishedPublic(),
|
|
create: isAdminOrEmployee(),
|
|
update: isAdminOrEmployee(),
|
|
delete: isAdminOrEmployee(),
|
|
},
|
|
} |