@eeacms/volto-clms-theme 1.0.106 → 1.0.109
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 +27 -0
- package/package.json +1 -1
- package/src/components/CLMSDownloadableFileView/CLMSDownloadableFileView.jsx +23 -29
- package/src/components/CLMSMeetingView/CLMSMeetingView.jsx +8 -70
- package/src/components/CLMSNewsItemView/CLMSNewsItemView.jsx +54 -128
- package/src/components/CLMSRelatedItems/CLMSRelatedItems.jsx +39 -0
- package/src/components/CLMSRelatedItems/index.js +3 -0
- package/src/components/CclModal/modal.less +5 -0
- package/src/components/Widgets/ImageSizeWidget.jsx +93 -0
- package/src/components/Widgets/ImageSizeWidget.test.jsx +30 -0
- package/src/customizations/volto/components/manage/Widgets/EmailWidget.jsx +26 -23
- package/src/customizations/volto/components/theme/Footer/Footer.jsx +1 -3
- package/src/index.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,35 @@ 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.109](https://github.com/eea/volto-clms-theme/compare/1.0.108...1.0.109)
|
|
8
|
+
|
|
9
|
+
- add ImageSizeWidget to fix volto-style-block incompatibility with Volto 15 [`15e4d97`](https://github.com/eea/volto-clms-theme/commit/15e4d9785aa3d34787ca151319aeaf8a4d8930b4)
|
|
10
|
+
- breadcrumbs on file views [`03ff26a`](https://github.com/eea/volto-clms-theme/commit/03ff26acf75090ebe61a71fb6f9c144548df1615)
|
|
11
|
+
- prettier [`b1f7295`](https://github.com/eea/volto-clms-theme/commit/b1f72954e990a789c84c6a4cc0764bbf98fcb6a2)
|
|
12
|
+
- email field style login popup and footer subscribe [`0561cb5`](https://github.com/eea/volto-clms-theme/commit/0561cb51cacb93f83c448ce82ef4079947942922)
|
|
13
|
+
|
|
14
|
+
#### [1.0.108](https://github.com/eea/volto-clms-theme/compare/1.0.107...1.0.108)
|
|
15
|
+
|
|
16
|
+
> 18 July 2022
|
|
17
|
+
|
|
18
|
+
- EmailWidget fix [`#279`](https://github.com/eea/volto-clms-theme/pull/279)
|
|
19
|
+
|
|
20
|
+
#### [1.0.107](https://github.com/eea/volto-clms-theme/compare/1.0.106...1.0.107)
|
|
21
|
+
|
|
22
|
+
> 14 July 2022
|
|
23
|
+
|
|
24
|
+
- Develop [`#278`](https://github.com/eea/volto-clms-theme/pull/278)
|
|
25
|
+
- Minor fixes [`#277`](https://github.com/eea/volto-clms-theme/pull/277)
|
|
26
|
+
- remove unused import [`dc57cf5`](https://github.com/eea/volto-clms-theme/commit/dc57cf5d5a3c1537edd762854be35ae076fc0359)
|
|
27
|
+
- unify related items in one component [`87fa84f`](https://github.com/eea/volto-clms-theme/commit/87fa84f78c06ec666b2a5ae720e6faa76df9ed1d)
|
|
28
|
+
- show related products/datasets always [`a35faad`](https://github.com/eea/volto-clms-theme/commit/a35faad04dc54e78afa9fc47fe9545ff7fe36303)
|
|
29
|
+
- show only File items [`abb4859`](https://github.com/eea/volto-clms-theme/commit/abb48592819a4bf338fc34aebdc1f1ecd920a226)
|
|
30
|
+
|
|
7
31
|
#### [1.0.106](https://github.com/eea/volto-clms-theme/compare/1.0.105...1.0.106)
|
|
8
32
|
|
|
33
|
+
> 13 July 2022
|
|
34
|
+
|
|
35
|
+
- Develop [`#276`](https://github.com/eea/volto-clms-theme/pull/276)
|
|
9
36
|
- new field types for form [`a452429`](https://github.com/eea/volto-clms-theme/commit/a452429eff799806d58e05e3e4164bc885d6eeb9)
|
|
10
37
|
- handle SelectWidget choices until the vocabulary is loaded [`0614fb5`](https://github.com/eea/volto-clms-theme/commit/0614fb584f52571d15e37fbe921e0694594a01f4)
|
|
11
38
|
- EmailWidget fix and ImageWidget created for form block [`fc1d16b`](https://github.com/eea/volto-clms-theme/commit/fc1d16baf2466dec09d835147fc3df839811e409)
|
package/package.json
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import React
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
|
|
4
|
-
import {
|
|
5
|
-
import { useDispatch } from 'react-redux';
|
|
6
|
-
import { Label } from 'semantic-ui-react';
|
|
3
|
+
import { Label, Container } from 'semantic-ui-react';
|
|
7
4
|
|
|
8
5
|
export const CLMSDownloadableFileView = (props) => {
|
|
9
|
-
const dispatch = useDispatch();
|
|
10
6
|
const { content } = props;
|
|
11
7
|
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
dispatch(getBreadcrumbs([]));
|
|
14
|
-
}, [dispatch]);
|
|
15
|
-
|
|
16
8
|
const options = content.taxonomy_technical_library_categorization?.map(
|
|
17
9
|
(cat) => {
|
|
18
10
|
return {
|
|
@@ -26,26 +18,28 @@ export const CLMSDownloadableFileView = (props) => {
|
|
|
26
18
|
|
|
27
19
|
return (
|
|
28
20
|
<>
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
<
|
|
21
|
+
<Container className="view-wrapper">
|
|
22
|
+
<div id="page-document" className="ui container">
|
|
23
|
+
<h1 className="page-title">{content.title}</h1>
|
|
24
|
+
<div>
|
|
25
|
+
<p>{content.description}</p>
|
|
26
|
+
</div>
|
|
27
|
+
{options?.length > 0 && (
|
|
28
|
+
<Label.Group>
|
|
29
|
+
{options.map((cat, key) => {
|
|
30
|
+
return (
|
|
31
|
+
<Label key={key} color="olive">
|
|
32
|
+
{cat.title}
|
|
33
|
+
</Label>
|
|
34
|
+
);
|
|
35
|
+
})}
|
|
36
|
+
</Label.Group>
|
|
37
|
+
)}{' '}
|
|
38
|
+
<CclButton download={true} url={content?.file?.download}>
|
|
39
|
+
Download file
|
|
40
|
+
</CclButton>
|
|
33
41
|
</div>
|
|
34
|
-
|
|
35
|
-
<Label.Group>
|
|
36
|
-
{options.map((cat, key) => {
|
|
37
|
-
return (
|
|
38
|
-
<Label key={key} color="olive">
|
|
39
|
-
{cat.title}
|
|
40
|
-
</Label>
|
|
41
|
-
);
|
|
42
|
-
})}
|
|
43
|
-
</Label.Group>
|
|
44
|
-
)}{' '}
|
|
45
|
-
<CclButton download={true} url={content?.file?.download}>
|
|
46
|
-
Download file
|
|
47
|
-
</CclButton>
|
|
48
|
-
</div>
|
|
42
|
+
</Container>
|
|
49
43
|
</>
|
|
50
44
|
);
|
|
51
45
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './meetingstyles.less';
|
|
2
2
|
|
|
3
3
|
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
|
4
|
-
import { Header, Image, Message, Segment
|
|
4
|
+
import { Header, Image, Message, Segment } from 'semantic-ui-react';
|
|
5
5
|
import { Icon, Toast } from '@plone/volto/components';
|
|
6
6
|
import {
|
|
7
7
|
Recurrence,
|
|
@@ -23,6 +23,7 @@ import CclListingCards from '@eeacms/volto-clms-theme/components/Blocks/CustomTe
|
|
|
23
23
|
import config from '@plone/volto/registry';
|
|
24
24
|
import AnimateHeight from 'react-animate-height';
|
|
25
25
|
import { Accordion } from 'semantic-ui-react';
|
|
26
|
+
import { CLMSRelatedItems } from '../CLMSRelatedItems';
|
|
26
27
|
|
|
27
28
|
export const CLMSMeetingView = (props) => {
|
|
28
29
|
const { content, intl } = props;
|
|
@@ -112,15 +113,9 @@ export const CLMSMeetingView = (props) => {
|
|
|
112
113
|
);
|
|
113
114
|
history.push(props.location.pathname + '/form');
|
|
114
115
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
? content.items.map((item) => (item['@type'] === 'File' ? item : null))
|
|
119
|
-
: [];
|
|
120
|
-
const index = files.indexOf(null);
|
|
121
|
-
if (index > -1) {
|
|
122
|
-
files.splice(index, 1);
|
|
123
|
-
}
|
|
116
|
+
const files = content.items
|
|
117
|
+
? content.items.filter((item) => item['@type'] === 'File')
|
|
118
|
+
: [];
|
|
124
119
|
const RegistrationButton = ({ rContent, rMeeting_register, rIsLoggedIn }) => {
|
|
125
120
|
return (
|
|
126
121
|
<>
|
|
@@ -425,6 +420,7 @@ export const CLMSMeetingView = (props) => {
|
|
|
425
420
|
)}
|
|
426
421
|
<StringToHTML string={content.text?.data || ''} />
|
|
427
422
|
<LightGalleryListing />
|
|
423
|
+
|
|
428
424
|
{files.length > 0 && (
|
|
429
425
|
<CclListingCards
|
|
430
426
|
variation="file"
|
|
@@ -456,36 +452,7 @@ export const CLMSMeetingView = (props) => {
|
|
|
456
452
|
</Accordion.Title>
|
|
457
453
|
<Accordion.Content active={activeIndex.includes(0)}>
|
|
458
454
|
<AnimateHeight animateOpacity duration={500} height={'auto'}>
|
|
459
|
-
<
|
|
460
|
-
{content.products.map((product, key) => (
|
|
461
|
-
<li key={key}>
|
|
462
|
-
<Grid columns={2}>
|
|
463
|
-
<Grid.Column width={2}>
|
|
464
|
-
{product.image_field && (
|
|
465
|
-
<img
|
|
466
|
-
src={
|
|
467
|
-
product.image_field
|
|
468
|
-
? `${product['@id']}/@@images/image`
|
|
469
|
-
: 'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg'
|
|
470
|
-
}
|
|
471
|
-
alt={
|
|
472
|
-
product.image_field
|
|
473
|
-
? product.image?.filename
|
|
474
|
-
: 'Placeholder'
|
|
475
|
-
}
|
|
476
|
-
/>
|
|
477
|
-
)}
|
|
478
|
-
</Grid.Column>
|
|
479
|
-
<Grid.Column width={10}>
|
|
480
|
-
<a href={product['@id']}>
|
|
481
|
-
<strong>{product.title}</strong>
|
|
482
|
-
</a>
|
|
483
|
-
<p>{product.description}</p>
|
|
484
|
-
</Grid.Column>
|
|
485
|
-
</Grid>
|
|
486
|
-
</li>
|
|
487
|
-
))}
|
|
488
|
-
</ul>
|
|
455
|
+
<CLMSRelatedItems items={content.products} />
|
|
489
456
|
</AnimateHeight>
|
|
490
457
|
</Accordion.Content>
|
|
491
458
|
</Accordion>
|
|
@@ -512,36 +479,7 @@ export const CLMSMeetingView = (props) => {
|
|
|
512
479
|
</Accordion.Title>
|
|
513
480
|
<Accordion.Content active={activeDatasetIndex.includes(0)}>
|
|
514
481
|
<AnimateHeight animateOpacity duration={500} height={'auto'}>
|
|
515
|
-
<
|
|
516
|
-
{content.datasets.map((dataset, key) => (
|
|
517
|
-
<li key={key}>
|
|
518
|
-
<Grid columns={2}>
|
|
519
|
-
<Grid.Column width={2}>
|
|
520
|
-
{dataset.image_field && (
|
|
521
|
-
<img
|
|
522
|
-
src={
|
|
523
|
-
dataset.image_field
|
|
524
|
-
? `${dataset['@id']}/@@images/image`
|
|
525
|
-
: 'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg'
|
|
526
|
-
}
|
|
527
|
-
alt={
|
|
528
|
-
dataset.image_field
|
|
529
|
-
? dataset.image?.filename
|
|
530
|
-
: 'Placeholder'
|
|
531
|
-
}
|
|
532
|
-
/>
|
|
533
|
-
)}
|
|
534
|
-
</Grid.Column>
|
|
535
|
-
<Grid.Column width={10}>
|
|
536
|
-
<a href={dataset['@id']}>
|
|
537
|
-
<strong>{dataset.title}</strong>
|
|
538
|
-
</a>
|
|
539
|
-
<p>{dataset.description}</p>
|
|
540
|
-
</Grid.Column>
|
|
541
|
-
</Grid>
|
|
542
|
-
</li>
|
|
543
|
-
))}
|
|
544
|
-
</ul>
|
|
482
|
+
<CLMSRelatedItems items={content.datasets} />
|
|
545
483
|
</AnimateHeight>
|
|
546
484
|
</Accordion.Content>
|
|
547
485
|
</Accordion>
|
|
@@ -8,18 +8,14 @@ import CclListingCards from '@eeacms/volto-clms-theme/components/Blocks/CustomTe
|
|
|
8
8
|
import config from '@plone/volto/registry';
|
|
9
9
|
import { Icon } from '@plone/volto/components';
|
|
10
10
|
import AnimateHeight from 'react-animate-height';
|
|
11
|
-
import { Accordion
|
|
11
|
+
import { Accordion } from 'semantic-ui-react';
|
|
12
|
+
import { CLMSRelatedItems } from '../CLMSRelatedItems';
|
|
12
13
|
|
|
13
14
|
const CLMSNewsItemView = (props) => {
|
|
14
15
|
const { content } = props;
|
|
15
|
-
const files =
|
|
16
|
-
content.items
|
|
17
|
-
|
|
18
|
-
: [];
|
|
19
|
-
const index = files.indexOf(null);
|
|
20
|
-
if (index > -1) {
|
|
21
|
-
files.splice(index, 1);
|
|
22
|
-
}
|
|
16
|
+
const files = content.items
|
|
17
|
+
? content.items.filter((item) => item['@type'] === 'File')
|
|
18
|
+
: [];
|
|
23
19
|
const [activeIndex, setActiveIndex] = React.useState([99]);
|
|
24
20
|
|
|
25
21
|
const handleClick = ({ index }) => {
|
|
@@ -80,128 +76,58 @@ const CLMSNewsItemView = (props) => {
|
|
|
80
76
|
<StringToHTML string={content.text?.data || ''} />
|
|
81
77
|
</div>
|
|
82
78
|
<LightGalleryListing />
|
|
83
|
-
{files.length > 0 && (
|
|
84
|
-
<CclListingCards
|
|
85
|
-
variation="file"
|
|
86
|
-
items={files}
|
|
87
|
-
linkHref={`${files['@id']}/@@download/file`}
|
|
88
|
-
/>
|
|
89
|
-
)}
|
|
90
|
-
{content?.products?.length > 0 && (
|
|
91
|
-
<Accordion fluid styled>
|
|
92
|
-
<Accordion.Title
|
|
93
|
-
as={'h2'}
|
|
94
|
-
onClick={() => handleClick({ index: 0 })}
|
|
95
|
-
className={'accordion-title align-arrow-right'}
|
|
96
|
-
>
|
|
97
|
-
{activeIndex.includes(0) ? (
|
|
98
|
-
<Icon
|
|
99
|
-
name={iconName(content, titleIcons.opened)}
|
|
100
|
-
size="24px"
|
|
101
|
-
/>
|
|
102
|
-
) : (
|
|
103
|
-
<Icon
|
|
104
|
-
name={iconName(content, titleIcons.closed)}
|
|
105
|
-
size="24px"
|
|
106
|
-
/>
|
|
107
|
-
)}
|
|
108
|
-
<span>Related products</span>
|
|
109
|
-
</Accordion.Title>
|
|
110
|
-
<Accordion.Content active={activeIndex.includes(0)}>
|
|
111
|
-
<AnimateHeight animateOpacity duration={500} height={'auto'}>
|
|
112
|
-
<ul>
|
|
113
|
-
{content.products.map((product, key) => (
|
|
114
|
-
<li key={key}>
|
|
115
|
-
<Grid columns={2}>
|
|
116
|
-
<Grid.Column width={2}>
|
|
117
|
-
{product.image_field && (
|
|
118
|
-
<img
|
|
119
|
-
src={
|
|
120
|
-
product.image_field
|
|
121
|
-
? `${product['@id']}/@@images/image`
|
|
122
|
-
: 'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg'
|
|
123
|
-
}
|
|
124
|
-
alt={
|
|
125
|
-
product.image_field
|
|
126
|
-
? product.image?.filename
|
|
127
|
-
: 'Placeholder'
|
|
128
|
-
}
|
|
129
|
-
/>
|
|
130
|
-
)}
|
|
131
|
-
</Grid.Column>
|
|
132
|
-
<Grid.Column width={10}>
|
|
133
|
-
<a href={product['@id']}>
|
|
134
|
-
<strong>{product.title}</strong>
|
|
135
|
-
</a>
|
|
136
|
-
<p>{product.description}</p>
|
|
137
|
-
</Grid.Column>
|
|
138
|
-
</Grid>
|
|
139
|
-
</li>
|
|
140
|
-
))}
|
|
141
|
-
</ul>
|
|
142
|
-
</AnimateHeight>
|
|
143
|
-
</Accordion.Content>
|
|
144
|
-
</Accordion>
|
|
145
|
-
)}
|
|
146
|
-
{content?.datasets?.length > 0 && (
|
|
147
|
-
<Accordion fluid styled>
|
|
148
|
-
<Accordion.Title
|
|
149
|
-
as={'h2'}
|
|
150
|
-
onClick={() => handleDatasetClick({ datasetindex: 0 })}
|
|
151
|
-
className={'accordion-title align-arrow-right'}
|
|
152
|
-
>
|
|
153
|
-
{activeDatasetIndex.includes(0) ? (
|
|
154
|
-
<Icon
|
|
155
|
-
name={iconName(content, titleIcons.opened)}
|
|
156
|
-
size="24px"
|
|
157
|
-
/>
|
|
158
|
-
) : (
|
|
159
|
-
<Icon
|
|
160
|
-
name={iconName(content, titleIcons.closed)}
|
|
161
|
-
size="24px"
|
|
162
|
-
/>
|
|
163
|
-
)}
|
|
164
|
-
<span>Related datasets</span>
|
|
165
|
-
</Accordion.Title>
|
|
166
|
-
<Accordion.Content active={activeDatasetIndex.includes(0)}>
|
|
167
|
-
<AnimateHeight animateOpacity duration={500} height={'auto'}>
|
|
168
|
-
<ul>
|
|
169
|
-
{content.datasets.map((dataset, key) => (
|
|
170
|
-
<li key={key}>
|
|
171
|
-
<Grid columns={2}>
|
|
172
|
-
<Grid.Column width={2}>
|
|
173
|
-
{dataset.image_field && (
|
|
174
|
-
<img
|
|
175
|
-
src={
|
|
176
|
-
dataset.image_field
|
|
177
|
-
? `${dataset['@id']}/@@images/image`
|
|
178
|
-
: 'https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg'
|
|
179
|
-
}
|
|
180
|
-
alt={
|
|
181
|
-
dataset.image_field
|
|
182
|
-
? dataset.image?.filename
|
|
183
|
-
: 'Placeholder'
|
|
184
|
-
}
|
|
185
|
-
/>
|
|
186
|
-
)}
|
|
187
|
-
</Grid.Column>
|
|
188
|
-
<Grid.Column width={10}>
|
|
189
|
-
<a href={dataset['@id']}>
|
|
190
|
-
<strong>{dataset.title}</strong>
|
|
191
|
-
</a>
|
|
192
|
-
<p>{dataset.description}</p>
|
|
193
|
-
</Grid.Column>
|
|
194
|
-
</Grid>
|
|
195
|
-
</li>
|
|
196
|
-
))}
|
|
197
|
-
</ul>
|
|
198
|
-
</AnimateHeight>
|
|
199
|
-
</Accordion.Content>
|
|
200
|
-
</Accordion>
|
|
201
|
-
)}
|
|
202
79
|
</div>
|
|
203
80
|
</>
|
|
204
81
|
)}
|
|
82
|
+
{files.length > 0 && (
|
|
83
|
+
<CclListingCards
|
|
84
|
+
variation="file"
|
|
85
|
+
items={files}
|
|
86
|
+
linkHref={`${files['@id']}/@@download/file`}
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
89
|
+
{content?.products?.length > 0 && (
|
|
90
|
+
<Accordion fluid styled>
|
|
91
|
+
<Accordion.Title
|
|
92
|
+
as={'h2'}
|
|
93
|
+
onClick={() => handleClick({ index: 0 })}
|
|
94
|
+
className={'accordion-title align-arrow-right'}
|
|
95
|
+
>
|
|
96
|
+
{activeIndex.includes(0) ? (
|
|
97
|
+
<Icon name={iconName(content, titleIcons.opened)} size="24px" />
|
|
98
|
+
) : (
|
|
99
|
+
<Icon name={iconName(content, titleIcons.closed)} size="24px" />
|
|
100
|
+
)}
|
|
101
|
+
<span>Related products</span>
|
|
102
|
+
</Accordion.Title>
|
|
103
|
+
<Accordion.Content active={activeIndex.includes(0)}>
|
|
104
|
+
<AnimateHeight animateOpacity duration={500} height={'auto'}>
|
|
105
|
+
<CLMSRelatedItems items={content.products} />
|
|
106
|
+
</AnimateHeight>
|
|
107
|
+
</Accordion.Content>
|
|
108
|
+
</Accordion>
|
|
109
|
+
)}
|
|
110
|
+
{content?.datasets?.length > 0 && (
|
|
111
|
+
<Accordion fluid styled>
|
|
112
|
+
<Accordion.Title
|
|
113
|
+
as={'h2'}
|
|
114
|
+
onClick={() => handleDatasetClick({ datasetindex: 0 })}
|
|
115
|
+
className={'accordion-title align-arrow-right'}
|
|
116
|
+
>
|
|
117
|
+
{activeDatasetIndex.includes(0) ? (
|
|
118
|
+
<Icon name={iconName(content, titleIcons.opened)} size="24px" />
|
|
119
|
+
) : (
|
|
120
|
+
<Icon name={iconName(content, titleIcons.closed)} size="24px" />
|
|
121
|
+
)}
|
|
122
|
+
<span>Related datasets</span>
|
|
123
|
+
</Accordion.Title>
|
|
124
|
+
<Accordion.Content active={activeDatasetIndex.includes(0)}>
|
|
125
|
+
<AnimateHeight animateOpacity duration={500} height={'auto'}>
|
|
126
|
+
<CLMSRelatedItems items={content.datasets} />
|
|
127
|
+
</AnimateHeight>
|
|
128
|
+
</Accordion.Content>
|
|
129
|
+
</Accordion>
|
|
130
|
+
)}
|
|
205
131
|
</div>
|
|
206
132
|
);
|
|
207
133
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Grid, Image } from 'semantic-ui-react';
|
|
2
|
+
import PlaceHolder from '@eeacms/volto-clms-theme/../theme/clms/img/ccl-thumbnail-placeholder.jpg';
|
|
3
|
+
|
|
4
|
+
const CLMSRelatedItems = (props) => {
|
|
5
|
+
const { items } = props;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
{items.map((item, key) => (
|
|
10
|
+
<>
|
|
11
|
+
<Grid columns="2">
|
|
12
|
+
<Grid.Column width={3} key={key}>
|
|
13
|
+
{item.mage_field ? (
|
|
14
|
+
<Image
|
|
15
|
+
src={`${item['@id']}/@@images/image/mini`}
|
|
16
|
+
alt={item?.title || 'Placeholder'}
|
|
17
|
+
/>
|
|
18
|
+
) : (
|
|
19
|
+
<Image
|
|
20
|
+
fluid="true"
|
|
21
|
+
src={PlaceHolder}
|
|
22
|
+
alt={item?.title || 'Placeholder'}
|
|
23
|
+
/>
|
|
24
|
+
)}
|
|
25
|
+
</Grid.Column>
|
|
26
|
+
<Grid.Column width={9}>
|
|
27
|
+
<a href={item['@id']}>
|
|
28
|
+
<strong>{item.title}</strong>
|
|
29
|
+
</a>
|
|
30
|
+
{item?.description && <p>{item.description}</p>}
|
|
31
|
+
</Grid.Column>
|
|
32
|
+
</Grid>
|
|
33
|
+
</>
|
|
34
|
+
))}
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { CLMSRelatedItems };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { defineMessages, injectIntl } from 'react-intl';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { Button, Grid } from 'semantic-ui-react';
|
|
5
|
+
import { FormFieldWrapper } from '@plone/volto/components';
|
|
6
|
+
|
|
7
|
+
const messages = defineMessages({
|
|
8
|
+
small: {
|
|
9
|
+
id: 'Small',
|
|
10
|
+
defaultMessage: 'Small',
|
|
11
|
+
},
|
|
12
|
+
medium: {
|
|
13
|
+
id: 'Medium',
|
|
14
|
+
defaultMessage: 'Medium',
|
|
15
|
+
},
|
|
16
|
+
large: {
|
|
17
|
+
id: 'Large',
|
|
18
|
+
defaultMessage: 'Large',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const ImageSizeWidget = (props) => {
|
|
23
|
+
const { onChange, id, disabled, intl, value } = props;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<FormFieldWrapper {...props}>
|
|
27
|
+
<Grid>
|
|
28
|
+
<Grid.Row>
|
|
29
|
+
<Grid.Column width="8" className="field-image_size">
|
|
30
|
+
<Button.Group>
|
|
31
|
+
<Button
|
|
32
|
+
icon
|
|
33
|
+
basic
|
|
34
|
+
aria-label={intl.formatMessage(messages.small)}
|
|
35
|
+
onClick={() => onChange(id, 's')}
|
|
36
|
+
active={value === 's'}
|
|
37
|
+
disabled={disabled}
|
|
38
|
+
>
|
|
39
|
+
<div className="image-sizes-text">S</div>
|
|
40
|
+
</Button>
|
|
41
|
+
</Button.Group>
|
|
42
|
+
<Button.Group>
|
|
43
|
+
<Button
|
|
44
|
+
icon
|
|
45
|
+
basic
|
|
46
|
+
aria-label={intl.formatMessage(messages.medium)}
|
|
47
|
+
onClick={() => onChange(id, 'm')}
|
|
48
|
+
active={value === 'm'}
|
|
49
|
+
disabled={disabled}
|
|
50
|
+
>
|
|
51
|
+
<div className="image-sizes-text">M</div>
|
|
52
|
+
</Button>
|
|
53
|
+
</Button.Group>
|
|
54
|
+
<Button.Group>
|
|
55
|
+
<Button
|
|
56
|
+
icon
|
|
57
|
+
basic
|
|
58
|
+
aria-label={intl.formatMessage(messages.large)}
|
|
59
|
+
onClick={() => onChange(id, 'l')}
|
|
60
|
+
active={value === 'l' || value === undefined}
|
|
61
|
+
disabled={disabled}
|
|
62
|
+
>
|
|
63
|
+
<div className="image-sizes-text">L</div>
|
|
64
|
+
</Button>
|
|
65
|
+
</Button.Group>
|
|
66
|
+
</Grid.Column>
|
|
67
|
+
</Grid.Row>
|
|
68
|
+
</Grid>
|
|
69
|
+
</FormFieldWrapper>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Property types.
|
|
75
|
+
* @property {Object} propTypes Property types.
|
|
76
|
+
* @static
|
|
77
|
+
*/
|
|
78
|
+
ImageSizeWidget.propTypes = {
|
|
79
|
+
onChange: PropTypes.func.isRequired,
|
|
80
|
+
value: PropTypes.string,
|
|
81
|
+
id: PropTypes.string.isRequired,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Default properties.
|
|
86
|
+
* @property {Object} defaultProps Default properties.
|
|
87
|
+
* @static
|
|
88
|
+
*/
|
|
89
|
+
ImageSizeWidget.defaultProps = {
|
|
90
|
+
onChange: () => {},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default injectIntl(ImageSizeWidget);
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
|
|
6
|
+
import ImageSizeWidget from './ImageSizeWidget';
|
|
7
|
+
|
|
8
|
+
const mockStore = configureStore();
|
|
9
|
+
|
|
10
|
+
test('renders an image sizes widget component', () => {
|
|
11
|
+
const store = mockStore({
|
|
12
|
+
intl: {
|
|
13
|
+
locale: 'en',
|
|
14
|
+
messages: {},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const component = renderer.create(
|
|
19
|
+
<Provider store={store}>
|
|
20
|
+
<ImageSizeWidget
|
|
21
|
+
id="image_size"
|
|
22
|
+
title="Image Size"
|
|
23
|
+
fieldSet="default"
|
|
24
|
+
onChange={() => {}}
|
|
25
|
+
/>
|
|
26
|
+
</Provider>,
|
|
27
|
+
);
|
|
28
|
+
const json = component.toJSON();
|
|
29
|
+
expect(json).toMatchSnapshot();
|
|
30
|
+
});
|
|
@@ -47,11 +47,13 @@ const EmailWidget = (props) => {
|
|
|
47
47
|
// email.addEventListener('input', function (e) {
|
|
48
48
|
React.useEffect(() => {
|
|
49
49
|
if (email !== '') {
|
|
50
|
-
if (email.validity
|
|
51
|
-
email.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
if (email.validity !== undefined) {
|
|
51
|
+
if (email.validity.typeMismatch) {
|
|
52
|
+
email.setCustomValidity(intl.formatMessage(messages.invalid_email));
|
|
53
|
+
email.reportValidity();
|
|
54
|
+
} else {
|
|
55
|
+
email.setCustomValidity('');
|
|
56
|
+
}
|
|
55
57
|
}
|
|
56
58
|
} else {
|
|
57
59
|
return;
|
|
@@ -62,24 +64,25 @@ const EmailWidget = (props) => {
|
|
|
62
64
|
|
|
63
65
|
return (
|
|
64
66
|
<FormFieldWrapper {...props} className="email">
|
|
65
|
-
<input
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
67
|
+
<div className="ui input">
|
|
68
|
+
<input
|
|
69
|
+
id={inputId}
|
|
70
|
+
name={id}
|
|
71
|
+
type="email"
|
|
72
|
+
value={value || ''}
|
|
73
|
+
disabled={isDisabled}
|
|
74
|
+
placeholder={placeholder}
|
|
75
|
+
onChange={({ target }) =>
|
|
76
|
+
onChange(id, target.value === '' ? undefined : target.value)
|
|
77
|
+
}
|
|
78
|
+
onBlur={({ target }) =>
|
|
79
|
+
onBlur(id, target.value === '' ? undefined : target.value)
|
|
80
|
+
}
|
|
81
|
+
onClick={() => onClick()}
|
|
82
|
+
minLength={minLength || null}
|
|
83
|
+
maxLength={200}
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
83
86
|
</FormFieldWrapper>
|
|
84
87
|
);
|
|
85
88
|
};
|
|
@@ -142,9 +142,7 @@ class Footer extends Component {
|
|
|
142
142
|
|
|
143
143
|
handleInputChange() {
|
|
144
144
|
this.setState({
|
|
145
|
-
inputValue:
|
|
146
|
-
? !this.state.inputValue
|
|
147
|
-
: this.state.inputValue,
|
|
145
|
+
inputValue: !this.state.inputValue,
|
|
148
146
|
});
|
|
149
147
|
}
|
|
150
148
|
|
package/src/index.js
CHANGED
|
@@ -33,6 +33,8 @@ import MapLayersWidget from './components/Widgets/MapLayersWidget';
|
|
|
33
33
|
import TabsWidget from './components/Blocks/CustomTemplates/VoltoTabsBlock/TabsWidget';
|
|
34
34
|
import TaxonomyWidget from './components/Widgets/TaxonomyWidget';
|
|
35
35
|
import ProductComponentsWidget from './components/Widgets/ProductComponentsWidget';
|
|
36
|
+
import ImageSizeWidget from './components/Widgets/ImageSizeWidget';
|
|
37
|
+
|
|
36
38
|
// CUSTOM REDUCERS IMPORT
|
|
37
39
|
import TextLinkWidget from './components/Widgets/TextLinkWidget';
|
|
38
40
|
|
|
@@ -78,6 +80,7 @@ const applyConfig = (config) => {
|
|
|
78
80
|
geonetwork_identifiers_widget: GeonetworkIdentifiersWidget,
|
|
79
81
|
text_link_widget: TextLinkWidget,
|
|
80
82
|
dataset_download_information_widget: DatasetDownloadInformationWidget,
|
|
83
|
+
image_size: ImageSizeWidget,
|
|
81
84
|
};
|
|
82
85
|
config.widgets.id = {
|
|
83
86
|
...config.widgets.id,
|