Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit 43d49f6

Browse files
authored
Page navigation (#12)
* feat(cms): Create page and suppage types * Update middlewares configuration and add new page component * Create Navigation * Create component types and menu structure
1 parent c133a96 commit 43d49f6

File tree

28 files changed

+660
-58
lines changed

28 files changed

+660
-58
lines changed

cms/config/middlewares.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
1-
export default [
1+
2+
module.exports = [
23
'strapi::errors',
34
'strapi::security',
4-
'strapi::cors',
5+
{
6+
name: 'strapi::cors',
7+
config: {
8+
origin: ['http://localhost:3000', 'http://web:3000', 'http://localhost:1337', 'http://cms:1337'],
9+
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'],
10+
headers: ['Content-Type', 'Authorization', 'Origin', 'Accept'],
11+
keepHeaderOnError: true,
12+
},
13+
},
514
'strapi::poweredBy',
615
'strapi::logger',
716
'strapi::query',
817
'strapi::body',
918
'strapi::session',
1019
'strapi::favicon',
1120
'strapi::public',
12-
];
21+
]
22+
23+
24+
25+
26+

cms/config/plugins.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ./config/plugins.js`
2+
'use strict';
3+
4+
module.exports = {
5+
menus: {
6+
config: {
7+
layouts: {
8+
menuItem: {
9+
link: [
10+
{
11+
input: {
12+
label: 'Page Relation',
13+
name: 'page_relation',
14+
type: 'relation',
15+
},
16+
grid: {
17+
col: 6,
18+
},
19+
},
20+
],
21+
},
22+
},
23+
},
24+
},
25+
};

cms/package-lock.json

Lines changed: 173 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cms/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
"start": "strapi start",
99
"build": "strapi build",
1010
"strapi": "strapi",
11-
"init-env":"node init-env.js"
11+
"init-env": "node init-env.js"
1212
},
1313
"dependencies": {
1414
"@strapi/plugin-i18n": "4.14.5",
1515
"@strapi/plugin-users-permissions": "4.14.5",
1616
"@strapi/strapi": "4.14.5",
1717
"mysql": "2.18.1",
18-
"mysql2": "^3.6.2"
18+
"mysql2": "^3.6.2",
19+
"strapi-plugin-menus": "^1.6.1"
1920
},
2021
"author": {
2122
"name": "A Strapi developer"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"kind": "collectionType",
3+
"collectionName": "pages",
4+
"info": {
5+
"singularName": "page",
6+
"pluralName": "pages",
7+
"displayName": "Page",
8+
"description": ""
9+
},
10+
"options": {
11+
"draftAndPublish": true
12+
},
13+
"pluginOptions": {
14+
"i18n": {
15+
"localized": true
16+
}
17+
},
18+
"attributes": {
19+
"pageTitle": {
20+
"pluginOptions": {
21+
"i18n": {
22+
"localized": true
23+
}
24+
},
25+
"type": "string"
26+
},
27+
"heroSection": {
28+
"pluginOptions": {
29+
"i18n": {
30+
"localized": true
31+
}
32+
},
33+
"type": "dynamiczone",
34+
"components": [
35+
"general.button",
36+
"general.card"
37+
],
38+
"min": 0,
39+
"max": 1
40+
},
41+
"contentSection": {
42+
"pluginOptions": {
43+
"i18n": {
44+
"localized": true
45+
}
46+
},
47+
"type": "dynamiczone",
48+
"components": [
49+
"general.button",
50+
"general.card"
51+
],
52+
"required": true
53+
}
54+
}
55+
}

cms/src/api/page/controllers/page.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* page controller
3+
*/
4+
5+
import { factories } from '@strapi/strapi'
6+
7+
export default factories.createCoreController('api::page.page');

cms/src/api/page/routes/page.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* page router
3+
*/
4+
5+
import { factories } from '@strapi/strapi';
6+
7+
export default factories.createCoreRouter('api::page.page');

cms/src/api/page/services/page.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* page service
3+
*/
4+
5+
import { factories } from '@strapi/strapi';
6+
7+
export default factories.createCoreService('api::page.page');
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"collectionName": "components_general_buttons",
3+
"info": {
4+
"displayName": "Button",
5+
"icon": "cursor",
6+
"description": ""
7+
},
8+
"options": {},
9+
"attributes": {
10+
"text": {
11+
"type": "string"
12+
},
13+
"type": {
14+
"type": "enumeration",
15+
"enum": [
16+
"CTA",
17+
"Primary",
18+
"Secondary"
19+
],
20+
"default": "Primary"
21+
},
22+
"url": {
23+
"type": "string"
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)