@eeacms/volto-eea-website-theme 1.20.0 → 1.21.0
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 +15 -0
- package/jest-addon.config.js +4 -4
- package/locales/de/LC_MESSAGES/volto.po +48 -0
- package/locales/en/LC_MESSAGES/volto.po +62 -0
- package/locales/it/LC_MESSAGES/volto.po +48 -0
- package/locales/ro/LC_MESSAGES/volto.po +48 -0
- package/locales/volto.pot +49 -1
- package/package.json +3 -1
- package/src/components/manage/Blocks/GroupBlockTemplate/FlexGroup/FlexGroup.jsx +128 -0
- package/src/components/manage/Blocks/GroupBlockTemplate/FlexGroup/RenderBlocks.jsx +75 -0
- package/src/components/manage/Blocks/GroupBlockTemplate/FlexGroup/editor-flex.less +14 -0
- package/src/customizations/volto/components/manage/Blocks/LeadImage/AlignChooser.jsx +1 -1
- package/src/customizations/volto/components/manage/Blocks/LeadImage/AlignChooser.test.js +50 -0
- package/src/customizations/volto/components/theme/ContactForm/ContactForm.test.js +66 -0
- package/src/index.js +27 -0
package/CHANGELOG.md
CHANGED
@@ -4,6 +4,21 @@ 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
|
+
### [1.21.0](https://github.com/eea/volto-eea-website-theme/compare/1.20.0...1.21.0) - 5 September 2023
|
8
|
+
|
9
|
+
#### :house: Internal changes
|
10
|
+
|
11
|
+
- chore: fix tests [nileshgulia1 - [`c432106`](https://github.com/eea/volto-eea-website-theme/commit/c432106e0d5794383b4eac2a0027f4cd2f48cc28)]
|
12
|
+
- chore: add cypress for new code [nileshgulia1 - [`c989488`](https://github.com/eea/volto-eea-website-theme/commit/c989488946b2ab8b9e9da281dd668a0dc49efa56)]
|
13
|
+
- chore: cosmetics [Alin Voinea - [`442b64e`](https://github.com/eea/volto-eea-website-theme/commit/442b64ea3055f4e4f5d5bff9114c90c4a516a512)]
|
14
|
+
|
15
|
+
#### :hammer_and_wrench: Others
|
16
|
+
|
17
|
+
- test: Update ContactForm snapshot [Alin Voinea - [`e322b51`](https://github.com/eea/volto-eea-website-theme/commit/e322b510c3d0aa092d7a30a3af48b1d049aca5bb)]
|
18
|
+
- test: Add jest tests for ContactForm [Alin Voinea - [`e4a4c28`](https://github.com/eea/volto-eea-website-theme/commit/e4a4c2877bdb7c57a361751430c06136a37e37b0)]
|
19
|
+
- test: Add jest tests for AlignChooser [Alin Voinea - [`06edf05`](https://github.com/eea/volto-eea-website-theme/commit/06edf05f8f38c43f9b0bbd7ad45a9d73a7ff66aa)]
|
20
|
+
- bump package version [David Ichim - [`7ba2dd7`](https://github.com/eea/volto-eea-website-theme/commit/7ba2dd7d91183bda602de8da0f7823a1e8016df5)]
|
21
|
+
- i18n: Add en [Alin Voinea - [`e421605`](https://github.com/eea/volto-eea-website-theme/commit/e4216054129654c9ce06962d164b5a28f8c60d2b)]
|
7
22
|
### [1.20.0](https://github.com/eea/volto-eea-website-theme/compare/1.19.0...1.20.0) - 29 August 2023
|
8
23
|
|
9
24
|
#### :bug: Bug Fixes
|
package/jest-addon.config.js
CHANGED
@@ -11,4 +11,52 @@ msgstr ""
|
|
11
11
|
"Content-Transfer-Encoding: \n"
|
12
12
|
"Plural-Forms: \n"
|
13
13
|
|
14
|
+
#: components/theme/Banner/View
|
15
|
+
# defaultMessage: Created
|
16
|
+
msgid "Created"
|
17
|
+
msgstr ""
|
18
|
+
|
19
|
+
#: components/theme/Banner/View
|
20
|
+
# defaultMessage: Download
|
21
|
+
msgid "Download"
|
22
|
+
msgstr ""
|
23
|
+
|
24
|
+
#: components/theme/Logo
|
25
|
+
# defaultMessage: European Environment Agency
|
26
|
+
msgid "European Environment Agency"
|
27
|
+
msgstr ""
|
28
|
+
|
29
|
+
#: components/theme/Banner/View
|
30
|
+
# defaultMessage: Modified
|
31
|
+
msgid "Modified"
|
32
|
+
msgstr ""
|
33
|
+
|
34
|
+
#: components/theme/Banner/View
|
35
|
+
# defaultMessage: Published
|
36
|
+
msgid "Published"
|
37
|
+
msgstr ""
|
14
38
|
|
39
|
+
#: components/theme/Banner/View
|
40
|
+
# defaultMessage: Share
|
41
|
+
msgid "Share"
|
42
|
+
msgstr ""
|
43
|
+
|
44
|
+
#: components/theme/Banner/View
|
45
|
+
# defaultMessage: Share to
|
46
|
+
msgid "Share to"
|
47
|
+
msgstr ""
|
48
|
+
|
49
|
+
#: components/theme/Logo
|
50
|
+
# defaultMessage: Site
|
51
|
+
msgid "Site"
|
52
|
+
msgstr ""
|
53
|
+
|
54
|
+
#: components/manage/Blocks/Title/Edit
|
55
|
+
# defaultMessage: Type the title…
|
56
|
+
msgid "Type the title…"
|
57
|
+
msgstr ""
|
58
|
+
|
59
|
+
#: components/theme/Banner/View
|
60
|
+
# defaultMessage: RSS Feed
|
61
|
+
msgid "rssFeed"
|
62
|
+
msgstr ""
|
@@ -0,0 +1,62 @@
|
|
1
|
+
msgid ""
|
2
|
+
msgstr ""
|
3
|
+
"Project-Id-Version: \n"
|
4
|
+
"Report-Msgid-Bugs-To: \n"
|
5
|
+
"POT-Creation-Date: \n"
|
6
|
+
"PO-Revision-Date: \n"
|
7
|
+
"Last-Translator: \n"
|
8
|
+
"Language: \n"
|
9
|
+
"Language-Team: \n"
|
10
|
+
"Content-Type: \n"
|
11
|
+
"Content-Transfer-Encoding: \n"
|
12
|
+
"Plural-Forms: \n"
|
13
|
+
|
14
|
+
#: components/theme/Banner/View
|
15
|
+
# defaultMessage: Created
|
16
|
+
msgid "Created"
|
17
|
+
msgstr ""
|
18
|
+
|
19
|
+
#: components/theme/Banner/View
|
20
|
+
# defaultMessage: Download
|
21
|
+
msgid "Download"
|
22
|
+
msgstr ""
|
23
|
+
|
24
|
+
#: components/theme/Logo
|
25
|
+
# defaultMessage: European Environment Agency
|
26
|
+
msgid "European Environment Agency"
|
27
|
+
msgstr ""
|
28
|
+
|
29
|
+
#: components/theme/Banner/View
|
30
|
+
# defaultMessage: Modified
|
31
|
+
msgid "Modified"
|
32
|
+
msgstr ""
|
33
|
+
|
34
|
+
#: components/theme/Banner/View
|
35
|
+
# defaultMessage: Published
|
36
|
+
msgid "Published"
|
37
|
+
msgstr ""
|
38
|
+
|
39
|
+
#: components/theme/Banner/View
|
40
|
+
# defaultMessage: Share
|
41
|
+
msgid "Share"
|
42
|
+
msgstr ""
|
43
|
+
|
44
|
+
#: components/theme/Banner/View
|
45
|
+
# defaultMessage: Share to
|
46
|
+
msgid "Share to"
|
47
|
+
msgstr ""
|
48
|
+
|
49
|
+
#: components/theme/Logo
|
50
|
+
# defaultMessage: Site
|
51
|
+
msgid "Site"
|
52
|
+
msgstr ""
|
53
|
+
|
54
|
+
#: components/manage/Blocks/Title/Edit
|
55
|
+
# defaultMessage: Type the title…
|
56
|
+
msgid "Type the title…"
|
57
|
+
msgstr ""
|
58
|
+
|
59
|
+
#: components/theme/Banner/View
|
60
|
+
# defaultMessage: RSS Feed
|
61
|
+
msgid "rssFeed"
|
62
|
+
msgstr ""
|
@@ -11,4 +11,52 @@ msgstr ""
|
|
11
11
|
"Content-Transfer-Encoding: \n"
|
12
12
|
"Plural-Forms: \n"
|
13
13
|
|
14
|
+
#: components/theme/Banner/View
|
15
|
+
# defaultMessage: Created
|
16
|
+
msgid "Created"
|
17
|
+
msgstr ""
|
18
|
+
|
19
|
+
#: components/theme/Banner/View
|
20
|
+
# defaultMessage: Download
|
21
|
+
msgid "Download"
|
22
|
+
msgstr ""
|
23
|
+
|
24
|
+
#: components/theme/Logo
|
25
|
+
# defaultMessage: European Environment Agency
|
26
|
+
msgid "European Environment Agency"
|
27
|
+
msgstr ""
|
28
|
+
|
29
|
+
#: components/theme/Banner/View
|
30
|
+
# defaultMessage: Modified
|
31
|
+
msgid "Modified"
|
32
|
+
msgstr ""
|
33
|
+
|
34
|
+
#: components/theme/Banner/View
|
35
|
+
# defaultMessage: Published
|
36
|
+
msgid "Published"
|
37
|
+
msgstr ""
|
14
38
|
|
39
|
+
#: components/theme/Banner/View
|
40
|
+
# defaultMessage: Share
|
41
|
+
msgid "Share"
|
42
|
+
msgstr ""
|
43
|
+
|
44
|
+
#: components/theme/Banner/View
|
45
|
+
# defaultMessage: Share to
|
46
|
+
msgid "Share to"
|
47
|
+
msgstr ""
|
48
|
+
|
49
|
+
#: components/theme/Logo
|
50
|
+
# defaultMessage: Site
|
51
|
+
msgid "Site"
|
52
|
+
msgstr ""
|
53
|
+
|
54
|
+
#: components/manage/Blocks/Title/Edit
|
55
|
+
# defaultMessage: Type the title…
|
56
|
+
msgid "Type the title…"
|
57
|
+
msgstr ""
|
58
|
+
|
59
|
+
#: components/theme/Banner/View
|
60
|
+
# defaultMessage: RSS Feed
|
61
|
+
msgid "rssFeed"
|
62
|
+
msgstr ""
|
@@ -11,4 +11,52 @@ msgstr ""
|
|
11
11
|
"Content-Transfer-Encoding: \n"
|
12
12
|
"Plural-Forms: \n"
|
13
13
|
|
14
|
+
#: components/theme/Banner/View
|
15
|
+
# defaultMessage: Created
|
16
|
+
msgid "Created"
|
17
|
+
msgstr ""
|
18
|
+
|
19
|
+
#: components/theme/Banner/View
|
20
|
+
# defaultMessage: Download
|
21
|
+
msgid "Download"
|
22
|
+
msgstr ""
|
23
|
+
|
24
|
+
#: components/theme/Logo
|
25
|
+
# defaultMessage: European Environment Agency
|
26
|
+
msgid "European Environment Agency"
|
27
|
+
msgstr ""
|
28
|
+
|
29
|
+
#: components/theme/Banner/View
|
30
|
+
# defaultMessage: Modified
|
31
|
+
msgid "Modified"
|
32
|
+
msgstr ""
|
33
|
+
|
34
|
+
#: components/theme/Banner/View
|
35
|
+
# defaultMessage: Published
|
36
|
+
msgid "Published"
|
37
|
+
msgstr ""
|
14
38
|
|
39
|
+
#: components/theme/Banner/View
|
40
|
+
# defaultMessage: Share
|
41
|
+
msgid "Share"
|
42
|
+
msgstr ""
|
43
|
+
|
44
|
+
#: components/theme/Banner/View
|
45
|
+
# defaultMessage: Share to
|
46
|
+
msgid "Share to"
|
47
|
+
msgstr ""
|
48
|
+
|
49
|
+
#: components/theme/Logo
|
50
|
+
# defaultMessage: Site
|
51
|
+
msgid "Site"
|
52
|
+
msgstr ""
|
53
|
+
|
54
|
+
#: components/manage/Blocks/Title/Edit
|
55
|
+
# defaultMessage: Type the title…
|
56
|
+
msgid "Type the title…"
|
57
|
+
msgstr ""
|
58
|
+
|
59
|
+
#: components/theme/Banner/View
|
60
|
+
# defaultMessage: RSS Feed
|
61
|
+
msgid "rssFeed"
|
62
|
+
msgstr ""
|
package/locales/volto.pot
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
msgid ""
|
2
2
|
msgstr ""
|
3
3
|
"Project-Id-Version: Plone\n"
|
4
|
-
"POT-Creation-Date: 2023-
|
4
|
+
"POT-Creation-Date: 2023-08-29T17:13:27.797Z\n"
|
5
5
|
"Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
|
6
6
|
"Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
|
7
7
|
"MIME-Version: 1.0\n"
|
@@ -13,4 +13,52 @@ msgstr ""
|
|
13
13
|
"Preferred-Encodings: utf-8\n"
|
14
14
|
"Domain: volto\n"
|
15
15
|
|
16
|
+
#: components/theme/Banner/View
|
17
|
+
# defaultMessage: Created
|
18
|
+
msgid "Created"
|
19
|
+
msgstr ""
|
20
|
+
|
21
|
+
#: components/theme/Banner/View
|
22
|
+
# defaultMessage: Download
|
23
|
+
msgid "Download"
|
24
|
+
msgstr ""
|
25
|
+
|
26
|
+
#: components/theme/Logo
|
27
|
+
# defaultMessage: European Environment Agency
|
28
|
+
msgid "European Environment Agency"
|
29
|
+
msgstr ""
|
30
|
+
|
31
|
+
#: components/theme/Banner/View
|
32
|
+
# defaultMessage: Modified
|
33
|
+
msgid "Modified"
|
34
|
+
msgstr ""
|
35
|
+
|
36
|
+
#: components/theme/Banner/View
|
37
|
+
# defaultMessage: Published
|
38
|
+
msgid "Published"
|
39
|
+
msgstr ""
|
16
40
|
|
41
|
+
#: components/theme/Banner/View
|
42
|
+
# defaultMessage: Share
|
43
|
+
msgid "Share"
|
44
|
+
msgstr ""
|
45
|
+
|
46
|
+
#: components/theme/Banner/View
|
47
|
+
# defaultMessage: Share to
|
48
|
+
msgid "Share to"
|
49
|
+
msgstr ""
|
50
|
+
|
51
|
+
#: components/theme/Logo
|
52
|
+
# defaultMessage: Site
|
53
|
+
msgid "Site"
|
54
|
+
msgstr ""
|
55
|
+
|
56
|
+
#: components/manage/Blocks/Title/Edit
|
57
|
+
# defaultMessage: Type the title…
|
58
|
+
msgid "Type the title…"
|
59
|
+
msgstr ""
|
60
|
+
|
61
|
+
#: components/theme/Banner/View
|
62
|
+
# defaultMessage: RSS Feed
|
63
|
+
msgid "rssFeed"
|
64
|
+
msgstr ""
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@eeacms/volto-eea-website-theme",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.21.0",
|
4
4
|
"description": "@eeacms/volto-eea-website-theme: Volto add-on",
|
5
5
|
"main": "src/index.js",
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
@@ -14,6 +14,7 @@
|
|
14
14
|
"react"
|
15
15
|
],
|
16
16
|
"addons": [
|
17
|
+
"@eeacms/volto-group-block",
|
17
18
|
"@eeacms/volto-eea-design-system",
|
18
19
|
"volto-subsites"
|
19
20
|
],
|
@@ -23,6 +24,7 @@
|
|
23
24
|
},
|
24
25
|
"dependencies": {
|
25
26
|
"@eeacms/volto-eea-design-system": "*",
|
27
|
+
"@eeacms/volto-group-block": "*",
|
26
28
|
"volto-subsites": "*"
|
27
29
|
},
|
28
30
|
"devDependencies": {
|
@@ -0,0 +1,128 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Button } from 'semantic-ui-react';
|
3
|
+
import { Icon, BlocksForm } from '@plone/volto/components';
|
4
|
+
import EditBlockWrapper from '@eeacms/volto-group-block/components/manage/Blocks/Group/EditBlockWrapper';
|
5
|
+
|
6
|
+
import helpSVG from '@plone/volto/icons/help.svg';
|
7
|
+
import RenderBlocks from './RenderBlocks';
|
8
|
+
import './editor-flex.less';
|
9
|
+
|
10
|
+
const FlexGroup = (props) => {
|
11
|
+
const {
|
12
|
+
block,
|
13
|
+
data,
|
14
|
+
onChangeBlock,
|
15
|
+
onChangeField,
|
16
|
+
pathname,
|
17
|
+
selected,
|
18
|
+
selectedBlock,
|
19
|
+
onSelectBlock,
|
20
|
+
setSelectedBlock,
|
21
|
+
multiSelected,
|
22
|
+
manage,
|
23
|
+
childBlocksForm,
|
24
|
+
formDescription,
|
25
|
+
isEditMode,
|
26
|
+
} = props;
|
27
|
+
const metadata = props.metadata || props.properties;
|
28
|
+
const blockState = {};
|
29
|
+
const { no_of_columns = 2 } = data;
|
30
|
+
const flexClassNames = `ui unstackable items row flex-items-wrapper items-${no_of_columns}-columns`;
|
31
|
+
|
32
|
+
React.useEffect(() => {
|
33
|
+
const dragDropList = document?.querySelector(
|
34
|
+
`.flex-blocks-form[data-block="${block}"] [data-rbd-droppable-id]`,
|
35
|
+
);
|
36
|
+
if (dragDropList) dragDropList.setAttribute('class', flexClassNames);
|
37
|
+
}, [flexClassNames, block, isEditMode]);
|
38
|
+
|
39
|
+
// Get editing instructions from block settings or props
|
40
|
+
let instructions = data?.instructions?.data || data?.instructions;
|
41
|
+
if (!instructions || instructions === '<p><br/></p>') {
|
42
|
+
instructions = formDescription;
|
43
|
+
}
|
44
|
+
|
45
|
+
return (
|
46
|
+
<div className="flex-blocks-form" data-block={block}>
|
47
|
+
{isEditMode ? (
|
48
|
+
<BlocksForm
|
49
|
+
metadata={metadata}
|
50
|
+
properties={childBlocksForm}
|
51
|
+
manage={manage}
|
52
|
+
selectedBlock={selected ? selectedBlock : null}
|
53
|
+
allowedBlocks={data.allowedBlocks}
|
54
|
+
title={data.placeholder}
|
55
|
+
description={instructions}
|
56
|
+
onSelectBlock={(id, l, e) => {
|
57
|
+
const isMultipleSelection = e
|
58
|
+
? e.shiftKey || e.ctrlKey || e.metaKey
|
59
|
+
: false;
|
60
|
+
onSelectBlock(id, isMultipleSelection, e, selectedBlock);
|
61
|
+
}}
|
62
|
+
onChangeFormData={(newFormData) => {
|
63
|
+
onChangeBlock(block, {
|
64
|
+
...data,
|
65
|
+
data: newFormData,
|
66
|
+
});
|
67
|
+
}}
|
68
|
+
onChangeField={(id, value) => {
|
69
|
+
if (['blocks', 'blocks_layout'].indexOf(id) > -1) {
|
70
|
+
blockState[id] = value;
|
71
|
+
onChangeBlock(block, {
|
72
|
+
...data,
|
73
|
+
data: {
|
74
|
+
...data.data,
|
75
|
+
...blockState,
|
76
|
+
},
|
77
|
+
});
|
78
|
+
} else {
|
79
|
+
onChangeField(id, value);
|
80
|
+
}
|
81
|
+
}}
|
82
|
+
pathname={pathname}
|
83
|
+
>
|
84
|
+
{({ draginfo }, editBlock, blockProps) => (
|
85
|
+
<div className="flex-item">
|
86
|
+
<div className="item-wrapper">
|
87
|
+
<EditBlockWrapper
|
88
|
+
draginfo={draginfo}
|
89
|
+
blockProps={blockProps}
|
90
|
+
disabled={data.disableInnerButtons}
|
91
|
+
extraControls={
|
92
|
+
<>
|
93
|
+
{instructions && (
|
94
|
+
<>
|
95
|
+
<Button
|
96
|
+
icon
|
97
|
+
basic
|
98
|
+
title="Section help"
|
99
|
+
onClick={() => {
|
100
|
+
setSelectedBlock();
|
101
|
+
const tab = manage ? 0 : 1;
|
102
|
+
props.setSidebarTab(tab);
|
103
|
+
}}
|
104
|
+
>
|
105
|
+
<Icon name={helpSVG} className="" size="19px" />
|
106
|
+
</Button>
|
107
|
+
</>
|
108
|
+
)}
|
109
|
+
</>
|
110
|
+
}
|
111
|
+
multiSelected={multiSelected.includes(blockProps.block)}
|
112
|
+
>
|
113
|
+
{editBlock}
|
114
|
+
</EditBlockWrapper>
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
)}
|
118
|
+
</BlocksForm>
|
119
|
+
) : (
|
120
|
+
<div className={flexClassNames}>
|
121
|
+
<RenderBlocks metadata={metadata} content={data?.data || {}} />
|
122
|
+
</div>
|
123
|
+
)}
|
124
|
+
</div>
|
125
|
+
);
|
126
|
+
};
|
127
|
+
|
128
|
+
export default FlexGroup;
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { getBaseUrl, applyBlockDefaults } from '@plone/volto/helpers';
|
3
|
+
import { defineMessages, injectIntl } from 'react-intl';
|
4
|
+
import { map } from 'lodash';
|
5
|
+
import {
|
6
|
+
getBlocksFieldname,
|
7
|
+
getBlocksLayoutFieldname,
|
8
|
+
hasBlocksData,
|
9
|
+
} from '@plone/volto/helpers';
|
10
|
+
import StyleWrapper from '@plone/volto/components/manage/Blocks/Block/StyleWrapper';
|
11
|
+
import config from '@plone/volto/registry';
|
12
|
+
import { ViewDefaultBlock } from '@plone/volto/components';
|
13
|
+
|
14
|
+
const messages = defineMessages({
|
15
|
+
unknownBlock: {
|
16
|
+
id: 'Unknown Block',
|
17
|
+
defaultMessage: 'Unknown Block {block}',
|
18
|
+
},
|
19
|
+
invalidBlock: {
|
20
|
+
id: 'Invalid Block',
|
21
|
+
defaultMessage: 'Invalid block - Will be removed on saving',
|
22
|
+
},
|
23
|
+
});
|
24
|
+
|
25
|
+
const RenderBlocks = (props) => {
|
26
|
+
const { content, intl, location, metadata } = props;
|
27
|
+
const blocksFieldname = getBlocksFieldname(content);
|
28
|
+
const blocksLayoutFieldname = getBlocksLayoutFieldname(content);
|
29
|
+
const blocksConfig = props.blocksConfig || config.blocks.blocksConfig;
|
30
|
+
const CustomTag = props.as || React.Fragment;
|
31
|
+
|
32
|
+
return hasBlocksData(content) ? (
|
33
|
+
<CustomTag>
|
34
|
+
{map(content[blocksLayoutFieldname].items, (block) => {
|
35
|
+
const Block =
|
36
|
+
blocksConfig[content[blocksFieldname]?.[block]?.['@type']]?.view ||
|
37
|
+
ViewDefaultBlock;
|
38
|
+
|
39
|
+
const blockData = applyBlockDefaults({
|
40
|
+
data: content[blocksFieldname][block],
|
41
|
+
intl,
|
42
|
+
metadata,
|
43
|
+
properties: content,
|
44
|
+
});
|
45
|
+
|
46
|
+
return Block ? (
|
47
|
+
<div className="flex-item" key={block}>
|
48
|
+
<StyleWrapper key={block} id={block}>
|
49
|
+
<Block
|
50
|
+
id={block}
|
51
|
+
metadata={metadata}
|
52
|
+
properties={content}
|
53
|
+
data={blockData}
|
54
|
+
path={getBaseUrl(location?.pathname || '')}
|
55
|
+
blocksConfig={blocksConfig}
|
56
|
+
/>
|
57
|
+
</StyleWrapper>
|
58
|
+
</div>
|
59
|
+
) : blockData ? (
|
60
|
+
<div key={block}>
|
61
|
+
{intl.formatMessage(messages.unknownBlock, {
|
62
|
+
block: content[blocksFieldname]?.[block]?.['@type'],
|
63
|
+
})}
|
64
|
+
</div>
|
65
|
+
) : (
|
66
|
+
<div key={block}>{intl.formatMessage(messages.invalidBlock)}</div>
|
67
|
+
);
|
68
|
+
})}
|
69
|
+
</CustomTag>
|
70
|
+
) : (
|
71
|
+
''
|
72
|
+
);
|
73
|
+
};
|
74
|
+
|
75
|
+
export default injectIntl(RenderBlocks);
|
@@ -0,0 +1,14 @@
|
|
1
|
+
@import (multiple) '../../theme.config';
|
2
|
+
|
3
|
+
@type: 'extra';
|
4
|
+
@element: 'custom';
|
5
|
+
|
6
|
+
@baseWidth: 100%;
|
7
|
+
|
8
|
+
// on edit ensure add button is next to the block input area
|
9
|
+
.flex-blocks-form {
|
10
|
+
.item-wrapper {
|
11
|
+
position: relative;
|
12
|
+
width: 100%;
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import configureStore from 'redux-mock-store';
|
3
|
+
import { Provider } from 'react-intl-redux';
|
4
|
+
import { render } from '@testing-library/react';
|
5
|
+
import AlignChooser from './AlignChooser';
|
6
|
+
|
7
|
+
const mockStore = configureStore();
|
8
|
+
|
9
|
+
describe('AlignChooser', () => {
|
10
|
+
const props = {
|
11
|
+
align: 'left',
|
12
|
+
onChangeBlock: jest.fn(),
|
13
|
+
data: { copyrightPosition: 'left' },
|
14
|
+
block: '123',
|
15
|
+
actions: ['left', 'right', 'center', 'full'],
|
16
|
+
};
|
17
|
+
const store = mockStore({
|
18
|
+
intl: {
|
19
|
+
locale: 'en',
|
20
|
+
messages: {},
|
21
|
+
},
|
22
|
+
});
|
23
|
+
|
24
|
+
it('renders the align buttons', () => {
|
25
|
+
const { container } = render(
|
26
|
+
<Provider store={store}>
|
27
|
+
<AlignChooser {...props} />
|
28
|
+
</Provider>,
|
29
|
+
);
|
30
|
+
expect(container).toMatchSnapshot();
|
31
|
+
});
|
32
|
+
|
33
|
+
it('calls onChangeBlock when an align button is clicked', () => {
|
34
|
+
const { container } = render(
|
35
|
+
<Provider store={store}>
|
36
|
+
<AlignChooser {...props} />
|
37
|
+
</Provider>,
|
38
|
+
);
|
39
|
+
expect(container).toMatchSnapshot();
|
40
|
+
});
|
41
|
+
|
42
|
+
it('marks the active align button as active', () => {
|
43
|
+
const { container } = render(
|
44
|
+
<Provider store={store}>
|
45
|
+
<AlignChooser {...props} />
|
46
|
+
</Provider>,
|
47
|
+
);
|
48
|
+
expect(container).toMatchSnapshot();
|
49
|
+
});
|
50
|
+
});
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import renderer from 'react-test-renderer';
|
3
|
+
import configureStore from 'redux-mock-store';
|
4
|
+
import { Provider } from 'react-intl-redux';
|
5
|
+
import { MemoryRouter } from 'react-router-dom';
|
6
|
+
import ContactForm from './ContactForm';
|
7
|
+
|
8
|
+
jest.mock('react-portal', () => ({
|
9
|
+
Portal: jest.fn(() => <div id="Portal" />),
|
10
|
+
}));
|
11
|
+
|
12
|
+
const mockStore = configureStore();
|
13
|
+
|
14
|
+
describe('Contact form', () => {
|
15
|
+
it('renders a contact form', () => {
|
16
|
+
const store = mockStore({
|
17
|
+
emailNotification: {
|
18
|
+
error: {},
|
19
|
+
loaded: false,
|
20
|
+
loading: false,
|
21
|
+
},
|
22
|
+
intl: {
|
23
|
+
locale: 'en',
|
24
|
+
messages: {},
|
25
|
+
},
|
26
|
+
userSession: {},
|
27
|
+
content: {},
|
28
|
+
});
|
29
|
+
const component = renderer.create(
|
30
|
+
<Provider store={store}>
|
31
|
+
<MemoryRouter>
|
32
|
+
<ContactForm location={{ pathname: '/blog' }} />
|
33
|
+
</MemoryRouter>
|
34
|
+
</Provider>,
|
35
|
+
);
|
36
|
+
const json = component.toJSON();
|
37
|
+
expect(json).toMatchSnapshot();
|
38
|
+
});
|
39
|
+
|
40
|
+
it('renders a contact form with error message', () => {
|
41
|
+
const store = mockStore({
|
42
|
+
emailNotification: {
|
43
|
+
error: {
|
44
|
+
message: 'Error foo',
|
45
|
+
},
|
46
|
+
loaded: false,
|
47
|
+
loading: false,
|
48
|
+
},
|
49
|
+
intl: {
|
50
|
+
locale: 'en',
|
51
|
+
messages: {},
|
52
|
+
},
|
53
|
+
userSession: {},
|
54
|
+
content: {},
|
55
|
+
});
|
56
|
+
const component = renderer.create(
|
57
|
+
<Provider store={store}>
|
58
|
+
<MemoryRouter>
|
59
|
+
<ContactForm location={{ pathname: '/' }} />
|
60
|
+
</MemoryRouter>
|
61
|
+
</Provider>,
|
62
|
+
);
|
63
|
+
const json = component.toJSON();
|
64
|
+
expect(json).toMatchSnapshot();
|
65
|
+
});
|
66
|
+
});
|
package/src/index.js
CHANGED
@@ -15,6 +15,7 @@ import installLayoutSettingsBlock from '@eeacms/volto-eea-website-theme/componen
|
|
15
15
|
|
16
16
|
import BaseTag from './components/theme/BaseTag';
|
17
17
|
import SubsiteClass from './components/theme/SubsiteClass';
|
18
|
+
import FlexGroup from '@eeacms/volto-eea-website-theme/components/manage/Blocks/GroupBlockTemplate/FlexGroup/FlexGroup';
|
18
19
|
import contentBoxSVG from './icons/content-box.svg';
|
19
20
|
|
20
21
|
import installSlate from './slate';
|
@@ -122,6 +123,32 @@ const applyConfig = (config) => {
|
|
122
123
|
};
|
123
124
|
}
|
124
125
|
}
|
126
|
+
//Group block flex variation
|
127
|
+
if (config.blocks.blocksConfig.group) {
|
128
|
+
config.blocks.blocksConfig.group.variations = [
|
129
|
+
...(config.blocks.blocksConfig.group.variations || []),
|
130
|
+
{
|
131
|
+
id: 'flex group',
|
132
|
+
isDefault: false,
|
133
|
+
title: 'Flex Group',
|
134
|
+
template: FlexGroup,
|
135
|
+
schemaEnhancer: ({ schema, formData, intl }) => {
|
136
|
+
schema.fieldsets[0].fields.push('no_of_columns');
|
137
|
+
schema.properties.no_of_columns = {
|
138
|
+
title: 'No. of columns',
|
139
|
+
description: 'Choose the number of flex columns',
|
140
|
+
choices: [
|
141
|
+
[2, 2],
|
142
|
+
[3, 3],
|
143
|
+
[4, 4],
|
144
|
+
[5, 5],
|
145
|
+
],
|
146
|
+
};
|
147
|
+
return schema;
|
148
|
+
},
|
149
|
+
},
|
150
|
+
];
|
151
|
+
}
|
125
152
|
|
126
153
|
// Apply columns block customization
|
127
154
|
if (config.blocks.blocksConfig.columnsBlock) {
|