diff --git a/src/api/page/content-types/page/schema.json b/src/api/page/content-types/page/schema.json index 4df9b8d..c55e92f 100644 --- a/src/api/page/content-types/page/schema.json +++ b/src/api/page/content-types/page/schema.json @@ -37,8 +37,12 @@ "components": { "type": "dynamiczone", "components": [ - "ui.hero", - "ui.kernwaarden" + "ui.image", + "ui.image-met-titel", + "ui.text", + "ui.opsomming", + "ui.titel", + "ui.quote" ], "pluginOptions": { "i18n": { @@ -73,6 +77,10 @@ "type": "uid", "targetField": "title_cms", "required": true + }, + "tagline": { + "type": "string", + "required": true } } } diff --git a/src/api/page/middlewares/page-populate.js b/src/api/page/middlewares/page-populate.js new file mode 100644 index 0000000..0882f77 --- /dev/null +++ b/src/api/page/middlewares/page-populate.js @@ -0,0 +1,53 @@ +'use strict'; + +/** + * `page-populate` middleware + */ + +const populate = { + components: { + on: { + "ui.text": { + fields: ['content'], + }, + "ui.image": { + populate: { + image: { + fields: ['url', 'alternativeText'] + } + } + }, + "ui.image-met-titel": { + populate: { + image: { + fields: ['url', 'alternativeText'] + } + } + }, + "ui.opsomming": { + populate: { + items: { + fields: ['text'] + } + } + }, + "ui.titel": { + fields: ['title', 'content'], + }, + "ui.quote": { + fields: ['quote', 'name', 'jobTitle'], + }, + } + } +} + +module.exports = (config, { strapi }) => { + // Add your own logic here. + return async (ctx, next) => { + strapi.log.info('In page-populate middleware.'); + + ctx.query.populate = populate; + + await next(); + }; +}; diff --git a/src/api/page/routes/page.js b/src/api/page/routes/page.js index 0aff6bd..590cff4 100644 --- a/src/api/page/routes/page.js +++ b/src/api/page/routes/page.js @@ -1,9 +1,18 @@ -'use strict'; - -/** - * page router - */ - -const { createCoreRouter } = require('@strapi/strapi').factories; - -module.exports = createCoreRouter('api::page.page'); +'use strict'; + +/** + * page router + */ + +const { createCoreRouter } = require('@strapi/strapi').factories; + +module.exports = createCoreRouter('api::page.page', { + config: { + find: { + middlewares: ['api::page.page-populate'] + }, + findOne: { + middlewares: ['api::page.page-populate'] + }, + } +}); diff --git a/src/components/elements/list-item-text.json b/src/components/elements/list-item-text.json new file mode 100644 index 0000000..6ba3e91 --- /dev/null +++ b/src/components/elements/list-item-text.json @@ -0,0 +1,14 @@ +{ + "collectionName": "components_elements_list_item_texts", + "info": { + "displayName": "List Item text", + "icon": "bulletList" + }, + "options": {}, + "attributes": { + "text": { + "type": "text", + "required": true + } + } +} diff --git a/src/components/elements/list-item.json b/src/components/elements/list-item.json index f9ba953..db0b913 100644 --- a/src/components/elements/list-item.json +++ b/src/components/elements/list-item.json @@ -1,8 +1,9 @@ { "collectionName": "components_elements_list_items", "info": { - "displayName": "List Item", - "icon": "bulletList" + "displayName": "List Item met description", + "icon": "bulletList", + "description": "" }, "options": {}, "attributes": { diff --git a/src/components/ui/opsomming.json b/src/components/ui/opsomming.json new file mode 100644 index 0000000..cc047bd --- /dev/null +++ b/src/components/ui/opsomming.json @@ -0,0 +1,17 @@ +{ + "collectionName": "components_ui_opsommings", + "info": { + "displayName": "Opsomming", + "icon": "bulletList", + "description": "" + }, + "options": {}, + "attributes": { + "items": { + "type": "component", + "repeatable": true, + "component": "elements.list-item-text", + "required": true + } + } +} diff --git a/src/components/ui/quote.json b/src/components/ui/quote.json new file mode 100644 index 0000000..341733f --- /dev/null +++ b/src/components/ui/quote.json @@ -0,0 +1,21 @@ +{ + "collectionName": "components_ui_quotes", + "info": { + "displayName": "Quote", + "icon": "quote" + }, + "options": {}, + "attributes": { + "quote": { + "type": "text", + "required": true + }, + "name": { + "type": "string", + "required": true + }, + "jobTitle": { + "type": "string" + } + } +} diff --git a/src/components/ui/text.json b/src/components/ui/text.json new file mode 100644 index 0000000..04a20b1 --- /dev/null +++ b/src/components/ui/text.json @@ -0,0 +1,14 @@ +{ + "collectionName": "components_ui_texts", + "info": { + "displayName": "Text", + "icon": "feather" + }, + "options": {}, + "attributes": { + "content": { + "type": "richtext", + "required": true + } + } +} diff --git a/src/components/ui/titel.json b/src/components/ui/titel.json new file mode 100644 index 0000000..bd75aa1 --- /dev/null +++ b/src/components/ui/titel.json @@ -0,0 +1,19 @@ +{ + "collectionName": "components_ui_titels", + "info": { + "displayName": "Subtitel met text", + "icon": "bold", + "description": "" + }, + "options": {}, + "attributes": { + "title": { + "type": "string", + "required": true + }, + "content": { + "type": "richtext", + "required": true + } + } +} diff --git a/types/generated/components.d.ts b/types/generated/components.d.ts index 799ef7f..2410163 100644 --- a/types/generated/components.d.ts +++ b/types/generated/components.d.ts @@ -19,7 +19,8 @@ export interface ElementsButton extends Struct.ComponentSchema { export interface ElementsListItem extends Struct.ComponentSchema { collectionName: 'components_elements_list_items'; info: { - displayName: 'List Item'; + description: ''; + displayName: 'List Item met description'; icon: 'bulletList'; }; attributes: { @@ -28,6 +29,17 @@ export interface ElementsListItem extends Struct.ComponentSchema { }; } +export interface ElementsListItemText extends Struct.ComponentSchema { + collectionName: 'components_elements_list_item_texts'; + info: { + displayName: 'List Item text'; + icon: 'bulletList'; + }; + attributes: { + text: Schema.Attribute.Text & Schema.Attribute.Required; + }; +} + export interface ElementsListItemWithIcon extends Struct.ComponentSchema { collectionName: 'components_elements_list_item_with_icons'; info: { @@ -163,6 +175,32 @@ export interface UiMissieMetStatistieken extends Struct.ComponentSchema { }; } +export interface UiOpsomming extends Struct.ComponentSchema { + collectionName: 'components_ui_opsommings'; + info: { + description: ''; + displayName: 'Opsomming'; + icon: 'bulletList'; + }; + attributes: { + items: Schema.Attribute.Component<'elements.list-item-text', true> & + Schema.Attribute.Required; + }; +} + +export interface UiQuote extends Struct.ComponentSchema { + collectionName: 'components_ui_quotes'; + info: { + displayName: 'Quote'; + icon: 'quote'; + }; + attributes: { + jobTitle: Schema.Attribute.String; + name: Schema.Attribute.String & Schema.Attribute.Required; + quote: Schema.Attribute.Text & Schema.Attribute.Required; + }; +} + export interface UiTeam extends Struct.ComponentSchema { collectionName: 'components_ui_teams'; info: { @@ -177,11 +215,36 @@ export interface UiTeam extends Struct.ComponentSchema { }; } +export interface UiText extends Struct.ComponentSchema { + collectionName: 'components_ui_texts'; + info: { + displayName: 'Text'; + icon: 'feather'; + }; + attributes: { + content: Schema.Attribute.RichText & Schema.Attribute.Required; + }; +} + +export interface UiTitel extends Struct.ComponentSchema { + collectionName: 'components_ui_titels'; + info: { + description: ''; + displayName: 'Subtitel met text'; + icon: 'bold'; + }; + attributes: { + content: Schema.Attribute.RichText & Schema.Attribute.Required; + title: Schema.Attribute.String & Schema.Attribute.Required; + }; +} + declare module '@strapi/strapi' { export module Public { export interface ComponentSchemas { 'elements.button': ElementsButton; 'elements.list-item': ElementsListItem; + 'elements.list-item-text': ElementsListItemText; 'elements.list-item-with-icon': ElementsListItemWithIcon; 'elements.social': ElementsSocial; 'ui.hero': UiHero; @@ -190,7 +253,11 @@ declare module '@strapi/strapi' { 'ui.kernwaarden': UiKernwaarden; 'ui.klant-logo-s': UiKlantLogoS; 'ui.missie-met-statistieken': UiMissieMetStatistieken; + 'ui.opsomming': UiOpsomming; + 'ui.quote': UiQuote; 'ui.team': UiTeam; + 'ui.text': UiText; + 'ui.titel': UiTitel; } } } diff --git a/types/generated/contentTypes.d.ts b/types/generated/contentTypes.d.ts index 93406a1..867fbdc 100644 --- a/types/generated/contentTypes.d.ts +++ b/types/generated/contentTypes.d.ts @@ -677,7 +677,16 @@ export interface ApiPagePage extends Struct.CollectionTypeSchema { }; }; attributes: { - components: Schema.Attribute.DynamicZone<['ui.hero', 'ui.kernwaarden']> & + components: Schema.Attribute.DynamicZone< + [ + 'ui.image', + 'ui.image-met-titel', + 'ui.text', + 'ui.opsomming', + 'ui.titel', + 'ui.quote', + ] + > & Schema.Attribute.SetPluginOptions<{ i18n: { localized: true; @@ -705,6 +714,7 @@ export interface ApiPagePage extends Struct.CollectionTypeSchema { }> & Schema.Attribute.DefaultTo<'dotnet'>; slug: Schema.Attribute.UID<'title_cms'> & Schema.Attribute.Required; + tagline: Schema.Attribute.String & Schema.Attribute.Required; title_cms: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.SetPluginOptions<{