@eeacms/volto-eea-website-policy 0.3.0 → 0.3.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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/components/Blocks/ContextNavigation/ContextNavigationEdit.jsx +31 -0
- package/src/components/Blocks/ContextNavigation/ContextNavigationView.jsx +17 -0
- package/src/components/Blocks/ContextNavigation/index.js +26 -0
- package/src/components/Blocks/ContextNavigation/schema.js +81 -0
- package/src/index.js +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [0.3.1](https://github.com/eea/volto-eea-website-policy/compare/0.3.0...0.3.1)
|
|
8
|
+
|
|
9
|
+
- feature(navigation): addde context navigation block [`2b0b6f6`](https://github.com/eea/volto-eea-website-policy/commit/2b0b6f616adf85ab41365a7cf6ee6e690ff9fd0c)
|
|
10
|
+
|
|
7
11
|
#### [0.3.0](https://github.com/eea/volto-eea-website-policy/compare/0.2.6...0.3.0)
|
|
8
12
|
|
|
13
|
+
> 6 July 2022
|
|
14
|
+
|
|
15
|
+
- change(teaser): enabled theming for icon and text color [`#13`](https://github.com/eea/volto-eea-website-policy/pull/13)
|
|
9
16
|
- change(package): bump release version [`1b00439`](https://github.com/eea/volto-eea-website-policy/commit/1b0043933442bb73c1042dce644a2c09e5f210f4)
|
|
10
17
|
- change(item): enable theming for icon and text color and added tertiary option [`58c2d28`](https://github.com/eea/volto-eea-website-policy/commit/58c2d2864fe94c9e7808064b61d3b6c4e6fccbb1)
|
|
11
18
|
- change(item): commented sizes too small for item icons and enabled tertiary theme [`0f02d7d`](https://github.com/eea/volto-eea-website-policy/commit/0f02d7d6204b068b78c3f977a561782a19b6f79e)
|
package/package.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EditSchema } from './schema';
|
|
3
|
+
import { InlineForm, SidebarPortal } from '@plone/volto/components';
|
|
4
|
+
import ContextNavigationView from './ContextNavigationView';
|
|
5
|
+
|
|
6
|
+
const ContextNavigationFillView = (props) => {
|
|
7
|
+
const schema = EditSchema();
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<h3>Context navigation</h3>
|
|
11
|
+
<ContextNavigationView {...props} />{' '}
|
|
12
|
+
<SidebarPortal selected={props.selected}>
|
|
13
|
+
{props.selected && (
|
|
14
|
+
<InlineForm
|
|
15
|
+
title={schema.title}
|
|
16
|
+
schema={schema}
|
|
17
|
+
formData={props.data}
|
|
18
|
+
onChangeField={(id, value) => {
|
|
19
|
+
props.onChangeBlock(props.block, {
|
|
20
|
+
...props.data,
|
|
21
|
+
[id]: value,
|
|
22
|
+
});
|
|
23
|
+
}}
|
|
24
|
+
/>
|
|
25
|
+
)}
|
|
26
|
+
</SidebarPortal>
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default ContextNavigationFillView;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ConnectedContextNavigation from '@plone/volto/components/theme/Navigation/ContextNavigation';
|
|
3
|
+
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
4
|
+
|
|
5
|
+
const ContextNavigationView = ({ data = {} }) => {
|
|
6
|
+
const navProps = { ...data };
|
|
7
|
+
const root_path = data?.root_node?.[0]?.['@id'];
|
|
8
|
+
if (root_path) navProps['root_path'] = flattenToAppURL(root_path);
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<ConnectedContextNavigation params={navProps} />
|
|
13
|
+
</>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default ContextNavigationView;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import codeSVG from '@plone/volto/icons/code.svg';
|
|
2
|
+
import ContextNavigationEdit from './ContextNavigationEdit';
|
|
3
|
+
import ContextNavigationView from './ContextNavigationView';
|
|
4
|
+
import BlockSettingsSchema from '@plone/volto/components/manage/Blocks/Block/Schema';
|
|
5
|
+
|
|
6
|
+
export default (config) => {
|
|
7
|
+
config.blocks.blocksConfig.contextNavigation = {
|
|
8
|
+
id: 'contextNavigation',
|
|
9
|
+
title: 'Navigation',
|
|
10
|
+
icon: codeSVG,
|
|
11
|
+
group: 'site',
|
|
12
|
+
view: ContextNavigationView,
|
|
13
|
+
edit: ContextNavigationEdit,
|
|
14
|
+
schema: BlockSettingsSchema,
|
|
15
|
+
restricted: false,
|
|
16
|
+
mostUsed: true,
|
|
17
|
+
blockHasOwnFocusManagement: true,
|
|
18
|
+
sidebarTab: 1,
|
|
19
|
+
security: {
|
|
20
|
+
addPermission: [],
|
|
21
|
+
view: [],
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return config;
|
|
26
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const EditSchema = () => {
|
|
2
|
+
return {
|
|
3
|
+
title: 'Navigation',
|
|
4
|
+
fieldsets: [
|
|
5
|
+
{
|
|
6
|
+
id: 'default',
|
|
7
|
+
title: 'Default',
|
|
8
|
+
fields: [
|
|
9
|
+
'name',
|
|
10
|
+
'root_node',
|
|
11
|
+
'includeTop',
|
|
12
|
+
'currentFolderOnly',
|
|
13
|
+
'topLevel',
|
|
14
|
+
'bottomLevel',
|
|
15
|
+
'no_icons',
|
|
16
|
+
'thumb_scale',
|
|
17
|
+
'no_thumbs',
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
required: [],
|
|
22
|
+
properties: {
|
|
23
|
+
name: {
|
|
24
|
+
title: 'Title',
|
|
25
|
+
description: 'The title of the navigation tree',
|
|
26
|
+
},
|
|
27
|
+
root_node: {
|
|
28
|
+
title: 'Root node',
|
|
29
|
+
description:
|
|
30
|
+
'You may search for and choose a folder to act as the root of the navigation tree. Leave blank to use the Plone site root.',
|
|
31
|
+
widget: 'object_browser',
|
|
32
|
+
// TODO: these don't work. Why?
|
|
33
|
+
mode: 'link',
|
|
34
|
+
selectedItemAttrs: ['Title', 'Description'],
|
|
35
|
+
},
|
|
36
|
+
includeTop: {
|
|
37
|
+
title: 'Include top node',
|
|
38
|
+
description:
|
|
39
|
+
"Whether or not to show the top, or 'root', node in the navigation tree. This is affected by the 'Start level' setting.",
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
},
|
|
42
|
+
currentFolderOnly: {
|
|
43
|
+
title: 'Only show the contents of the current folder',
|
|
44
|
+
description:
|
|
45
|
+
'If selected, the navigation tree will only show the current folder and its children at all times.',
|
|
46
|
+
type: 'boolean',
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
topLevel: {
|
|
50
|
+
title: 'Start level',
|
|
51
|
+
description:
|
|
52
|
+
'An integer value that specifies the number of folder levels below the site root that must be exceeded before the navigation tree will display. 0 means that the navigation tree should be displayed everywhere including pages in the root of the site. 1 means the tree only shows up inside folders located in the root and downwards, never showing at the top level.',
|
|
53
|
+
type: 'number',
|
|
54
|
+
default: 1,
|
|
55
|
+
},
|
|
56
|
+
bottomLevel: {
|
|
57
|
+
title: 'Navigation tree depth',
|
|
58
|
+
description:
|
|
59
|
+
'How many folders should be included before the navigation tree stops. 0 means no limit. 1 only includes the root folder.',
|
|
60
|
+
type: 'number',
|
|
61
|
+
default: 0,
|
|
62
|
+
},
|
|
63
|
+
no_icons: {
|
|
64
|
+
title: 'Supress icons',
|
|
65
|
+
description:
|
|
66
|
+
'If enabled, the portlet will not show document type icons.',
|
|
67
|
+
type: 'boolean',
|
|
68
|
+
},
|
|
69
|
+
thumb_scale: {
|
|
70
|
+
title: 'Override thumb scale',
|
|
71
|
+
description:
|
|
72
|
+
"Enter a valid scale name (see 'Image Handling' control panel) to override (e.g. icon, tile, thumb, mini, preview, ... ). Leave empty to use default (see 'Site' control panel).",
|
|
73
|
+
},
|
|
74
|
+
no_thumbs: {
|
|
75
|
+
title: 'Supress thumbs',
|
|
76
|
+
type: 'boolean',
|
|
77
|
+
description: 'If enabled, the portlet will not show thumbs.',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
};
|
package/src/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { runtimeConfig } from '@plone/volto/runtime_config';
|
|
|
2
2
|
import installCallout from 'volto-slate/editor/plugins/Callout';
|
|
3
3
|
import installItemBlock from '@eeacms/volto-eea-website-policy/components/Blocks/Item';
|
|
4
4
|
import customizeTeaserBlock from '@eeacms/volto-eea-website-policy/components/Blocks/Teaser';
|
|
5
|
+
import installContextNavigationBlock from '@eeacms/volto-eea-website-policy/components/Blocks/ContextNavigation';
|
|
5
6
|
|
|
6
7
|
const applyConfig = (config) => {
|
|
7
8
|
// if (process.env.NODE_ENV === 'production') {
|
|
@@ -99,10 +100,11 @@ const applyConfig = (config) => {
|
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
// Custom blocks
|
|
102
|
-
config = [
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
config = [
|
|
104
|
+
installItemBlock,
|
|
105
|
+
installContextNavigationBlock,
|
|
106
|
+
customizeTeaserBlock,
|
|
107
|
+
].reduce((acc, apply) => apply(acc), config);
|
|
106
108
|
config.blocks.blocksConfig.item.mostUsed = true;
|
|
107
109
|
|
|
108
110
|
// Disable some blocks
|