@eeacms/volto-clms-theme 1.0.104 → 1.0.107
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 +39 -0
- package/package.json +1 -1
- package/src/components/Blocks/CclSubscriptionBlock/SubscriptionEdit.jsx +2 -2
- package/src/components/Blocks/CclSubscriptionBlock/SubscriptionView.jsx +12 -1
- package/src/components/Blocks/CclSubscriptionBlock/schema.js +5 -1
- package/src/components/Blocks/CustomTemplates/VoltoFormBlock/VocabularyWidget.jsx +7 -5
- package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/FilterList.jsx +1 -1
- package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/SearchInput.jsx +1 -1
- package/src/components/Blocks/customBlocks.js +26 -0
- package/src/components/CLMSDownloadCartView/CLMSCartContent.jsx +23 -5
- package/src/components/CLMSLoginView/CLMSLogin.css +17 -0
- package/src/components/CLMSLoginView/CLMSLogin.jsx +64 -0
- package/src/components/CLMSMeetingView/CLMSMeetingView.jsx +95 -9
- package/src/components/CLMSNewsItemView/CLMSNewsItemView.jsx +87 -14
- package/src/components/CLMSRelatedItems/CLMSRelatedItems.jsx +39 -0
- package/src/components/CLMSRelatedItems/index.js +3 -0
- package/src/components/CclCard/CclCard.jsx +9 -19
- package/src/components/CclCard/cards.less +10 -1
- package/src/components/CclModal/CclModal.jsx +1 -1
- package/src/components/Widgets/DatasetDownloadInformationWidget.jsx +1 -1
- package/src/components/Widgets/ImageWidget.jsx +239 -0
- package/src/components/Widgets/taxonomyUtils.js +24 -1
- package/src/customizations/volto/components/manage/Widgets/EmailWidget.jsx +124 -0
- package/src/customizations/volto/components/theme/Footer/Footer.jsx +3 -11
- package/src/customizations/volto/components/theme/Login/Login.jsx +325 -0
- package/src/index.js +19 -1
- package/theme/clms/css/header.css +1 -0
- package/theme/clms/css/maps.less +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,47 @@ 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.107](https://github.com/eea/volto-clms-theme/compare/1.0.106...1.0.107)
|
|
8
|
+
|
|
9
|
+
- Minor fixes [`#277`](https://github.com/eea/volto-clms-theme/pull/277)
|
|
10
|
+
- remove unused import [`dc57cf5`](https://github.com/eea/volto-clms-theme/commit/dc57cf5d5a3c1537edd762854be35ae076fc0359)
|
|
11
|
+
- unify related items in one component [`87fa84f`](https://github.com/eea/volto-clms-theme/commit/87fa84f78c06ec666b2a5ae720e6faa76df9ed1d)
|
|
12
|
+
- show related products/datasets always [`a35faad`](https://github.com/eea/volto-clms-theme/commit/a35faad04dc54e78afa9fc47fe9545ff7fe36303)
|
|
13
|
+
- show only File items [`abb4859`](https://github.com/eea/volto-clms-theme/commit/abb48592819a4bf338fc34aebdc1f1ecd920a226)
|
|
14
|
+
|
|
15
|
+
#### [1.0.106](https://github.com/eea/volto-clms-theme/compare/1.0.105...1.0.106)
|
|
16
|
+
|
|
17
|
+
> 13 July 2022
|
|
18
|
+
|
|
19
|
+
- Develop [`#276`](https://github.com/eea/volto-clms-theme/pull/276)
|
|
20
|
+
- new field types for form [`a452429`](https://github.com/eea/volto-clms-theme/commit/a452429eff799806d58e05e3e4164bc885d6eeb9)
|
|
21
|
+
- handle SelectWidget choices until the vocabulary is loaded [`0614fb5`](https://github.com/eea/volto-clms-theme/commit/0614fb584f52571d15e37fbe921e0694594a01f4)
|
|
22
|
+
- EmailWidget fix and ImageWidget created for form block [`fc1d16b`](https://github.com/eea/volto-clms-theme/commit/fc1d16baf2466dec09d835147fc3df839811e409)
|
|
23
|
+
- lint fix [`af5f960`](https://github.com/eea/volto-clms-theme/commit/af5f9605ec147cb010245a58696087abaed55c35)
|
|
24
|
+
- EmailWidget override for correct anguage and size limitation [`8a6c253`](https://github.com/eea/volto-clms-theme/commit/8a6c253f590fcf753d1a274e8ab7767f366d8c1e)
|
|
25
|
+
- number of current filters [`195cc43`](https://github.com/eea/volto-clms-theme/commit/195cc43d351d0e9793a0f462ecf8bdf9433a1def)
|
|
26
|
+
- subscription modal block [`30db876`](https://github.com/eea/volto-clms-theme/commit/30db876826dd53db6bbb11507de11af10a71a4eb)
|
|
27
|
+
|
|
28
|
+
#### [1.0.105](https://github.com/eea/volto-clms-theme/compare/1.0.104...1.0.105)
|
|
29
|
+
|
|
30
|
+
> 11 July 2022
|
|
31
|
+
|
|
32
|
+
- Develop [`#275`](https://github.com/eea/volto-clms-theme/pull/275)
|
|
33
|
+
- File card [`#274`](https://github.com/eea/volto-clms-theme/pull/274)
|
|
34
|
+
- sort items taxonomy items [`#272`](https://github.com/eea/volto-clms-theme/pull/272)
|
|
35
|
+
- Changes in download cart [`#271`](https://github.com/eea/volto-clms-theme/pull/271)
|
|
36
|
+
- related products and datasets added to news and meeting views and login-plone route created [`5704a1a`](https://github.com/eea/volto-clms-theme/commit/5704a1a766148746162b60efaf232ea90dc20cf4)
|
|
37
|
+
- sort items according to the lowercased label and put those with special meaning at the end [`6410abe`](https://github.com/eea/volto-clms-theme/commit/6410abe096f60dcad54dced2026c9df9b7946d68)
|
|
38
|
+
- lint fix [`1264a7a`](https://github.com/eea/volto-clms-theme/commit/1264a7adfe8d679fea1bd821ad087add20f4271d)
|
|
39
|
+
- footer newsletter subscription change, global search maxLength change from 8000 to 200 and /login design change [`a09d24a`](https://github.com/eea/volto-clms-theme/commit/a09d24adbb6fa053fb2a2cc0071506b906593b42)
|
|
40
|
+
- show Collection on download cart, add dropdown selection to it and remove from Type [`3a13417`](https://github.com/eea/volto-clms-theme/commit/3a13417b92c15187fe0e91ca891ccf9f8b0ed3f1)
|
|
41
|
+
- change form label [`c512a2e`](https://github.com/eea/volto-clms-theme/commit/c512a2e1048c977847cedc8379f58f42adebba18)
|
|
42
|
+
|
|
7
43
|
#### [1.0.104](https://github.com/eea/volto-clms-theme/compare/1.0.103...1.0.104)
|
|
8
44
|
|
|
45
|
+
> 30 June 2022
|
|
46
|
+
|
|
47
|
+
- Develop [`#270`](https://github.com/eea/volto-clms-theme/pull/270)
|
|
9
48
|
- use a combined vocabulary of Products and Datasets [`9f9d0c6`](https://github.com/eea/volto-clms-theme/commit/9f9d0c693a1e870614eb8adc07c58657d9d72a06)
|
|
10
49
|
- allow multiple values [`1edb5dd`](https://github.com/eea/volto-clms-theme/commit/1edb5dd166f31ade19bdcae0b7fa92836dbad420)
|
|
11
50
|
- Products Vocabulary for volto-form-block CLMS-747 [`3f48358`](https://github.com/eea/volto-clms-theme/commit/3f48358dab6a3c20a8367bf4be93c94af6c86350)
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
|
|
2
2
|
import { SidebarPortal } from '@plone/volto/components';
|
|
3
3
|
import { SubscriptionSchema } from './schema';
|
|
4
4
|
import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
|
|
@@ -16,7 +16,7 @@ const SubscriptionBlockEdit = (props) => {
|
|
|
16
16
|
aria-hidden="true"
|
|
17
17
|
/>
|
|
18
18
|
</div>
|
|
19
|
-
<
|
|
19
|
+
<CclButton mode={'filled'}>{data.title || 'Text example...'}</CclButton>
|
|
20
20
|
<SidebarPortal selected={selected}>
|
|
21
21
|
<InlineForm
|
|
22
22
|
schema={SubscriptionSchema()}
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { SubscriptionView } from '@eeacms/volto-clms-theme/components/CLMSSubscriptionView';
|
|
2
|
+
import CclModal from '@eeacms/volto-clms-theme/components/CclModal/CclModal';
|
|
3
|
+
import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
|
|
2
4
|
|
|
3
5
|
const SubscriptionBlockView = (props) => {
|
|
4
6
|
const { data } = props;
|
|
5
7
|
|
|
6
|
-
return
|
|
8
|
+
return (
|
|
9
|
+
<CclModal
|
|
10
|
+
trigger={
|
|
11
|
+
<CclButton mode={'filled'}>{data.title || 'Text example...'}</CclButton>
|
|
12
|
+
}
|
|
13
|
+
size="small"
|
|
14
|
+
>
|
|
15
|
+
<SubscriptionView type={data.type || 'events'} />
|
|
16
|
+
</CclModal>
|
|
17
|
+
);
|
|
7
18
|
};
|
|
8
19
|
|
|
9
20
|
export default SubscriptionBlockView;
|
|
@@ -4,7 +4,7 @@ export const SubscriptionSchema = () => ({
|
|
|
4
4
|
{
|
|
5
5
|
id: 'default',
|
|
6
6
|
title: 'Default',
|
|
7
|
-
fields: ['type'],
|
|
7
|
+
fields: ['type', 'title'],
|
|
8
8
|
},
|
|
9
9
|
],
|
|
10
10
|
properties: {
|
|
@@ -16,6 +16,10 @@ export const SubscriptionSchema = () => ({
|
|
|
16
16
|
['newsletter', 'newsletter'],
|
|
17
17
|
],
|
|
18
18
|
},
|
|
19
|
+
title: {
|
|
20
|
+
title: 'Title',
|
|
21
|
+
type: 'string',
|
|
22
|
+
},
|
|
19
23
|
},
|
|
20
24
|
required: ['product'],
|
|
21
25
|
});
|
|
@@ -45,11 +45,13 @@ const VocabularyWidget = ({
|
|
|
45
45
|
getVocabulary={() => {}}
|
|
46
46
|
getVocabularyTokenTitle={() => {}}
|
|
47
47
|
choices={
|
|
48
|
-
vocabItems?.loaded
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
vocabItems?.loaded
|
|
49
|
+
? [
|
|
50
|
+
...vocabItems.items.map((item) => {
|
|
51
|
+
return [item.label, item.label];
|
|
52
|
+
}),
|
|
53
|
+
]
|
|
54
|
+
: []
|
|
53
55
|
}
|
|
54
56
|
value={value}
|
|
55
57
|
onChange={onChange}
|
|
@@ -65,6 +65,7 @@ import homeBand from '@plone/volto/icons/image-wide.svg';
|
|
|
65
65
|
import linkSVG from '@plone/volto/icons/link.svg';
|
|
66
66
|
import navSVG from '@plone/volto/icons/nav.svg';
|
|
67
67
|
import upSVG from '@plone/volto/icons/up-key.svg';
|
|
68
|
+
import ImageWidget from '@eeacms/volto-clms-theme/components/Widgets/ImageWidget';
|
|
68
69
|
|
|
69
70
|
export const customGroupBlocksOrder = [
|
|
70
71
|
{
|
|
@@ -474,6 +475,31 @@ const customBlocks = (config) => ({
|
|
|
474
475
|
isMulti: true,
|
|
475
476
|
}),
|
|
476
477
|
},
|
|
478
|
+
{
|
|
479
|
+
id: 'topic_vocabulary',
|
|
480
|
+
label: 'Topics Vocabulary',
|
|
481
|
+
component: (props) =>
|
|
482
|
+
VocabularyWidget({
|
|
483
|
+
...props,
|
|
484
|
+
vocabulary: 'clms.types.TopicsVocabulary',
|
|
485
|
+
isMulti: true,
|
|
486
|
+
}),
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
id: 'spatial_coverage_vocabulary',
|
|
490
|
+
label: 'Spatial Coverage Vocabulary',
|
|
491
|
+
component: (props) =>
|
|
492
|
+
VocabularyWidget({
|
|
493
|
+
...props,
|
|
494
|
+
vocabulary: 'clms.types.UseCaseSpatialCoverageVocabulary',
|
|
495
|
+
isMulti: true,
|
|
496
|
+
}),
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
id: 'image_field_widget',
|
|
500
|
+
label: 'Image Field Widget',
|
|
501
|
+
component: ImageWidget,
|
|
502
|
+
},
|
|
477
503
|
],
|
|
478
504
|
},
|
|
479
505
|
});
|
|
@@ -214,6 +214,24 @@ const CLMSCartContent = (props) => {
|
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
const TypeNaming = (typeProps) => {
|
|
217
|
+
const { item } = typeProps;
|
|
218
|
+
if (item.file_id) {
|
|
219
|
+
return (
|
|
220
|
+
<span className={'tag tag-' + item?.type?.toLowerCase()}>
|
|
221
|
+
{contentOrDash(item.type)}
|
|
222
|
+
</span>
|
|
223
|
+
);
|
|
224
|
+
} else if (!item.type) {
|
|
225
|
+
return '-';
|
|
226
|
+
} else {
|
|
227
|
+
let values = item.type_options.filter((myitem) => {
|
|
228
|
+
return myitem['id'] === item.type;
|
|
229
|
+
});
|
|
230
|
+
return values.length > 0 ? values[0].name : '.';
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const CollectionNaming = (typeProps) => {
|
|
217
235
|
const { item } = typeProps;
|
|
218
236
|
if (item.file_id) {
|
|
219
237
|
return (
|
|
@@ -237,11 +255,7 @@ const CLMSCartContent = (props) => {
|
|
|
237
255
|
return {
|
|
238
256
|
key: option.id,
|
|
239
257
|
value: option.id,
|
|
240
|
-
text:
|
|
241
|
-
option.name +
|
|
242
|
-
((option.collection !== undefined &&
|
|
243
|
-
' (' + option.collection + ')') ||
|
|
244
|
-
''),
|
|
258
|
+
text: (option.collection === undefined && '-') || option.collection,
|
|
245
259
|
};
|
|
246
260
|
})}
|
|
247
261
|
onChange={(e, data) => {
|
|
@@ -290,6 +304,7 @@ const CLMSCartContent = (props) => {
|
|
|
290
304
|
<th>Source</th>
|
|
291
305
|
<th>Area</th>
|
|
292
306
|
<th>Type</th>
|
|
307
|
+
<th>Collection</th>
|
|
293
308
|
<th>Format</th>
|
|
294
309
|
<th>Projection</th>
|
|
295
310
|
<th></th>
|
|
@@ -346,6 +361,9 @@ const CLMSCartContent = (props) => {
|
|
|
346
361
|
<td>
|
|
347
362
|
<TypeNaming item={item} />
|
|
348
363
|
</td>
|
|
364
|
+
<td>
|
|
365
|
+
<CollectionNaming item={item} />
|
|
366
|
+
</td>
|
|
349
367
|
<td className="table-td-format">
|
|
350
368
|
{!item.file_id ? (
|
|
351
369
|
<Select
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useSelector } from 'react-redux';
|
|
3
|
+
import config from '@plone/volto/registry';
|
|
4
|
+
import { toPublicURL } from '@plone/volto/helpers/Url/Url';
|
|
5
|
+
import './CLMSLogin.css';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Login Modal component doc.
|
|
9
|
+
* @function CclLoginModal
|
|
10
|
+
* @example <CclLoginModal />
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
function CLMSLoginView(props) {
|
|
14
|
+
const registryRecords = useSelector((state) => state.registry.records);
|
|
15
|
+
const [loginUrl, setLoginUrl] = React.useState('');
|
|
16
|
+
const registry_key = config.settings?.registry?.login_url || null;
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (registryRecords && registry_key in registryRecords) {
|
|
20
|
+
setLoginUrl(
|
|
21
|
+
registryRecords[registry_key] + '?came_from=' + window.location.href,
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}, [registryRecords, registry_key]);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<div className="ccl-container login">
|
|
29
|
+
<h1 className="page-title">Registration / Login</h1>
|
|
30
|
+
<div className="modal-login-text">
|
|
31
|
+
<p>
|
|
32
|
+
This site uses EU Login to handle user registration and login. You
|
|
33
|
+
can read more about this service in the{' '}
|
|
34
|
+
<a href="https://ecas.ec.europa.eu/cas/about.html">
|
|
35
|
+
EU Login site help
|
|
36
|
+
</a>
|
|
37
|
+
.
|
|
38
|
+
</p>
|
|
39
|
+
<p>
|
|
40
|
+
{' '}
|
|
41
|
+
When you clik on the following link, you will be sent to EU Login
|
|
42
|
+
and after a successful login there you will be redirected back to
|
|
43
|
+
this site.
|
|
44
|
+
</p>
|
|
45
|
+
<p>
|
|
46
|
+
If you have any issues or questions, please contact us using the
|
|
47
|
+
<a href="/en/contact-service-helpdesk"> helpdesk</a>.
|
|
48
|
+
</p>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div className="login-button">
|
|
52
|
+
<div className="modal-buttons">
|
|
53
|
+
<a
|
|
54
|
+
href={toPublicURL(loginUrl) || '#'}
|
|
55
|
+
className="ccl-button ccl-button-green"
|
|
56
|
+
>
|
|
57
|
+
Login using EU Login
|
|
58
|
+
</a>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
export default CLMSLoginView;
|
|
@@ -20,6 +20,10 @@ import { postMeetingRegister } from '../../actions';
|
|
|
20
20
|
import { toast } from 'react-toastify';
|
|
21
21
|
import { LightGalleryListing } from './CclLightGallery';
|
|
22
22
|
import CclListingCards from '@eeacms/volto-clms-theme/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards';
|
|
23
|
+
import config from '@plone/volto/registry';
|
|
24
|
+
import AnimateHeight from 'react-animate-height';
|
|
25
|
+
import { Accordion } from 'semantic-ui-react';
|
|
26
|
+
import { CLMSRelatedItems } from '../CLMSRelatedItems';
|
|
23
27
|
|
|
24
28
|
export const CLMSMeetingView = (props) => {
|
|
25
29
|
const { content, intl } = props;
|
|
@@ -109,15 +113,9 @@ export const CLMSMeetingView = (props) => {
|
|
|
109
113
|
);
|
|
110
114
|
history.push(props.location.pathname + '/form');
|
|
111
115
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
? content.items.map((item) => (item['@type'] === 'File' ? item : null))
|
|
116
|
-
: [];
|
|
117
|
-
const index = files.indexOf(null);
|
|
118
|
-
if (index > -1) {
|
|
119
|
-
files.splice(index, 1);
|
|
120
|
-
}
|
|
116
|
+
const files = content.items
|
|
117
|
+
? content.items.filter((item) => item['@type'] === 'File')
|
|
118
|
+
: [];
|
|
121
119
|
const RegistrationButton = ({ rContent, rMeeting_register, rIsLoggedIn }) => {
|
|
122
120
|
return (
|
|
123
121
|
<>
|
|
@@ -182,6 +180,36 @@ export const CLMSMeetingView = (props) => {
|
|
|
182
180
|
intl.formatMessage(messages.no_fullname_customfield),
|
|
183
181
|
);
|
|
184
182
|
|
|
183
|
+
const [activeIndex, setActiveIndex] = React.useState([99]);
|
|
184
|
+
|
|
185
|
+
const handleClick = ({ index }) => {
|
|
186
|
+
const newIndex =
|
|
187
|
+
activeIndex.indexOf(index) === -1
|
|
188
|
+
? [...activeIndex, index]
|
|
189
|
+
: activeIndex.filter((item) => item !== index);
|
|
190
|
+
|
|
191
|
+
setActiveIndex(newIndex);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const [activeDatasetIndex, setActiveDatasetIndex] = React.useState([99]);
|
|
195
|
+
|
|
196
|
+
const handleDatasetClick = ({ datasetindex }) => {
|
|
197
|
+
const newDatasetIndex =
|
|
198
|
+
activeDatasetIndex.indexOf(datasetindex) === -1
|
|
199
|
+
? [...activeDatasetIndex, datasetindex]
|
|
200
|
+
: activeDatasetIndex.filter((item) => item !== datasetindex);
|
|
201
|
+
|
|
202
|
+
setActiveDatasetIndex(newDatasetIndex);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const titleIcons = config.blocks?.blocksConfig?.accordion?.titleIcons;
|
|
206
|
+
|
|
207
|
+
function iconName(iconData, iTitleIcons) {
|
|
208
|
+
return iconData?.right_arrows
|
|
209
|
+
? iTitleIcons.rightPosition
|
|
210
|
+
: iTitleIcons.leftPosition;
|
|
211
|
+
}
|
|
212
|
+
|
|
185
213
|
return (
|
|
186
214
|
<div className="ccl-container">
|
|
187
215
|
<h1 className="page-title">{content.title}</h1>
|
|
@@ -392,6 +420,7 @@ export const CLMSMeetingView = (props) => {
|
|
|
392
420
|
)}
|
|
393
421
|
<StringToHTML string={content.text?.data || ''} />
|
|
394
422
|
<LightGalleryListing />
|
|
423
|
+
|
|
395
424
|
{files.length > 0 && (
|
|
396
425
|
<CclListingCards
|
|
397
426
|
variation="file"
|
|
@@ -399,6 +428,63 @@ export const CLMSMeetingView = (props) => {
|
|
|
399
428
|
linkHref={`${files['@id']}/@@download/file`}
|
|
400
429
|
/>
|
|
401
430
|
)}
|
|
431
|
+
<div className="dataset-info-documents dropdown">
|
|
432
|
+
<div className="accordion-block"></div>
|
|
433
|
+
{content?.products?.length > 0 && (
|
|
434
|
+
<Accordion fluid styled>
|
|
435
|
+
<Accordion.Title
|
|
436
|
+
as={'h2'}
|
|
437
|
+
onClick={() => handleClick({ index: 0 })}
|
|
438
|
+
className={'accordion-title align-arrow-right'}
|
|
439
|
+
>
|
|
440
|
+
{activeIndex.includes(0) ? (
|
|
441
|
+
<Icon
|
|
442
|
+
name={iconName(content, titleIcons.opened)}
|
|
443
|
+
size="24px"
|
|
444
|
+
/>
|
|
445
|
+
) : (
|
|
446
|
+
<Icon
|
|
447
|
+
name={iconName(content, titleIcons.closed)}
|
|
448
|
+
size="24px"
|
|
449
|
+
/>
|
|
450
|
+
)}
|
|
451
|
+
<span>Related products</span>
|
|
452
|
+
</Accordion.Title>
|
|
453
|
+
<Accordion.Content active={activeIndex.includes(0)}>
|
|
454
|
+
<AnimateHeight animateOpacity duration={500} height={'auto'}>
|
|
455
|
+
<CLMSRelatedItems items={content.products} />
|
|
456
|
+
</AnimateHeight>
|
|
457
|
+
</Accordion.Content>
|
|
458
|
+
</Accordion>
|
|
459
|
+
)}
|
|
460
|
+
{content?.datasets?.length > 0 && (
|
|
461
|
+
<Accordion fluid styled>
|
|
462
|
+
<Accordion.Title
|
|
463
|
+
as={'h2'}
|
|
464
|
+
onClick={() => handleDatasetClick({ datasetindex: 0 })}
|
|
465
|
+
className={'accordion-title align-arrow-right'}
|
|
466
|
+
>
|
|
467
|
+
{activeDatasetIndex.includes(0) ? (
|
|
468
|
+
<Icon
|
|
469
|
+
name={iconName(content, titleIcons.opened)}
|
|
470
|
+
size="24px"
|
|
471
|
+
/>
|
|
472
|
+
) : (
|
|
473
|
+
<Icon
|
|
474
|
+
name={iconName(content, titleIcons.closed)}
|
|
475
|
+
size="24px"
|
|
476
|
+
/>
|
|
477
|
+
)}
|
|
478
|
+
<span>Related datasets</span>
|
|
479
|
+
</Accordion.Title>
|
|
480
|
+
<Accordion.Content active={activeDatasetIndex.includes(0)}>
|
|
481
|
+
<AnimateHeight animateOpacity duration={500} height={'auto'}>
|
|
482
|
+
<CLMSRelatedItems items={content.datasets} />
|
|
483
|
+
</AnimateHeight>
|
|
484
|
+
</Accordion.Content>
|
|
485
|
+
</Accordion>
|
|
486
|
+
)}
|
|
487
|
+
</div>
|
|
402
488
|
</Segment>
|
|
403
489
|
</div>
|
|
404
490
|
);
|
|
@@ -5,16 +5,47 @@ import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
|
|
|
5
5
|
import { cclDateTimeFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
|
|
6
6
|
import { LightGalleryListing } from '@eeacms/volto-clms-theme/components/CLMSMeetingView/CclLightGallery';
|
|
7
7
|
import CclListingCards from '@eeacms/volto-clms-theme/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards';
|
|
8
|
+
import config from '@plone/volto/registry';
|
|
9
|
+
import { Icon } from '@plone/volto/components';
|
|
10
|
+
import AnimateHeight from 'react-animate-height';
|
|
11
|
+
import { Accordion } from 'semantic-ui-react';
|
|
12
|
+
import { CLMSRelatedItems } from '../CLMSRelatedItems';
|
|
13
|
+
|
|
8
14
|
const CLMSNewsItemView = (props) => {
|
|
9
15
|
const { content } = props;
|
|
10
|
-
const files =
|
|
11
|
-
content.items
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
const files = content.items
|
|
17
|
+
? content.items.filter((item) => item['@type'] === 'File')
|
|
18
|
+
: [];
|
|
19
|
+
const [activeIndex, setActiveIndex] = React.useState([99]);
|
|
20
|
+
|
|
21
|
+
const handleClick = ({ index }) => {
|
|
22
|
+
const newIndex =
|
|
23
|
+
activeIndex.indexOf(index) === -1
|
|
24
|
+
? [...activeIndex, index]
|
|
25
|
+
: activeIndex.filter((item) => item !== index);
|
|
26
|
+
|
|
27
|
+
setActiveIndex(newIndex);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const [activeDatasetIndex, setActiveDatasetIndex] = React.useState([99]);
|
|
31
|
+
|
|
32
|
+
const handleDatasetClick = ({ datasetindex }) => {
|
|
33
|
+
const newDatasetIndex =
|
|
34
|
+
activeDatasetIndex.indexOf(datasetindex) === -1
|
|
35
|
+
? [...activeDatasetIndex, datasetindex]
|
|
36
|
+
: activeDatasetIndex.filter((item) => item !== datasetindex);
|
|
37
|
+
|
|
38
|
+
setActiveDatasetIndex(newDatasetIndex);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const titleIcons = config.blocks?.blocksConfig?.accordion?.titleIcons;
|
|
42
|
+
|
|
43
|
+
function iconName(iconData, iTitleIcons) {
|
|
44
|
+
return iconData?.right_arrows
|
|
45
|
+
? iTitleIcons.rightPosition
|
|
46
|
+
: iTitleIcons.leftPosition;
|
|
17
47
|
}
|
|
48
|
+
|
|
18
49
|
return (
|
|
19
50
|
<div className="ccl-container">
|
|
20
51
|
{hasBlocksData(content) && content.blocks_layout?.items?.length > 4 ? (
|
|
@@ -45,16 +76,58 @@ const CLMSNewsItemView = (props) => {
|
|
|
45
76
|
<StringToHTML string={content.text?.data || ''} />
|
|
46
77
|
</div>
|
|
47
78
|
<LightGalleryListing />
|
|
48
|
-
{files.length > 0 && (
|
|
49
|
-
<CclListingCards
|
|
50
|
-
variation="file"
|
|
51
|
-
items={files}
|
|
52
|
-
linkHref={`${files['@id']}/@@download/file`}
|
|
53
|
-
/>
|
|
54
|
-
)}
|
|
55
79
|
</div>
|
|
56
80
|
</>
|
|
57
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
|
+
)}
|
|
58
131
|
</div>
|
|
59
132
|
);
|
|
60
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 };
|