strapi-plugin-navigation 1.1.0 → 1.1.1
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 +10 -29
- package/config/schema.graphql.js +2 -3
- package/package.json +1 -1
- package/services/navigation.js +5 -5
package/README.md
CHANGED
|
@@ -73,40 +73,22 @@ Complete installation requirements are exact same as for Strapi itself and can b
|
|
|
73
73
|
|
|
74
74
|
## Content Type model relation to Navigation Item
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
inside the `attributes` section like in example below:
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
"attributes": {
|
|
92
|
-
...,
|
|
93
|
-
"navigation": {
|
|
94
|
-
"model": "navigationitem",
|
|
95
|
-
"plugin": "navigation",
|
|
96
|
-
"via": "related",
|
|
97
|
-
"configurable": false,
|
|
98
|
-
"hidden": true
|
|
99
|
-
},
|
|
100
|
-
...
|
|
101
|
-
},
|
|
76
|
+
We can define in `config/plugins.js`
|
|
77
|
+
```js
|
|
78
|
+
navigation: {
|
|
79
|
+
...
|
|
80
|
+
relatedContentTypes: [
|
|
81
|
+
'application::pages.pages'
|
|
82
|
+
],
|
|
83
|
+
...
|
|
84
|
+
},
|
|
102
85
|
```
|
|
103
86
|
|
|
104
87
|
## Configuration
|
|
105
|
-
To setup the plugin properly we recommend to put following snippet as part of `config/
|
|
88
|
+
To setup the plugin properly we recommend to put following snippet as part of `config/plugins.js` or `config/<env>/plugins.js` file. If you've got already configurations for other plugins stores by this way, use just the `navigation` part within exising `plugins` item.
|
|
106
89
|
|
|
107
90
|
```js
|
|
108
91
|
...
|
|
109
|
-
plugins: {
|
|
110
92
|
navigation: {
|
|
111
93
|
additionalFields: ['audience'],
|
|
112
94
|
allowedLevels: 2,
|
|
@@ -116,7 +98,6 @@ To setup the plugin properly we recommend to put following snippet as part of `c
|
|
|
116
98
|
},
|
|
117
99
|
gql: { ... }
|
|
118
100
|
},
|
|
119
|
-
},
|
|
120
101
|
...
|
|
121
102
|
```
|
|
122
103
|
|
package/config/schema.graphql.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const {get} = require('lodash');
|
|
2
1
|
const NAVIGATION_DATE = `
|
|
3
2
|
# SQL
|
|
4
3
|
created_at: String
|
|
@@ -25,12 +24,12 @@ const NAVIGATION = `
|
|
|
25
24
|
`;
|
|
26
25
|
|
|
27
26
|
const getContentTypesNamesFields = () => {
|
|
28
|
-
const contentTypesNameFields = strapi.config.get('
|
|
27
|
+
const contentTypesNameFields = strapi.config.get('plugins.navigation.contentTypesNameFields');
|
|
29
28
|
return Object.keys(contentTypesNameFields || {}).map(key => `${key}: [String]!`).join('\n');
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
const getNavigationRelated = () => {
|
|
33
|
-
const related = strapi.config.get('
|
|
32
|
+
const related = strapi.config.get('plugins.navigation.gql.navigationItemRelated');
|
|
34
33
|
if (related) {
|
|
35
34
|
return related;
|
|
36
35
|
}
|
package/package.json
CHANGED
package/services/navigation.js
CHANGED
|
@@ -36,9 +36,9 @@ const contentTypesNameFieldsDefaults = [
|
|
|
36
36
|
'subject',
|
|
37
37
|
'name',
|
|
38
38
|
];
|
|
39
|
-
const
|
|
39
|
+
const getContentTypesNameFields = () => get(
|
|
40
40
|
strapi.config,
|
|
41
|
-
'
|
|
41
|
+
'plugins.navigation.contentTypesNameFields',
|
|
42
42
|
{},
|
|
43
43
|
);
|
|
44
44
|
|
|
@@ -51,15 +51,15 @@ module.exports = {
|
|
|
51
51
|
// Get plugin configuration
|
|
52
52
|
async config() {
|
|
53
53
|
const { pluginName, service, audienceModel } = utilsFunctions.extractMeta(strapi.plugins);
|
|
54
|
-
const additionalFields = get(strapi.config, '
|
|
54
|
+
const additionalFields = get(strapi.config, 'plugins.navigation.additionalFields', []);
|
|
55
55
|
let extendedResult = {};
|
|
56
56
|
const result = {
|
|
57
57
|
contentTypes: await service.configContentTypes(),
|
|
58
58
|
contentTypesNameFields: {
|
|
59
59
|
default: contentTypesNameFieldsDefaults,
|
|
60
|
-
...(
|
|
60
|
+
...getContentTypesNameFields(),
|
|
61
61
|
},
|
|
62
|
-
allowedLevels: get(strapi.config, '
|
|
62
|
+
allowedLevels: get(strapi.config, 'plugins.navigation.allowedLevels'),
|
|
63
63
|
additionalFields,
|
|
64
64
|
};
|
|
65
65
|
|