@eeacms/volto-eea-website-theme 1.19.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 CHANGED
@@ -4,6 +4,49 @@ 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)]
22
+ ### [1.20.0](https://github.com/eea/volto-eea-website-theme/compare/1.19.0...1.20.0) - 29 August 2023
23
+
24
+ #### :bug: Bug Fixes
25
+
26
+ - fix(tests): try fixing failing test on cypress [kreafox - [`6a3f261`](https://github.com/eea/volto-eea-website-theme/commit/6a3f261a1ff11245f40899cf8f75420077b993a6)]
27
+ - fix(tests): undo changes on BaseTag [kreafox - [`b74cbf2`](https://github.com/eea/volto-eea-website-theme/commit/b74cbf28276cddaa32cda6d7edceae0a6094b2ff)]
28
+ - fix(tests): comment BaseTag [kreafox - [`d1fd9d1`](https://github.com/eea/volto-eea-website-theme/commit/d1fd9d1d801c2a4de6e08aefd6f4f91076bb17f2)]
29
+
30
+ #### :house: Internal changes
31
+
32
+ - chore: remove volto-toc-block dependency - refs #256517 [dobri1408 - [`d465e45`](https://github.com/eea/volto-eea-website-theme/commit/d465e45f27416eef10a55edb85ecc75c6deaf774)]
33
+
34
+ #### :hammer_and_wrench: Others
35
+
36
+ - increase code covreage [Dobricean Ioan Dorian - [`4ff918e`](https://github.com/eea/volto-eea-website-theme/commit/4ff918edd9acb56dcbf466b759dbdd78b61b1218)]
37
+ - Release 1.20.0 [Alin Voinea - [`5fa90e1`](https://github.com/eea/volto-eea-website-theme/commit/5fa90e12d18db593400770fe48755cedda03a5e8)]
38
+ - test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`de90b72`](https://github.com/eea/volto-eea-website-theme/commit/de90b72fde94c2cf2245dfa49bd74cd9ea620f9f)]
39
+ - Cleanup [Tiberiu Ichim - [`248e953`](https://github.com/eea/volto-eea-website-theme/commit/248e9534364e550b8b0770f3f336c98e73cad434)]
40
+ - Maybe now [Tiberiu Ichim - [`361d026`](https://github.com/eea/volto-eea-website-theme/commit/361d0269c5f2ec5bad5e12727903a89aa3d1607d)]
41
+ - Protect against cypress [Tiberiu Ichim - [`64361fe`](https://github.com/eea/volto-eea-website-theme/commit/64361fefa5b2136c6b91b2f7e55ff56b5bc5bf15)]
42
+ - One more step [Tiberiu Ichim - [`858a7a3`](https://github.com/eea/volto-eea-website-theme/commit/858a7a317162316642722c30d867e9d0d04d79ea)]
43
+ - One more step [Tiberiu Ichim - [`6fd31d2`](https://github.com/eea/volto-eea-website-theme/commit/6fd31d2c17043d87acbaa786e0543d9ca1072aec)]
44
+ - Just Helmet [Tiberiu Ichim - [`56d38d9`](https://github.com/eea/volto-eea-website-theme/commit/56d38d929d50f06722e638f4fe9f46f8879b25a8)]
45
+ - Fix import [Tiberiu Ichim - [`14ecc8f`](https://github.com/eea/volto-eea-website-theme/commit/14ecc8fc41d5e35d4d16021cffc3eabe53a562c5)]
46
+ - Add client condition [Tiberiu Ichim - [`8c44a99`](https://github.com/eea/volto-eea-website-theme/commit/8c44a9962056a6e2864a57c324d60aab04928f8f)]
47
+ - Use Helmet again [Tiberiu Ichim - [`82aa4f3`](https://github.com/eea/volto-eea-website-theme/commit/82aa4f306f2a654bd9f2cc35de335eeaa35c6620)]
48
+ - Let's try this to make test pass [Tiberiu Ichim - [`327fdfb`](https://github.com/eea/volto-eea-website-theme/commit/327fdfbd2b730b19a4e8ea4907d5e4ae6018163a)]
49
+ - Refs #254325; add rss autodiscovery [Tiberiu Ichim - [`64d4df1`](https://github.com/eea/volto-eea-website-theme/commit/64d4df198880d9359dd6590fa000f71299971508)]
7
50
  ### [1.19.0](https://github.com/eea/volto-eea-website-theme/compare/1.18.1...1.19.0) - 17 August 2023
8
51
 
9
52
  #### :bug: Bug Fixes
package/README.md CHANGED
@@ -14,12 +14,11 @@
14
14
  [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-eea-website-theme-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-eea-website-theme-develop)
15
15
  [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-eea-website-theme-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-eea-website-theme-develop)
16
16
 
17
-
18
17
  EEA Website [Volto](https://github.com/plone/volto) Theme
19
18
 
20
19
  ## Demo
21
20
 
22
- - https://demo-www.eea.europa.eu
21
+ - https://www.eea.europa.eu
23
22
 
24
23
  ## Getting started
25
24
 
@@ -42,25 +41,25 @@ Go to http://localhost:3000
42
41
 
43
42
  1. Start Volto frontend
44
43
 
45
- * If you already have a volto project, just update `package.json`:
44
+ - If you already have a volto project, just update `package.json`:
46
45
 
47
- ```JSON
48
- "addons": [
49
- "@eeacms/volto-eea-website-theme"
50
- ],
46
+ ```JSON
47
+ "addons": [
48
+ "@eeacms/volto-eea-website-theme"
49
+ ],
51
50
 
52
- "dependencies": {
53
- "@eeacms/volto-eea-website-theme": "^1.0.0"
54
- }
55
- ```
51
+ "dependencies": {
52
+ "@eeacms/volto-eea-website-theme": "^1.0.0"
53
+ }
54
+ ```
56
55
 
57
- * If not, create one:
56
+ - If not, create one:
58
57
 
59
- ```
60
- npm install -g yo @plone/generator-volto
61
- yo @plone/volto my-volto-project --addon @eeacms/volto-eea-website-theme
62
- cd my-volto-project
63
- ```
58
+ ```
59
+ npm install -g yo @plone/generator-volto
60
+ yo @plone/volto my-volto-project --addon @eeacms/volto-eea-website-theme
61
+ cd my-volto-project
62
+ ```
64
63
 
65
64
  1. Install new add-ons and restart Volto:
66
65
 
@@ -81,6 +80,11 @@ See [RELEASE.md](https://github.com/eea/volto-eea-website-theme/blob/master/RELE
81
80
 
82
81
  See [DEVELOP.md](https://github.com/eea/volto-eea-website-theme/blob/master/DEVELOP.md).
83
82
 
83
+ ## Docusaurus and Storybook
84
+
85
+ See [Docusaurus](https://eea.github.io/).
86
+ See [Storybook](https://eea.github.io/eea-storybook/).
87
+
84
88
  ## Copyright and license
85
89
 
86
90
  The Initial Owner of the Original Code is European Environment Agency (EEA).
@@ -1,11 +1,12 @@
1
1
  version: "3"
2
2
  services:
3
3
  backend:
4
- image: plone/plone-backend:${PLONE_VERSION:-6}
4
+ image: eeacms/plone-backend
5
5
  ports:
6
6
  - "8080:8080"
7
7
  environment:
8
8
  SITE: "Plone"
9
+ PROFILES: "eea.kitkat:testing"
9
10
 
10
11
  frontend:
11
12
  build:
@@ -23,6 +24,9 @@ services:
23
24
  volumes:
24
25
  - ./:/app/src/addons/${ADDON_PATH}
25
26
  environment:
27
+ CI: "true"
28
+ NODE_ENV: "development"
29
+ RAZZLE_JEST_CONFIG: "src/addons/${ADDON_PATH}/jest-addon.config.js"
26
30
  RAZZLE_INTERNAL_API_PATH: "http://backend:8080/Plone"
27
31
  RAZZLE_DEV_PROXY_API_PATH: "http://backend:8080/Plone"
28
32
  HOST: "0.0.0.0"
@@ -27,10 +27,10 @@ module.exports = {
27
27
  },
28
28
  coverageThreshold: {
29
29
  global: {
30
- branches: 5,
31
- functions: 5,
32
- lines: 5,
33
- statements: 5,
30
+ branches: 0,
31
+ functions: 0,
32
+ lines: 0,
33
+ statements: 0,
34
34
  },
35
35
  },
36
36
  };
@@ -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-06-28T10:48:22.678Z\n"
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.19.0",
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
+ }
@@ -16,6 +16,34 @@ const infoSchema = {
16
16
  required: [],
17
17
  };
18
18
 
19
+ const RSSLink = {
20
+ title: 'RSS Link',
21
+ fieldsets: [
22
+ {
23
+ id: 'default',
24
+ title: 'Default',
25
+ fields: ['title', 'feedType', 'href'],
26
+ },
27
+ ],
28
+ properties: {
29
+ title: {
30
+ title: 'Title',
31
+ },
32
+ feedType: {
33
+ title: 'Feed Type',
34
+ choices: [
35
+ ['rss2', 'RSS2'],
36
+ ['atom', 'ATOM'],
37
+ ],
38
+ default: 'rss2',
39
+ },
40
+ href: {
41
+ title: 'URL Path',
42
+ },
43
+ },
44
+ required: [],
45
+ };
46
+
19
47
  export default {
20
48
  title: 'Page header',
21
49
  fieldsets: [
@@ -33,7 +61,7 @@ export default {
33
61
  {
34
62
  id: 'actions',
35
63
  title: 'Actions',
36
- fields: ['hideShareButton', 'hideDownloadButton'],
64
+ fields: ['hideShareButton', 'hideDownloadButton', 'rssLinks'],
37
65
  },
38
66
  {
39
67
  id: 'copyright',
@@ -66,6 +94,11 @@ export default {
66
94
  title: 'Hide download button',
67
95
  type: 'boolean',
68
96
  },
97
+ rssLinks: {
98
+ title: 'RSS Links',
99
+ widget: 'object_list',
100
+ schema: RSSLink,
101
+ },
69
102
  info: {
70
103
  title: 'Extra info',
71
104
  widget: 'object_list',
@@ -1,4 +1,5 @@
1
1
  import React, { useCallback, useMemo, useRef } from 'react';
2
+ import { Helmet } from '@plone/volto/helpers';
2
3
  import { compose } from 'redux';
3
4
  import { connect } from 'react-redux';
4
5
  import { withRouter } from 'react-router';
@@ -41,6 +42,10 @@ const messages = defineMessages({
41
42
  id: 'Modified',
42
43
  defaultMessage: 'Modified',
43
44
  },
45
+ rssFeed: {
46
+ id: 'rssFeed',
47
+ defaultMessage: 'RSS Feed',
48
+ },
44
49
  });
45
50
 
46
51
  const friendlyId = (id) => {
@@ -74,6 +79,7 @@ const View = (props) => {
74
79
  copyright,
75
80
  copyrightIcon,
76
81
  copyrightPosition,
82
+ rssLinks,
77
83
  // contentType,
78
84
  } = props.data;
79
85
  const copyrightPrefix =
@@ -165,6 +171,31 @@ const View = (props) => {
165
171
  }}
166
172
  />
167
173
  )}
174
+ {rssLinks?.map((rssLink, index) => (
175
+ <>
176
+ <Helmet
177
+ link={[
178
+ {
179
+ rel: 'alternate',
180
+ title:
181
+ rssLink.title ?? intl.formatMessage(messages.rssFeed),
182
+ href: rssLink.href,
183
+ type:
184
+ rssLink.feedType === 'atom'
185
+ ? 'application/atom+xml'
186
+ : 'application/rss+xml',
187
+ },
188
+ ]}
189
+ />
190
+ <Banner.Action
191
+ icon="ri-rss-fill"
192
+ title={rssLink.title ?? intl.formatMessage(messages.rssFeed)}
193
+ className="rssfeed"
194
+ href={rssLink.href}
195
+ target="_blank"
196
+ />
197
+ </>
198
+ ))}
168
199
  </>
169
200
  }
170
201
  >
@@ -0,0 +1,11 @@
1
+ import { useSelector } from 'react-redux';
2
+ import { flattenToAppURL, Helmet } from '@plone/volto/helpers';
3
+
4
+ export default function BaseTag(props) {
5
+ const contentId = useSelector((store) => store?.content?.data?.['@id']);
6
+ const baseHref = contentId ? flattenToAppURL(contentId) : null;
7
+
8
+ return baseHref !== null ? (
9
+ <Helmet base={{ target: '_blank', href: `${baseHref}/` }} />
10
+ ) : null;
11
+ }
@@ -57,7 +57,7 @@ const AlignChooser = ({
57
57
  return (
58
58
  <div className="align-buttons">
59
59
  {actions.map((action) => (
60
- <Button.Group>
60
+ <Button.Group key={action}>
61
61
  <Button
62
62
  icon
63
63
  basic
@@ -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
@@ -1,21 +1,28 @@
1
- import * as eea from './config';
2
- import InpageNavigation from '@eeacms/volto-eea-design-system/ui/InpageNavigation/InpageNavigation';
3
- import installCustomTitle from '@eeacms/volto-eea-website-theme/components/manage/Blocks/Title';
4
- import installLayoutSettingsBlock from '@eeacms/volto-eea-website-theme/components/manage/Blocks/LayoutSettings';
5
- import { addStylingFieldsetSchemaEnhancer } from '@eeacms/volto-eea-website-theme/helpers/schema-utils';
1
+ import { Icon } from '@plone/volto/components';
2
+ import { getBlocks } from '@plone/volto/helpers';
6
3
  import CustomCSS from '@eeacms/volto-eea-website-theme/components/theme/CustomCSS/CustomCSS';
7
- import NotFound from '@eeacms/volto-eea-website-theme/components/theme/NotFound/NotFound';
8
4
  import DraftBackground from '@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground';
9
- import { TokenWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TokenWidget';
5
+ import HomePageInverseView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageInverseView';
6
+ import HomePageView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageView';
7
+ import InpageNavigation from '@eeacms/volto-eea-design-system/ui/InpageNavigation/InpageNavigation';
8
+ import NotFound from '@eeacms/volto-eea-website-theme/components/theme/NotFound/NotFound';
10
9
  import { TopicsWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TopicsWidget';
10
+ import { TokenWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TokenWidget';
11
+
12
+ import { addStylingFieldsetSchemaEnhancer } from '@eeacms/volto-eea-website-theme/helpers/schema-utils';
13
+ import installCustomTitle from '@eeacms/volto-eea-website-theme/components/manage/Blocks/Title';
14
+ import installLayoutSettingsBlock from '@eeacms/volto-eea-website-theme/components/manage/Blocks/LayoutSettings';
15
+
16
+ import BaseTag from './components/theme/BaseTag';
11
17
  import SubsiteClass from './components/theme/SubsiteClass';
12
- import HomePageView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageView';
13
- import HomePageInverseView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageInverseView';
14
- import { Icon } from '@plone/volto/components';
18
+ import FlexGroup from '@eeacms/volto-eea-website-theme/components/manage/Blocks/GroupBlockTemplate/FlexGroup/FlexGroup';
15
19
  import contentBoxSVG from './icons/content-box.svg';
16
- import voltoCustomMiddleware from './middleware/voltoCustom';
17
- import okMiddleware from './middleware/ok';
20
+
18
21
  import installSlate from './slate';
22
+ import okMiddleware from './middleware/ok';
23
+ import voltoCustomMiddleware from './middleware/voltoCustom';
24
+
25
+ import * as eea from './config';
19
26
 
20
27
  const restrictedBlocks = [
21
28
  '__grid', // Grid/Teaser block (kitconcept)
@@ -116,10 +123,56 @@ const applyConfig = (config) => {
116
123
  };
117
124
  }
118
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
+ }
119
152
 
120
153
  // Apply columns block customization
121
154
  if (config.blocks.blocksConfig.columnsBlock) {
122
155
  config.blocks.blocksConfig.columnsBlock.available_colors = eea.colors;
156
+ config.blocks.blocksConfig.columnsBlock.tocEntries = (
157
+ block = {},
158
+ tocData,
159
+ ) => {
160
+ // integration with volto-block-toc
161
+ const headlines = tocData.levels || ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
162
+ let entries = [];
163
+ const sorted_column_blocks = getBlocks(block?.data || {});
164
+ sorted_column_blocks.forEach((column_block) => {
165
+ const sorted_blocks = getBlocks(column_block[1]);
166
+ sorted_blocks.forEach((block) => {
167
+ const { value, plaintext } = block[1];
168
+ const type = value?.[0]?.type;
169
+ if (headlines.includes(type)) {
170
+ entries.push([parseInt(type.slice(1)), plaintext, block[0]]);
171
+ }
172
+ });
173
+ });
174
+ return entries;
175
+ };
123
176
  }
124
177
 
125
178
  // Description block custom CSS
@@ -166,6 +219,10 @@ const applyConfig = (config) => {
166
219
  match: '',
167
220
  component: SubsiteClass,
168
221
  },
222
+ {
223
+ match: '',
224
+ component: BaseTag,
225
+ },
169
226
  ];
170
227
 
171
228
  config = installSlate(config);