@eeacms/volto-clms-theme 1.0.75 → 1.0.78
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 +26 -0
- package/package.json +2 -2
- package/src/components/Blocks/CclCardContainerBlock/CardContainerSchema.js +7 -35
- package/src/components/Blocks/CclCardContainerBlock/CclCardContainerBlockEdit.jsx +79 -106
- package/src/components/Blocks/CclCardContainerBlock/CclCardContainerBlockView.jsx +18 -41
- package/src/components/Blocks/CclCardContainerBlock/utils.js +13 -0
- package/src/components/Blocks/CclHomeUsersBlock/CclHomeUsersBlockEdit.jsx +16 -293
- package/src/components/Blocks/customBlocks.js +1 -19
- package/src/components/CLMSDownloadCartView/CLMSCartContent.jsx +83 -7
- package/src/components/CclCard/CclCard.jsx +170 -95
- package/src/components/CclImageEditor/CclImageEditor.jsx +316 -0
- package/src/components/CclImageEditor/styles.less +97 -0
- package/src/components/Blocks/CclCardBlock/CardBlockSchema.js +0 -44
- package/src/components/Blocks/CclCardBlock/CclCardBlockEdit.jsx +0 -77
- package/src/components/Blocks/CclCardBlock/CclCardBlockEdit.test.jsx +0 -171
- package/src/components/Blocks/CclCardBlock/CclCardBlockView.jsx +0 -47
- package/src/components/Blocks/CclCardBlock/CclCardBlockView.test.jsx +0 -61
- package/src/components/Blocks/CclCardBlock/__snapshots__/CclCardBlockEdit.test.jsx.snap +0 -45
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,34 @@ 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.0.78](https://github.com/eea/volto-clms-theme/compare/1.0.77...1.0.78)
|
|
8
|
+
|
|
9
|
+
- refactor card link [`e3ab510`](https://github.com/eea/volto-clms-theme/commit/e3ab51012c21a1bc62e2600431aac225dbd76003)
|
|
10
|
+
- add link to the entire card [`aee0981`](https://github.com/eea/volto-clms-theme/commit/aee09811585c925a050347259bb10369c0ec4845)
|
|
11
|
+
|
|
12
|
+
#### [1.0.77](https://github.com/eea/volto-clms-theme/compare/1.0.76...1.0.77)
|
|
13
|
+
|
|
14
|
+
> 3 March 2022
|
|
15
|
+
|
|
16
|
+
- Develop [`#222`](https://github.com/eea/volto-clms-theme/pull/222)
|
|
17
|
+
- cardContainerBlock refactoring, remove cardBlock and make ImageEditor… [`#221`](https://github.com/eea/volto-clms-theme/pull/221)
|
|
18
|
+
- fix image uploading workflow [`86c10e6`](https://github.com/eea/volto-clms-theme/commit/86c10e6b9bf2d0e82aa1415539d291d04b6f86e9)
|
|
19
|
+
- cardContainerBlock refactoring, remove cardBlock and make ImageEditor reusable [`2292c6b`](https://github.com/eea/volto-clms-theme/commit/2292c6bdb11eeac3f99df080b096b2d923ed2926)
|
|
20
|
+
|
|
21
|
+
#### [1.0.76](https://github.com/eea/volto-clms-theme/compare/1.0.75...1.0.76)
|
|
22
|
+
|
|
23
|
+
> 2 March 2022
|
|
24
|
+
|
|
25
|
+
- Develop [`#220`](https://github.com/eea/volto-clms-theme/pull/220)
|
|
26
|
+
- add modal when download requests are both standard downloads or prepackaged files [`#219`](https://github.com/eea/volto-clms-theme/pull/219)
|
|
27
|
+
- upgrade volto-accordion-block [`cf8a7a6`](https://github.com/eea/volto-clms-theme/commit/cf8a7a6909b1d38f855ef01f0642add7e882e804)
|
|
28
|
+
- add modal when downloading files are prepackaged and mapviewer [`c974d37`](https://github.com/eea/volto-clms-theme/commit/c974d37f42fd13d0de53416c36ed4b8f8a8ba2c0)
|
|
29
|
+
|
|
7
30
|
#### [1.0.75](https://github.com/eea/volto-clms-theme/compare/1.0.74...1.0.75)
|
|
8
31
|
|
|
32
|
+
> 1 March 2022
|
|
33
|
+
|
|
34
|
+
- New release [`#218`](https://github.com/eea/volto-clms-theme/pull/218)
|
|
9
35
|
- add elvis operator [`#217`](https://github.com/eea/volto-clms-theme/pull/217)
|
|
10
36
|
- no need to tinker with dates, we configure the listing in Volto [`#215`](https://github.com/eea/volto-clms-theme/pull/215)
|
|
11
37
|
- use new placeholder image [`#216`](https://github.com/eea/volto-clms-theme/pull/216)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-clms-theme",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.78",
|
|
4
4
|
"description": "volto-clms-theme: Volto theme for CLMS site",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "CodeSyntax for the European Environment Agency",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@eeacms/volto-taxonomy"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@eeacms/volto-accordion-block": "3.4.
|
|
33
|
+
"@eeacms/volto-accordion-block": "3.4.13",
|
|
34
34
|
"@eeacms/volto-arcgis-block": "*",
|
|
35
35
|
"@eeacms/volto-clms-utils": "0.1.6",
|
|
36
36
|
"@eeacms/volto-columns-block": "4.4.3",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export const CardContainerSchema = (
|
|
1
|
+
export const CardContainerSchema = () => ({
|
|
2
2
|
title: 'Card container',
|
|
3
3
|
fieldsets: [
|
|
4
4
|
{
|
|
5
5
|
id: 'default',
|
|
6
6
|
title: 'Default',
|
|
7
|
-
fields: ['title', '
|
|
7
|
+
fields: ['title', 'variation', 'customCards'],
|
|
8
8
|
},
|
|
9
9
|
],
|
|
10
10
|
properties: {
|
|
@@ -13,43 +13,13 @@ export const CardContainerSchema = (types, extras) => ({
|
|
|
13
13
|
description: 'Card container block friendly name',
|
|
14
14
|
type: 'string',
|
|
15
15
|
},
|
|
16
|
-
cardStyle: {
|
|
17
|
-
title: 'Card style',
|
|
18
|
-
choices: [
|
|
19
|
-
['line', 'Line Image card'],
|
|
20
|
-
['line-color', 'Colored Line card'],
|
|
21
|
-
['doc', 'Line card'],
|
|
22
|
-
['block', 'Block card'],
|
|
23
|
-
['event', 'Event card'],
|
|
24
|
-
],
|
|
25
|
-
default: 'line',
|
|
26
|
-
},
|
|
27
|
-
contentTypes: {
|
|
28
|
-
title: 'Content Types',
|
|
29
|
-
choices: types,
|
|
30
|
-
isMulti: true,
|
|
31
|
-
},
|
|
32
|
-
cardOrigin: {
|
|
33
|
-
title: 'Cards origin',
|
|
34
|
-
choices: [
|
|
35
|
-
['current', 'Current folder children'],
|
|
36
|
-
['selection', 'Selected folder children'],
|
|
37
|
-
['custom', 'Customized cards'],
|
|
38
|
-
],
|
|
39
|
-
default: 'current',
|
|
40
|
-
},
|
|
41
|
-
containerSelection: {
|
|
42
|
-
title: 'Card container selector',
|
|
43
|
-
widget: 'object_browser',
|
|
44
|
-
mode: 'link',
|
|
45
|
-
},
|
|
46
16
|
customCards: {
|
|
47
17
|
title: 'Custom cards',
|
|
48
18
|
type: 'panels',
|
|
49
19
|
schema: CardBlockSchema,
|
|
50
20
|
},
|
|
51
21
|
},
|
|
52
|
-
required: ['
|
|
22
|
+
required: ['variation', 'cardOrigin'],
|
|
53
23
|
});
|
|
54
24
|
|
|
55
25
|
export const CardBlockSchema = () => ({
|
|
@@ -58,7 +28,7 @@ export const CardBlockSchema = () => ({
|
|
|
58
28
|
{
|
|
59
29
|
id: 'default',
|
|
60
30
|
title: 'Default',
|
|
61
|
-
fields: ['title', '
|
|
31
|
+
fields: ['title', 'description', 'url'],
|
|
62
32
|
},
|
|
63
33
|
],
|
|
64
34
|
properties: {
|
|
@@ -77,7 +47,9 @@ export const CardBlockSchema = () => ({
|
|
|
77
47
|
},
|
|
78
48
|
url: {
|
|
79
49
|
title: 'url',
|
|
80
|
-
|
|
50
|
+
widget: 'object_browser',
|
|
51
|
+
mode: 'link',
|
|
52
|
+
allowExternals: true,
|
|
81
53
|
},
|
|
82
54
|
},
|
|
83
55
|
required: [],
|
|
@@ -1,67 +1,37 @@
|
|
|
1
|
-
import './styles.less';
|
|
2
|
-
|
|
3
1
|
import { CardBlockSchema, CardContainerSchema } from './CardContainerSchema';
|
|
4
2
|
import React, { useState } from 'react';
|
|
5
3
|
import { emptyCard, getPanels } from '../utils';
|
|
6
4
|
|
|
7
5
|
import CclCard from '@eeacms/volto-clms-theme/components/CclCard/CclCard';
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
6
|
+
import { SidebarPortal, BlockDataForm } from '@plone/volto/components'; // BlocksForm, Icon,
|
|
7
|
+
import { addExtensionFieldToSchema } from '@plone/volto/helpers/Extensions/withBlockSchemaEnhancer';
|
|
10
8
|
import { compose } from 'redux';
|
|
11
9
|
import { injectIntl } from 'react-intl';
|
|
12
10
|
import { isEmpty } from 'lodash';
|
|
13
|
-
import { useSelector } from 'react-redux';
|
|
14
11
|
import withObjectBrowser from '@plone/volto/components/manage/Sidebar/ObjectBrowser';
|
|
12
|
+
import CclImageEditor from '@eeacms/volto-clms-theme/components/CclImageEditor/CclImageEditor';
|
|
13
|
+
import { defineMessages } from 'react-intl';
|
|
14
|
+
import config from '@plone/volto/registry';
|
|
15
|
+
import getListingBodyVariation from './utils.js';
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type['@id'].match(regex)[0],
|
|
23
|
-
type.title,
|
|
24
|
-
]);
|
|
17
|
+
const messages = defineMessages({
|
|
18
|
+
template: {
|
|
19
|
+
id: 'Variation',
|
|
20
|
+
defaultMessage: 'Variation',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
large: {
|
|
38
|
-
download:
|
|
39
|
-
'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg',
|
|
40
|
-
},
|
|
41
|
-
listing: {
|
|
42
|
-
download:
|
|
43
|
-
'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg',
|
|
44
|
-
},
|
|
45
|
-
mini: {
|
|
46
|
-
download:
|
|
47
|
-
'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg',
|
|
48
|
-
},
|
|
49
|
-
preview: {
|
|
50
|
-
download:
|
|
51
|
-
'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg',
|
|
52
|
-
},
|
|
53
|
-
thumb: {
|
|
54
|
-
download:
|
|
55
|
-
'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg',
|
|
56
|
-
},
|
|
57
|
-
tile: {
|
|
58
|
-
download:
|
|
59
|
-
'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
url: '/en/product-portfolio/how-our-products-are-created',
|
|
64
|
-
};
|
|
24
|
+
const CclCardContainerBlockEdit = ({
|
|
25
|
+
block,
|
|
26
|
+
data,
|
|
27
|
+
onChangeBlock,
|
|
28
|
+
selected,
|
|
29
|
+
editable,
|
|
30
|
+
setSidebarTab,
|
|
31
|
+
openObjectBrowser,
|
|
32
|
+
pathname,
|
|
33
|
+
intl,
|
|
34
|
+
}) => {
|
|
65
35
|
const properties = isEmpty(data?.customCards?.blocks)
|
|
66
36
|
? emptyCard(2)
|
|
67
37
|
: data.customCards;
|
|
@@ -80,21 +50,24 @@ const CclCardContainerBlockEdit = (props) => {
|
|
|
80
50
|
/* eslint-disable-next-line */
|
|
81
51
|
}, []);
|
|
82
52
|
|
|
83
|
-
const [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
53
|
+
const [selectedCardBlock, setSelectedCardBlock] = useState(-1);
|
|
54
|
+
|
|
55
|
+
let schema = CardContainerSchema();
|
|
56
|
+
|
|
57
|
+
schema = addExtensionFieldToSchema({
|
|
58
|
+
schema,
|
|
59
|
+
name: 'variation',
|
|
60
|
+
items: config.blocks.blocksConfig.listing.variations,
|
|
61
|
+
intl,
|
|
62
|
+
title: { id: intl.formatMessage(messages.template) },
|
|
63
|
+
});
|
|
89
64
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
} else if (
|
|
95
|
-
|
|
96
|
-
} else if (data.cardOrigin === 'custom') {
|
|
97
|
-
extras.push('customCards');
|
|
65
|
+
const variation = getListingBodyVariation(data);
|
|
66
|
+
let containerClass = '';
|
|
67
|
+
if (['news', 'event'].includes(variation.templateID)) {
|
|
68
|
+
containerClass = 'ccl-container';
|
|
69
|
+
} else if (!['line', 'doc', 'globalSearch'].includes(variation.templateID)) {
|
|
70
|
+
containerClass = 'card-container';
|
|
98
71
|
}
|
|
99
72
|
|
|
100
73
|
return (
|
|
@@ -102,46 +75,44 @@ const CclCardContainerBlockEdit = (props) => {
|
|
|
102
75
|
<div
|
|
103
76
|
className="cardContainer-header"
|
|
104
77
|
onClick={() => {
|
|
105
|
-
|
|
106
|
-
|
|
78
|
+
setSidebarTab(1);
|
|
79
|
+
setSelectedCardBlock(-1);
|
|
107
80
|
}}
|
|
108
81
|
aria-hidden="true"
|
|
109
82
|
>
|
|
110
83
|
{data.title || 'Card container'}
|
|
111
84
|
</div>
|
|
112
|
-
<div>
|
|
113
|
-
{
|
|
114
|
-
|
|
115
|
-
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
</div>
|
|
140
|
-
)}
|
|
85
|
+
<div className={containerClass}>
|
|
86
|
+
{panels.map(([uid, panel], index) => (
|
|
87
|
+
<CclCard
|
|
88
|
+
key={index}
|
|
89
|
+
type={variation?.templateID || 'doc'}
|
|
90
|
+
card={panel}
|
|
91
|
+
onClickImage={() => {
|
|
92
|
+
setSelectedCardBlock(uid);
|
|
93
|
+
}}
|
|
94
|
+
isCustomCard={true}
|
|
95
|
+
CclImageEditor={
|
|
96
|
+
<CclImageEditor
|
|
97
|
+
block={block}
|
|
98
|
+
data={data}
|
|
99
|
+
editable={editable}
|
|
100
|
+
imageUrl={panel?.image?.url}
|
|
101
|
+
onChangeBlock={onChangeBlock}
|
|
102
|
+
openObjectBrowser={openObjectBrowser}
|
|
103
|
+
pathname={pathname}
|
|
104
|
+
selected={selected}
|
|
105
|
+
selectedCardBlock={selectedCardBlock}
|
|
106
|
+
setSelectedCardBlock={setSelectedCardBlock}
|
|
107
|
+
uid={uid}
|
|
108
|
+
/>
|
|
109
|
+
}
|
|
110
|
+
/>
|
|
111
|
+
))}
|
|
141
112
|
</div>
|
|
142
|
-
<SidebarPortal selected={selected &&
|
|
143
|
-
<
|
|
144
|
-
schema={
|
|
113
|
+
<SidebarPortal selected={selected && selectedCardBlock === -1}>
|
|
114
|
+
<BlockDataForm
|
|
115
|
+
schema={schema}
|
|
145
116
|
title="Card container block"
|
|
146
117
|
onChangeField={(id, value) => {
|
|
147
118
|
onChangeBlock(block, {
|
|
@@ -153,9 +124,11 @@ const CclCardContainerBlockEdit = (props) => {
|
|
|
153
124
|
/>
|
|
154
125
|
</SidebarPortal>
|
|
155
126
|
<SidebarPortal
|
|
156
|
-
selected={
|
|
127
|
+
selected={
|
|
128
|
+
selected && selectedCardBlock !== -1 && data.customCards?.blocks
|
|
129
|
+
}
|
|
157
130
|
>
|
|
158
|
-
<
|
|
131
|
+
<BlockDataForm
|
|
159
132
|
schema={CardBlockSchema()}
|
|
160
133
|
title="Card block"
|
|
161
134
|
onChangeField={(id, value) => {
|
|
@@ -165,15 +138,15 @@ const CclCardContainerBlockEdit = (props) => {
|
|
|
165
138
|
...data.customCards,
|
|
166
139
|
blocks: {
|
|
167
140
|
...data.customCards.blocks,
|
|
168
|
-
[
|
|
169
|
-
...data.customCards.blocks[
|
|
141
|
+
[selectedCardBlock]: {
|
|
142
|
+
...data.customCards.blocks[selectedCardBlock],
|
|
170
143
|
[id]: value,
|
|
171
144
|
},
|
|
172
145
|
},
|
|
173
146
|
},
|
|
174
147
|
});
|
|
175
148
|
}}
|
|
176
|
-
formData={data.customCards?.blocks[
|
|
149
|
+
formData={data.customCards?.blocks[selectedCardBlock]}
|
|
177
150
|
/>
|
|
178
151
|
</SidebarPortal>
|
|
179
152
|
</>
|
|
@@ -1,54 +1,31 @@
|
|
|
1
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
2
|
-
|
|
3
1
|
import CclCard from '@eeacms/volto-clms-theme/components/CclCard/CclCard';
|
|
4
2
|
import React from 'react';
|
|
5
|
-
import
|
|
3
|
+
import getListingBodyVariation from './utils.js';
|
|
6
4
|
|
|
7
5
|
const CclCardContainerBlockView = (props) => {
|
|
8
|
-
const { data
|
|
6
|
+
const { data } = props;
|
|
7
|
+
let cards = data?.customCards?.blocks_layout?.items.map(
|
|
8
|
+
(uid) => data.customCards.blocks[uid],
|
|
9
|
+
);
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
const dispatch = useDispatch();
|
|
12
|
-
let cards = searchSubrequests?.[props.id]?.items;
|
|
11
|
+
const variation = getListingBodyVariation(data);
|
|
13
12
|
|
|
14
|
-
let
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
} else if (
|
|
18
|
-
|
|
19
|
-
} else if (data.cardOrigin === 'custom') {
|
|
20
|
-
cards = data?.customCards?.blocks_layout?.items.map(
|
|
21
|
-
(uid) => data.customCards.blocks[uid],
|
|
22
|
-
);
|
|
13
|
+
let containerClass = '';
|
|
14
|
+
if (['news', 'event'].includes(variation.templateID)) {
|
|
15
|
+
containerClass = 'ccl-container';
|
|
16
|
+
} else if (!['line', 'doc', 'globalSearch'].includes(variation.templateID)) {
|
|
17
|
+
containerClass = 'card-container';
|
|
23
18
|
}
|
|
24
|
-
|
|
25
|
-
React.useEffect(() => {
|
|
26
|
-
let portal_type =
|
|
27
|
-
data.contentTypes?.length > 0 ? { portal_type: data.contentTypes } : {};
|
|
28
|
-
dispatch(
|
|
29
|
-
searchContent(
|
|
30
|
-
path,
|
|
31
|
-
{
|
|
32
|
-
sort_on: 'effective',
|
|
33
|
-
sort_order: 'reverse',
|
|
34
|
-
fullobjects: 1,
|
|
35
|
-
...portal_type,
|
|
36
|
-
},
|
|
37
|
-
id,
|
|
38
|
-
),
|
|
39
|
-
);
|
|
40
|
-
}, [path, data, id, dispatch]);
|
|
41
|
-
|
|
42
|
-
var cardStyle = data.cardStyle || 'line';
|
|
43
19
|
return (
|
|
44
|
-
<div
|
|
45
|
-
className={
|
|
46
|
-
cardStyle === 'line' || cardStyle === 'doc' ? '' : 'card-container'
|
|
47
|
-
}
|
|
48
|
-
>
|
|
20
|
+
<div className={containerClass}>
|
|
49
21
|
{cards &&
|
|
50
22
|
cards.map((card, index) => (
|
|
51
|
-
<CclCard
|
|
23
|
+
<CclCard
|
|
24
|
+
key={index}
|
|
25
|
+
type={variation.templateID}
|
|
26
|
+
card={card}
|
|
27
|
+
isCustomCard={true}
|
|
28
|
+
/>
|
|
52
29
|
))}
|
|
53
30
|
</div>
|
|
54
31
|
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import config from '@plone/volto/registry';
|
|
2
|
+
const getListingBodyVariation = (data) => {
|
|
3
|
+
const { variations } = config.blocks.blocksConfig.listing;
|
|
4
|
+
const variation = data.variation
|
|
5
|
+
? variations.find(
|
|
6
|
+
({ id, templateID }) => id === data.variation && templateID,
|
|
7
|
+
)
|
|
8
|
+
: variations.find(({ isDefault, templateID }) => isDefault && templateID);
|
|
9
|
+
|
|
10
|
+
return variation;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default getListingBodyVariation;
|