strapi-plugin-navigation 1.1.3 → 2.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -87
- package/admin/src/components/EmptyView/index.js +7 -16
- package/admin/src/components/Item/ItemCardBadge/index.js +8 -0
- package/admin/src/components/Item/ItemCardHeader/Wrapper.js +21 -0
- package/admin/src/components/Item/ItemCardHeader/index.js +59 -0
- package/admin/src/components/Item/Wrapper.js +39 -0
- package/admin/src/components/Item/index.js +78 -124
- package/admin/src/components/NavigationItemList/Wrapper.js +22 -0
- package/admin/src/components/NavigationItemList/index.js +56 -0
- package/admin/src/components/PluginIcon/index.js +6 -0
- package/admin/src/components/Search/index.js +46 -83
- package/admin/src/index.js +49 -45
- package/admin/src/pages/App/index.js +31 -0
- package/admin/src/{containers → pages}/DataManagerProvider/actions.js +0 -0
- package/admin/src/{containers → pages}/DataManagerProvider/index.js +77 -84
- package/admin/src/{containers → pages}/DataManagerProvider/init.js +0 -0
- package/admin/src/pages/DataManagerProvider/reducer.js +125 -0
- package/admin/src/pages/View/components/NavigationContentHeader/index.js +18 -0
- package/admin/src/pages/View/components/NavigationHeader/index.js +60 -0
- package/admin/src/pages/View/components/NavigationItemForm/index.js +403 -0
- package/admin/src/{containers → pages}/View/components/NavigationItemForm/utils/form.js +2 -2
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupFooter.js +40 -0
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupHeader.js +20 -0
- package/admin/src/{containers → pages}/View/components/NavigationItemPopup/index.js +16 -16
- package/admin/src/pages/View/index.js +221 -0
- package/admin/src/{containers → pages}/View/utils/enums.js +0 -0
- package/admin/src/{containers → pages}/View/utils/form.js +1 -1
- package/admin/src/{containers → pages}/View/utils/index.js +0 -0
- package/admin/src/{containers → pages}/View/utils/parsers.js +13 -12
- package/admin/src/pluginId.js +3 -2
- package/admin/src/translations/en.json +47 -38
- package/admin/src/translations/fr.json +7 -1
- package/admin/src/utils/getTrad.js +2 -2
- package/package.json +18 -7
- package/server/bootstrap.js +41 -0
- package/server/config/index.js +8 -0
- package/server/config.js +8 -0
- package/server/content-types/audience/index.js +9 -0
- package/{models/audience.js → server/content-types/audience/lifecycle.js} +0 -0
- package/{models/audience.settings.json → server/content-types/audience/schema.json} +4 -2
- package/server/content-types/index.js +13 -0
- package/server/content-types/navigation/index.js +9 -0
- package/{models/navigation.js → server/content-types/navigation/lifecycle.js} +0 -0
- package/server/content-types/navigation/schema.js +45 -0
- package/server/content-types/navigation-item/index.js +9 -0
- package/{models/navigationItem.js → server/content-types/navigation-item/lifecycle.js} +0 -0
- package/{models/navigationItem.settings.json → server/content-types/navigation-item/schema.json} +16 -12
- package/server/content-types/navigations-items-related/index.js +9 -0
- package/{models/navigations_items_related.js → server/content-types/navigations-items-related/lifecycle.js} +0 -0
- package/{models/navigations_items_related.settings.json → server/content-types/navigations-items-related/schema.json} +4 -2
- package/server/controllers/index.js +7 -0
- package/{controllers → server/controllers}/navigation.js +20 -31
- package/server/graphql/index.js +23 -0
- package/server/graphql/queries/index.js +17 -0
- package/server/graphql/queries/render-navigation-child.js +16 -0
- package/server/graphql/queries/render-navigation.js +15 -0
- package/server/graphql/resolvers-config.js +4 -0
- package/server/graphql/types/content-types-name-fields.js +8 -0
- package/server/graphql/types/content-types.js +16 -0
- package/server/graphql/types/create-navigation-item.js +17 -0
- package/server/graphql/types/create-navigation-related.js +8 -0
- package/server/graphql/types/create-navigation.js +7 -0
- package/server/graphql/types/index.js +15 -0
- package/server/graphql/types/navigation-config.js +9 -0
- package/server/graphql/types/navigation-details.js +10 -0
- package/server/graphql/types/navigation-item.js +29 -0
- package/server/graphql/types/navigation-related.js +23 -0
- package/server/graphql/types/navigation-render-type.js +4 -0
- package/server/graphql/types/navigation.js +9 -0
- package/server/register.js +5 -0
- package/server/routes/admin.js +38 -0
- package/server/routes/client.js +21 -0
- package/server/routes/index.js +4 -0
- package/{services → server/services}/__tests__/navigation.test.js +0 -0
- package/server/services/index.js +7 -0
- package/server/services/navigation.js +729 -0
- package/{services → server/services}/utils/constant.js +3 -1
- package/server/services/utils/functions.js +185 -0
- package/strapi-admin.js +1 -0
- package/strapi-server.js +20 -0
- package/__mocks__/helpers/another-plugin/blog-post.settings.json +0 -31
- package/__mocks__/helpers/another-plugin/pages.settings.json +0 -28
- package/__mocks__/helpers/blog-post.settings.json +0 -31
- package/__mocks__/helpers/home-page.settings.json +0 -4
- package/__mocks__/helpers/my-homepage.settings.json +0 -27
- package/__mocks__/helpers/pages.settings.json +0 -27
- package/__mocks__/helpers/strapi.js +0 -101
- package/admin/src/assets/images/icon-cross-blue.svg +0 -1
- package/admin/src/assets/images/icon_remove.svg +0 -19
- package/admin/src/components/Container/index.js +0 -7
- package/admin/src/components/Input/index.js +0 -41
- package/admin/src/components/Item/CardItem.js +0 -46
- package/admin/src/components/Item/CardItemLevelAdd.js +0 -41
- package/admin/src/components/Item/CardItemLevelWrapper.js +0 -27
- package/admin/src/components/Item/CardItemPath.js +0 -9
- package/admin/src/components/Item/CardItemRestore.js +0 -19
- package/admin/src/components/Item/CardItemTitle.js +0 -5
- package/admin/src/components/Item/CardWrapper.js +0 -78
- package/admin/src/components/ItemFooter/CardItemError.js +0 -11
- package/admin/src/components/ItemFooter/CardItemRelation.js +0 -18
- package/admin/src/components/ItemFooter/CardItemRelationStatus.js +0 -17
- package/admin/src/components/ItemFooter/CardItemType.js +0 -18
- package/admin/src/components/ItemFooter/Wrapper.js +0 -26
- package/admin/src/components/ItemFooter/index.js +0 -66
- package/admin/src/components/ItemOrdering/CardOrderingButton.js +0 -24
- package/admin/src/components/ItemOrdering/Wrapper.js +0 -24
- package/admin/src/components/ItemOrdering/index.js +0 -36
- package/admin/src/components/List/Container.js +0 -34
- package/admin/src/components/List/ListLevelRoot.js +0 -18
- package/admin/src/components/List/index.js +0 -81
- package/admin/src/components/Option/OptionButton.js +0 -18
- package/admin/src/components/Option/OptionSet.js +0 -14
- package/admin/src/components/Option/Wrapper.js +0 -15
- package/admin/src/components/Option/index.js +0 -47
- package/admin/src/components/Select/ClearIndicator.js +0 -15
- package/admin/src/components/Select/DropdownIndicator.js +0 -39
- package/admin/src/components/Select/ErrorMessage.js +0 -10
- package/admin/src/components/Select/IndicatorSeparator.js +0 -3
- package/admin/src/components/Select/MultiValueContainer.js +0 -43
- package/admin/src/components/Select/StyledOption.js +0 -11
- package/admin/src/components/Select/index.js +0 -68
- package/admin/src/components/Select/utils/styles.js +0 -92
- package/admin/src/containers/App/Wrapper.js +0 -14
- package/admin/src/containers/App/index.js +0 -34
- package/admin/src/containers/DataManagerProvider/reducer.js +0 -136
- package/admin/src/containers/DetailsView/Wrapper.js +0 -21
- package/admin/src/containers/DetailsView/index.js +0 -111
- package/admin/src/containers/Initializer/index.js +0 -26
- package/admin/src/containers/ListView/Footer.js +0 -56
- package/admin/src/containers/ListView/components.js +0 -138
- package/admin/src/containers/ListView/index.js +0 -54
- package/admin/src/containers/View/FadedWrapper.js +0 -51
- package/admin/src/containers/View/HeaderForm.js +0 -9
- package/admin/src/containers/View/HeaderFormCell.js +0 -25
- package/admin/src/containers/View/Wrapper.js +0 -17
- package/admin/src/containers/View/components/NavigationItemForm/ModalFooter.js +0 -45
- package/admin/src/containers/View/components/NavigationItemForm/index.js +0 -427
- package/admin/src/containers/View/components/NavigationItemPopup/MediumPopup.js +0 -6
- package/admin/src/containers/View/index.js +0 -240
- package/admin/src/lifecycles.js +0 -3
- package/admin/src/permissions.js +0 -14
- package/config/functions/bootstrap.js +0 -138
- package/config/routes.json +0 -60
- package/config/schema.graphql.js +0 -209
- package/examples/audit-log-integrations.js.md +0 -38
- package/models/navigation.settings.json +0 -43
- package/public/assets/preview.png +0 -0
- package/services/navigation.js +0 -732
- package/services/utils/functions.js +0 -186
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
const {
|
|
2
|
+
last,
|
|
3
|
+
isObject,
|
|
4
|
+
isEmpty,
|
|
5
|
+
flatten,
|
|
6
|
+
find,
|
|
7
|
+
isString,
|
|
8
|
+
get,
|
|
9
|
+
} = require('lodash');
|
|
10
|
+
|
|
11
|
+
const { type: itemType } = require('../../content-types/navigation-item/lifecycle');
|
|
12
|
+
const { NavigationError } = require('../../../utils/NavigationError');
|
|
13
|
+
const { TEMPLATE_DEFAULT } = require('./constant');
|
|
14
|
+
|
|
15
|
+
module.exports = ({ strapi }) => {
|
|
16
|
+
return {
|
|
17
|
+
singularize(value = '') {
|
|
18
|
+
return last(value) === 's' ? value.substr(0, value.length - 1) : value;
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
extractMeta(plugins) {
|
|
22
|
+
const { navigation: plugin } = plugins;
|
|
23
|
+
const { navigation: service } = plugin.services;
|
|
24
|
+
const {
|
|
25
|
+
navigation: masterModel,
|
|
26
|
+
'navigation-item': itemModel,
|
|
27
|
+
audience: audienceModel,
|
|
28
|
+
'navigations-items-related': relatedModel,
|
|
29
|
+
} = plugin.contentTypes;
|
|
30
|
+
return {
|
|
31
|
+
masterModel,
|
|
32
|
+
itemModel,
|
|
33
|
+
relatedModel,
|
|
34
|
+
audienceModel,
|
|
35
|
+
service,
|
|
36
|
+
plugin,
|
|
37
|
+
pluginName: 'navigation',
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
buildNestedStructure(entities, id = null, field = 'parent') {
|
|
42
|
+
return entities
|
|
43
|
+
.filter(entity => {
|
|
44
|
+
if (entity[field] == null && id === null) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
let data = entity[field];
|
|
48
|
+
if (data && typeof id === 'string') {
|
|
49
|
+
data = data.toString();
|
|
50
|
+
}
|
|
51
|
+
return (data && data === id) || (isObject(entity[field]) && (entity[field].id === id));
|
|
52
|
+
})
|
|
53
|
+
.map(entity => {
|
|
54
|
+
return ({
|
|
55
|
+
...entity,
|
|
56
|
+
related: !isEmpty(entity.related) ? [last(entity.related)] : entity.related,
|
|
57
|
+
items: this.buildNestedStructure(entities, entity.id, field),
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
prepareAuditLog(actions) {
|
|
63
|
+
return [
|
|
64
|
+
...new Set(
|
|
65
|
+
actions
|
|
66
|
+
.filter(_ => !!_)
|
|
67
|
+
.flatMap(({ remove, create, update }) => {
|
|
68
|
+
return [create ? 'CREATE' : '', update ? 'UPDATE' : '', remove ? 'REMOVE' : '']
|
|
69
|
+
.filter(_ => !!_);
|
|
70
|
+
}),
|
|
71
|
+
),
|
|
72
|
+
]
|
|
73
|
+
.join('_');
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
sendAuditLog(auditLogInstance, event, data) {
|
|
77
|
+
if (auditLogInstance && auditLogInstance.emit) {
|
|
78
|
+
auditLogInstance.emit(event, data);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
checkDuplicatePath(parentItem, checkData) {
|
|
83
|
+
return new Promise((resolve, reject) => {
|
|
84
|
+
if (parentItem && parentItem.items) {
|
|
85
|
+
for (let item of checkData) {
|
|
86
|
+
for (let _ of parentItem.items) {
|
|
87
|
+
if (_.path === item.path && (_.id !== item.id) && (item.type === itemType.INTERNAL)) {
|
|
88
|
+
return reject(
|
|
89
|
+
new NavigationError(
|
|
90
|
+
`Duplicate path:${item.path} in parent: ${parentItem.title || 'root'} for ${item.title} and ${_.title} items`,
|
|
91
|
+
{
|
|
92
|
+
parentTitle: parentItem.title,
|
|
93
|
+
parentId: parentItem.id,
|
|
94
|
+
path: item.path,
|
|
95
|
+
errorTitles: [item.title, _.title],
|
|
96
|
+
},
|
|
97
|
+
),
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return resolve();
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
async templateNameFactory(items, strapi, contentTypes = []) {
|
|
108
|
+
const flatRelated = flatten(items.map(i => i.related)).filter(_ => !!_);
|
|
109
|
+
const relatedMap = flatRelated.reduce((acc, curr) => {
|
|
110
|
+
if (!acc[curr.__contentType]) {
|
|
111
|
+
acc[curr.__contentType] = [];
|
|
112
|
+
}
|
|
113
|
+
acc[curr.__contentType].push(curr.id);
|
|
114
|
+
return acc;
|
|
115
|
+
}, {});
|
|
116
|
+
const responses = await Promise.all(
|
|
117
|
+
Object.entries(relatedMap)
|
|
118
|
+
.map(
|
|
119
|
+
([contentType, ids]) => {
|
|
120
|
+
const contentTypeUid = get(find(contentTypes, cnt => cnt.uid === contentType), 'uid');
|
|
121
|
+
return strapi.query(contentTypeUid)
|
|
122
|
+
.findMany({ id_in: ids, _limit: -1 })
|
|
123
|
+
.then(res => ({ [contentType]: res }))
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
126
|
+
const relatedResponseMap = responses.reduce((acc, curr) => ({ ...acc, ...curr }), {});
|
|
127
|
+
const singleTypes = new Map(
|
|
128
|
+
contentTypes
|
|
129
|
+
.filter(x => x.isSingle)
|
|
130
|
+
.map(({ contentTypeName, templateName }) => [contentTypeName, templateName || contentTypeName])
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
return (contentType, id) => {
|
|
134
|
+
const template = get(relatedResponseMap[contentType].find(data => data.id === id), 'template');
|
|
135
|
+
|
|
136
|
+
if (template) {
|
|
137
|
+
const templateComponent = this.getTemplateComponentFromTemplate(template);
|
|
138
|
+
return get(templateComponent, 'options.templateName', TEMPLATE_DEFAULT);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (singleTypes.get(contentType)) {
|
|
142
|
+
return singleTypes.get(contentType);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return TEMPLATE_DEFAULT;
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
getTemplateComponentFromTemplate(template = []) {
|
|
150
|
+
const componentName = get(first(template), '__component');
|
|
151
|
+
return componentName ? strapi.components[componentName] : null;
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
composeItemTitle(item = {}, fields = {}, contentTypes = []) {
|
|
155
|
+
const { title, related } = item;
|
|
156
|
+
if (title) {
|
|
157
|
+
return isString(title) && !isEmpty(title) ? title : undefined;
|
|
158
|
+
} else if (related) {
|
|
159
|
+
const relationTitle = this.extractItemRelationTitle(isArray(related) ? last(related) : related, fields, { contentTypes });
|
|
160
|
+
return isString(relationTitle) && !isEmpty(relationTitle) ? relationTitle : undefined;
|
|
161
|
+
}
|
|
162
|
+
return undefined;
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
extractItemRelationTitle(relatedItem = {}, fields = {}, contentTypes = []) {
|
|
166
|
+
const { __contentType } = relatedItem;
|
|
167
|
+
const contentType = find(contentTypes, _ => _.contentTypeName === __contentType);
|
|
168
|
+
const { default: defaultFields = [] } = fields;
|
|
169
|
+
return get(fields, `${contentType ? contentType.collectionName : ''}`, defaultFields).map((_) => relatedItem[_]).filter((_) => _)[0] || '';
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
filterOutUnpublished(item) {
|
|
173
|
+
const relatedItem = item.related && last(item.related);
|
|
174
|
+
const isHandledByPublshFlow = relatedItem ? 'published_at' in relatedItem : false;
|
|
175
|
+
|
|
176
|
+
if (isHandledByPublshFlow) {
|
|
177
|
+
const isRelatedDefinedAndPublished = relatedItem ?
|
|
178
|
+
isHandledByPublshFlow && get(relatedItem, 'published_at') :
|
|
179
|
+
false;
|
|
180
|
+
return item.type === itemType.INTERNAL ? isRelatedDefinedAndPublished : true;
|
|
181
|
+
}
|
|
182
|
+
return (item.type === itemType.EXTERNAL) || relatedItem;
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
package/strapi-admin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./admin/src').default;
|
package/strapi-server.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const bootstrap = require('./server/bootstrap');
|
|
2
|
+
const services = require('./server/services');
|
|
3
|
+
const routes = require('./server/routes');
|
|
4
|
+
const controllers = require('./server/controllers');
|
|
5
|
+
const contentTypes = require('./server/content-types');
|
|
6
|
+
const config = require('./server/config');
|
|
7
|
+
const register = require('./server/register');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
module.exports = () => {
|
|
11
|
+
return {
|
|
12
|
+
bootstrap,
|
|
13
|
+
config,
|
|
14
|
+
routes,
|
|
15
|
+
controllers,
|
|
16
|
+
services,
|
|
17
|
+
contentTypes,
|
|
18
|
+
register,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"uid": "plugins::another-plugin.blog-post",
|
|
3
|
-
"plugin": "another-plugin",
|
|
4
|
-
"kind": "collectionType",
|
|
5
|
-
"collectionName": "blog_posts",
|
|
6
|
-
"info": {
|
|
7
|
-
"name": "Blog post"
|
|
8
|
-
},
|
|
9
|
-
"options": {
|
|
10
|
-
"increments": true,
|
|
11
|
-
"timestamps": true,
|
|
12
|
-
"searchable": true,
|
|
13
|
-
"previewable": true
|
|
14
|
-
},
|
|
15
|
-
"attributes": {
|
|
16
|
-
"title": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"required": true
|
|
19
|
-
},
|
|
20
|
-
"altTitle": {
|
|
21
|
-
"type": "string"
|
|
22
|
-
},
|
|
23
|
-
"navigation": {
|
|
24
|
-
"model": "navigationitem",
|
|
25
|
-
"plugin": "navigation",
|
|
26
|
-
"via": "related",
|
|
27
|
-
"configurable": false,
|
|
28
|
-
"hidden": true
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"uid": "plugins::another-plugin.pages",
|
|
3
|
-
"plugin": "another-plugin",
|
|
4
|
-
"kind": "collectionType",
|
|
5
|
-
"collectionName": "pages",
|
|
6
|
-
"info": {
|
|
7
|
-
"name": "Pages"
|
|
8
|
-
},
|
|
9
|
-
"options": {
|
|
10
|
-
"increments": true,
|
|
11
|
-
"timestamps": true,
|
|
12
|
-
"searchable": true,
|
|
13
|
-
"previewable": true
|
|
14
|
-
},
|
|
15
|
-
"attributes": {
|
|
16
|
-
"title": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"required": true
|
|
19
|
-
},
|
|
20
|
-
"navigation": {
|
|
21
|
-
"model": "navigationitem",
|
|
22
|
-
"plugin": "navigation",
|
|
23
|
-
"via": "related",
|
|
24
|
-
"configurable": false,
|
|
25
|
-
"hidden": true
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"uid": "application::blog-post.blog-post",
|
|
3
|
-
"kind": "collectionType",
|
|
4
|
-
"collectionName": "blog_posts",
|
|
5
|
-
"info": {
|
|
6
|
-
"name": "Blog post"
|
|
7
|
-
},
|
|
8
|
-
"options": {
|
|
9
|
-
"increments": true,
|
|
10
|
-
"timestamps": true,
|
|
11
|
-
"searchable": true,
|
|
12
|
-
"previewable": true,
|
|
13
|
-
"draftAndPublish": true
|
|
14
|
-
},
|
|
15
|
-
"attributes": {
|
|
16
|
-
"title": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"required": true
|
|
19
|
-
},
|
|
20
|
-
"altTitle": {
|
|
21
|
-
"type": "string"
|
|
22
|
-
},
|
|
23
|
-
"navigation": {
|
|
24
|
-
"model": "navigationitem",
|
|
25
|
-
"plugin": "navigation",
|
|
26
|
-
"via": "related",
|
|
27
|
-
"configurable": false,
|
|
28
|
-
"hidden": true
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
"uid": "application::page-homes.home-page",
|
|
4
|
-
"kind": "singleType", "collectionName": "page_homes", "info": { "name": "Page Home" }, "options": { "increments": true, "timestamps": true, "draftAndPublish": true }, "attributes": { "Subtitle": { "type": "string" }, "Title": { "type": "string" }, "Summary": { "type": "text" }, "Image": { "model": "file", "via": "related", "allowedTypes": [ "images" ], "plugin": "upload", "required": false }, "Components": { "type": "dynamiczone", "components": [] }, "navigation": { "model": "navigationitem", "plugin": "navigation", "via": "related", "configurable": false, "hidden": true } } }
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"uid": "application::my-homepages.my-homepage",
|
|
3
|
-
"kind": "singleType",
|
|
4
|
-
"collectionName": "my-homepages",
|
|
5
|
-
"info": {
|
|
6
|
-
"name": "My Homepage",
|
|
7
|
-
"description": ""
|
|
8
|
-
},
|
|
9
|
-
"options": {
|
|
10
|
-
"increments": true,
|
|
11
|
-
"timestamps": true,
|
|
12
|
-
"draftAndPublish": true,
|
|
13
|
-
"templateName": "AwesomeTemplate"
|
|
14
|
-
},
|
|
15
|
-
"attributes": {
|
|
16
|
-
"Welcome": {
|
|
17
|
-
"type": "string"
|
|
18
|
-
},
|
|
19
|
-
"navigation": {
|
|
20
|
-
"model": "navigationitem",
|
|
21
|
-
"plugin": "navigation",
|
|
22
|
-
"via": "related",
|
|
23
|
-
"configurable": false,
|
|
24
|
-
"hidden": true
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"uid": "application::pages.pages",
|
|
3
|
-
"kind": "collectionType",
|
|
4
|
-
"collectionName": "pages",
|
|
5
|
-
"info": {
|
|
6
|
-
"name": "Pages"
|
|
7
|
-
},
|
|
8
|
-
"options": {
|
|
9
|
-
"increments": true,
|
|
10
|
-
"timestamps": true,
|
|
11
|
-
"searchable": true,
|
|
12
|
-
"previewable": true
|
|
13
|
-
},
|
|
14
|
-
"attributes": {
|
|
15
|
-
"title": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"required": true
|
|
18
|
-
},
|
|
19
|
-
"navigation": {
|
|
20
|
-
"model": "navigationitem",
|
|
21
|
-
"plugin": "navigation",
|
|
22
|
-
"via": "related",
|
|
23
|
-
"configurable": false,
|
|
24
|
-
"hidden": true
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
const {get} = require('lodash');
|
|
2
|
-
function setupStrapi() {
|
|
3
|
-
Object.defineProperty(global, 'strapi', {
|
|
4
|
-
value: {
|
|
5
|
-
query: jest.fn().mockImplementation(() => ({
|
|
6
|
-
count: jest.fn().mockImplementation(),
|
|
7
|
-
})),
|
|
8
|
-
config: {
|
|
9
|
-
custom: {
|
|
10
|
-
plugins: {
|
|
11
|
-
navigation: {
|
|
12
|
-
contentTypesNameFields: {
|
|
13
|
-
'blog_posts': ['altTitle'],
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
get(path, defaultValue) {
|
|
19
|
-
return get(strapi, path, defaultValue);
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
api: {
|
|
23
|
-
'home-page': {
|
|
24
|
-
config: {
|
|
25
|
-
routes: [
|
|
26
|
-
{
|
|
27
|
-
method: 'GET',
|
|
28
|
-
path: '/custom-api',
|
|
29
|
-
handler: 'home-page.find',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
method: 'PUT',
|
|
33
|
-
path: '/custom-api',
|
|
34
|
-
handler: 'home-page.update',
|
|
35
|
-
},
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
contentTypes: {
|
|
41
|
-
'pages': {
|
|
42
|
-
...require('./pages.settings.json'),
|
|
43
|
-
apiName: 'pages',
|
|
44
|
-
modelName: 'pages',
|
|
45
|
-
associations: [{ model: 'navigationitem' }],
|
|
46
|
-
},
|
|
47
|
-
'application::blog-post.blog-post': {
|
|
48
|
-
...require('./blog-post.settings.json'),
|
|
49
|
-
apiName: 'blog-posts',
|
|
50
|
-
modelName: 'blog-posts',
|
|
51
|
-
associations: [{ model: 'navigationitem' }],
|
|
52
|
-
},
|
|
53
|
-
'application::my-homepages.my-homepage': {
|
|
54
|
-
...require('./my-homepage.settings.json'),
|
|
55
|
-
apiName: 'my-homepage',
|
|
56
|
-
modelName: 'my-homepage',
|
|
57
|
-
associations: [{ model: 'navigationitem' }],
|
|
58
|
-
},
|
|
59
|
-
'application::page-homes.home-page': {
|
|
60
|
-
...require('./home-page.settings.json'),
|
|
61
|
-
apiName: 'custom-api',
|
|
62
|
-
modelName: 'home-page',
|
|
63
|
-
associations: [{ model: 'navigationitem' }],
|
|
64
|
-
},
|
|
65
|
-
'plugins::another-plugin.pages': {
|
|
66
|
-
...require('./another-plugin/pages.settings.json'),
|
|
67
|
-
modelName: 'plugin-pages',
|
|
68
|
-
associations: [{ model: 'navigationitem' }],
|
|
69
|
-
},
|
|
70
|
-
'plugins::another-plugin.blog-post': {
|
|
71
|
-
...require('./another-plugin/blog-post.settings.json'),
|
|
72
|
-
modelName: 'plugin-blog-posts',
|
|
73
|
-
associations: [{ model: 'navigationitem' }],
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
plugins: {
|
|
77
|
-
navigation: {
|
|
78
|
-
services: {
|
|
79
|
-
navigation: jest.fn().mockImplementation(),
|
|
80
|
-
},
|
|
81
|
-
relatedContentTypes: [
|
|
82
|
-
'application::pages.pages',
|
|
83
|
-
'application::blog-post.blog-post',
|
|
84
|
-
'application::my-homepages.my-homepage',
|
|
85
|
-
'application::page-homes.home-page',
|
|
86
|
-
'plugins::another-plugin.pages',
|
|
87
|
-
'plugins::another-plugin.blog-post'
|
|
88
|
-
]
|
|
89
|
-
},
|
|
90
|
-
anotherPlugin: {
|
|
91
|
-
models: {
|
|
92
|
-
'plugin-pages': require('./another-plugin/pages.settings.json'),
|
|
93
|
-
'plugin-blog-post': require('./another-plugin/blog-post.settings.json'),
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
writable: true,
|
|
99
|
-
})
|
|
100
|
-
}
|
|
101
|
-
module.exports = { setupStrapi };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="8" height="8" xmlns="http://www.w3.org/2000/svg"><path d="M7.78 6.72L5.06 4l2.72-2.72a.748.748 0 0 0 0-1.06.748.748 0 0 0-1.06 0L4 2.94 1.28.22a.748.748 0 0 0-1.06 0 .748.748 0 0 0 0 1.06L2.94 4 .22 6.72a.748.748 0 0 0 0 1.06.748.748 0 0 0 1.06 0L4 5.06l2.72 2.72a.748.748 0 0 0 1.06 0 .752.752 0 0 0 0-1.06z" fill="#007EFF" fill-rule="evenodd"/></svg>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<!-- Generator: Sketch 49.3 (51167) - http://www.bohemiancoding.com/sketch -->
|
|
4
|
-
<title>Icon remove</title>
|
|
5
|
-
<desc>Created with Sketch.</desc>
|
|
6
|
-
<defs></defs>
|
|
7
|
-
<g id="Pages" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
8
|
-
<g id="Content-Manager---List-view" transform="translate(-279.000000, -165.000000)">
|
|
9
|
-
<g id="Container" transform="translate(234.000000, 0.000000)">
|
|
10
|
-
<g id="Add-filters" transform="translate(0.000000, 60.000000)">
|
|
11
|
-
<g id="Icon-remove" transform="translate(45.000000, 105.000000)">
|
|
12
|
-
<rect id="Rectangle-12" stroke="#E3E9F3" x="0.5" y="0.5" width="19" height="19" rx="9.5"></rect>
|
|
13
|
-
<path d="M6,10 L14,10" id="Line-4" stroke="#007EFF" stroke-width="2" stroke-linecap="round"></path>
|
|
14
|
-
</g>
|
|
15
|
-
</g>
|
|
16
|
-
</g>
|
|
17
|
-
</g>
|
|
18
|
-
</g>
|
|
19
|
-
</svg>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Inputs } from "@buffetjs/custom";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { useIntl } from "react-intl";
|
|
5
|
-
|
|
6
|
-
const Input = ({ error, label, placeholder, ...rest }) => {
|
|
7
|
-
const { formatMessage } = useIntl();
|
|
8
|
-
const labelMessage = formatMessage({ id: label });
|
|
9
|
-
const placeholderMessage = placeholder
|
|
10
|
-
? formatMessage({ id: placeholder })
|
|
11
|
-
: "";
|
|
12
|
-
let errorMessage = error;
|
|
13
|
-
|
|
14
|
-
if (error) {
|
|
15
|
-
errorMessage = formatMessage(error);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Inputs
|
|
20
|
-
{...rest}
|
|
21
|
-
error={errorMessage}
|
|
22
|
-
label={labelMessage}
|
|
23
|
-
placeholder={placeholderMessage}
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
Input.defaultProps = {
|
|
29
|
-
error: null,
|
|
30
|
-
placeholder: null,
|
|
31
|
-
containerStyle: {},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
Input.propTypes = {
|
|
35
|
-
error: PropTypes.object,
|
|
36
|
-
label: PropTypes.string.isRequired,
|
|
37
|
-
placeholder: PropTypes.string,
|
|
38
|
-
containerStyle: PropTypes.object,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default Input;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import { Card } from "@buffetjs/styles";
|
|
3
|
-
import { colors } from "strapi-helper-plugin";
|
|
4
|
-
|
|
5
|
-
export const CartItemWidth = "25vw";
|
|
6
|
-
|
|
7
|
-
const CardItem = styled(Card)`
|
|
8
|
-
max-width: ${CartItemWidth};
|
|
9
|
-
margin-bottom: ${(props) => (props.hasChildren ? 0 : "2rem")};
|
|
10
|
-
padding: 1rem;
|
|
11
|
-
|
|
12
|
-
border-bottom: tranparent;
|
|
13
|
-
|
|
14
|
-
position: relative;
|
|
15
|
-
|
|
16
|
-
transition: all 0.15s ease-in-out;
|
|
17
|
-
|
|
18
|
-
${({hasError, theme})=> hasError && `
|
|
19
|
-
border: 1px solid ${theme.main.colors.red};
|
|
20
|
-
`}
|
|
21
|
-
|
|
22
|
-
${ props => !props.removed && `
|
|
23
|
-
&:hover {
|
|
24
|
-
background-color: ${colors.lightGrey};
|
|
25
|
-
|
|
26
|
-
padding-left: 1.5rem;
|
|
27
|
-
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
}
|
|
30
|
-
`}
|
|
31
|
-
|
|
32
|
-
${ props => props.removed && `
|
|
33
|
-
background-color: ${colors.lightGrey};
|
|
34
|
-
|
|
35
|
-
p, small, span {
|
|
36
|
-
filter: blur(.25rem);
|
|
37
|
-
-webkit-filter: blur(.25rem);
|
|
38
|
-
}
|
|
39
|
-
`}
|
|
40
|
-
|
|
41
|
-
p {
|
|
42
|
-
margin-bottom: 0;
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
export default CardItem;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
import { Button } from "@buffetjs/core";
|
|
4
|
-
import { sizes } from "strapi-helper-plugin";
|
|
5
|
-
import { CartItemWidth } from "./CardItem";
|
|
6
|
-
|
|
7
|
-
export const buttonRadius = 1.6 * sizes.margin;
|
|
8
|
-
|
|
9
|
-
const CardItemLevelAdd = styled(Button)`
|
|
10
|
-
display: flex;
|
|
11
|
-
width: ${2 * buttonRadius}px;
|
|
12
|
-
height: ${2 * buttonRadius}px;
|
|
13
|
-
margin-left: ${(props) => (props.root ? `${-1 * buttonRadius}px` : "2rem")};
|
|
14
|
-
align-items: center;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
|
|
17
|
-
position: absolute;
|
|
18
|
-
top: ${(props) => (props.root ? "-2rem" : `${3.2 * sizes.margin}px`)};
|
|
19
|
-
bottom: auto;
|
|
20
|
-
left: ${(props) => (props.root ? "2rem" : CartItemWidth)};
|
|
21
|
-
z-index: 1;
|
|
22
|
-
|
|
23
|
-
border-radius: ${buttonRadius}px;
|
|
24
|
-
|
|
25
|
-
${(props) =>
|
|
26
|
-
!props.menuLevel &&
|
|
27
|
-
`
|
|
28
|
-
background: none;
|
|
29
|
-
|
|
30
|
-
&:hover,
|
|
31
|
-
&:active {
|
|
32
|
-
background: none;
|
|
33
|
-
}
|
|
34
|
-
`}
|
|
35
|
-
|
|
36
|
-
svg {
|
|
37
|
-
margin-right: 0;
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
export default CardItemLevelAdd;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
import { sizes } from "strapi-helper-plugin";
|
|
4
|
-
import CardItem from "./CardItem";
|
|
5
|
-
|
|
6
|
-
const CardItemLevelWrapper = styled.ul`
|
|
7
|
-
padding: 0;
|
|
8
|
-
margin: 0;
|
|
9
|
-
|
|
10
|
-
list-style: none;
|
|
11
|
-
|
|
12
|
-
position: relative;
|
|
13
|
-
z-index: 1;
|
|
14
|
-
|
|
15
|
-
${CardItemLevelWrapper} {
|
|
16
|
-
padding-left: ${4 * sizes.margin}px;
|
|
17
|
-
|
|
18
|
-
position: relative;
|
|
19
|
-
z-index: 0;
|
|
20
|
-
|
|
21
|
-
${CardItem} {
|
|
22
|
-
margin-top: ${2 * sizes.margin}px;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
export default CardItemLevelWrapper;
|