@eeacms/volto-cca-policy 0.3.43 → 0.3.45
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 +44 -0
- package/package.json +1 -1
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerView.js +1 -1
- package/src/components/manage/Blocks/Listing/DropdownListingView.test.jsx +10 -27
- package/src/components/manage/Blocks/Listing/EventAccordionListingView.jsx +123 -0
- package/src/components/manage/Blocks/Listing/EventAccordionListingView.test.jsx +101 -0
- package/src/components/manage/Blocks/Listing/index.js +8 -0
- package/src/components/manage/Blocks/Listing/styles.less +19 -0
- package/src/components/theme/MissionSignatoryProfile/TabSections/ActionPagesTab.jsx +6 -4
- package/src/components/theme/MissionSignatoryProfile/TabSections/AssessmentTab.jsx +23 -7
- package/src/components/theme/MissionSignatoryProfile/TabSections/GovernanceTab.jsx +11 -2
- package/src/components/theme/MissionSignatoryProfile/TabSections/PlanningTab.jsx +17 -1
- package/src/constants.js +1 -1
- package/src/customizations/volto/components/theme/Footer/Footer.jsx +96 -0
- package/src/index.js +4 -0
- package/src/search/common.js +1 -1
- package/theme/globals/mission.less +4 -2
- package/theme/globals/site.overrides +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,42 @@ 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
|
+
### [0.3.45](https://github.com/eea/volto-cca-policy/compare/0.3.44...0.3.45) - 21 May 2025
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: add event accordion listing view - refs #286702 [kreafox - [`47b26e1`](https://github.com/eea/volto-cca-policy/commit/47b26e14d80e8a7bb0e067d9ffda87b7c028601a)]
|
|
12
|
+
|
|
13
|
+
#### :nail_care: Enhancements
|
|
14
|
+
|
|
15
|
+
- change: add Footer customization - refs #287013 [kreafox - [`875f5ab`](https://github.com/eea/volto-cca-policy/commit/875f5ab3bdf16fd2446757fd6949f9bf65eeaa96)]
|
|
16
|
+
|
|
17
|
+
#### :house: Internal changes
|
|
18
|
+
|
|
19
|
+
- style: Automated code fix [eea-jenkins - [`dc669ad`](https://github.com/eea/volto-cca-policy/commit/dc669ad88e0568b83821e99c3bc31066c3624261)]
|
|
20
|
+
- style: small css adjustments [kreafox - [`b93f7bb`](https://github.com/eea/volto-cca-policy/commit/b93f7bb521fbd2ecbb4245d5c07141ec8f4a74fd)]
|
|
21
|
+
|
|
22
|
+
#### :hammer_and_wrench: Others
|
|
23
|
+
|
|
24
|
+
- test: add tests to increase code coverage [kreafox - [`68fb5dc`](https://github.com/eea/volto-cca-policy/commit/68fb5dc83c58a77efa4f87cae4822758c93242e4)]
|
|
25
|
+
- Refs #284995 - add description [Tripon Eugen - [`9a2aa38`](https://github.com/eea/volto-cca-policy/commit/9a2aa38e4d0879acbcdedfdb95b08b1bf8ae6650)]
|
|
26
|
+
- Refs #284995 - add description [Tripon Eugen - [`2378952`](https://github.com/eea/volto-cca-policy/commit/2378952ca23bc4e4eae74445bec9a08869f6b8d7)]
|
|
27
|
+
### [0.3.44](https://github.com/eea/volto-cca-policy/compare/0.3.43...0.3.44) - 16 May 2025
|
|
28
|
+
|
|
29
|
+
#### :bug: Bug Fixes
|
|
30
|
+
|
|
31
|
+
- fix(mission): fix actions fallback [kreafox - [`4868c71`](https://github.com/eea/volto-cca-policy/commit/4868c71eb3658b0eaac7946274fb8b4d5cd3c698)]
|
|
32
|
+
- fix(mission): default result to empty object [kreafox - [`1a4adbd`](https://github.com/eea/volto-cca-policy/commit/1a4adbd8203c36fb51be6060403e5ae683f1a47c)]
|
|
33
|
+
|
|
34
|
+
#### :nail_care: Enhancements
|
|
35
|
+
|
|
36
|
+
- change(mission): small update [kreafox - [`8314492`](https://github.com/eea/volto-cca-policy/commit/8314492b334a1ab523b1bd10497da1806460282d)]
|
|
37
|
+
- change(mission): update data for Assessment section - refs #286757 [kreafox - [`eeede94`](https://github.com/eea/volto-cca-policy/commit/eeede943d1f87e66d8688acabb4be051e37cea10)]
|
|
38
|
+
- change(mission): add fallback when results are empty [kreafox - [`4316e12`](https://github.com/eea/volto-cca-policy/commit/4316e122fb1f89582a70e8c5f33b57583d275001)]
|
|
39
|
+
|
|
40
|
+
#### :hammer_and_wrench: Others
|
|
41
|
+
|
|
42
|
+
- Show different message [Tiberiu Ichim - [`714bda0`](https://github.com/eea/volto-cca-policy/commit/714bda05dc7e8b5738a6bbd4a9b493e637e8b142)]
|
|
7
43
|
### [0.3.43](https://github.com/eea/volto-cca-policy/compare/0.3.42...0.3.43) - 16 May 2025
|
|
8
44
|
|
|
9
45
|
#### :bug: Bug Fixes
|
|
@@ -2371,10 +2407,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
2371
2407
|
- Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
|
|
2372
2408
|
- Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
|
|
2373
2409
|
- Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
|
|
2410
|
+
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
|
|
2411
|
+
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
|
|
2374
2412
|
### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
|
|
2375
2413
|
|
|
2376
2414
|
#### :house: Internal changes
|
|
2377
2415
|
|
|
2416
|
+
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
|
|
2378
2417
|
- chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
|
|
2379
2418
|
|
|
2380
2419
|
#### :hammer_and_wrench: Others
|
|
@@ -2391,6 +2430,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
2391
2430
|
- Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
|
|
2392
2431
|
- Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
|
|
2393
2432
|
- Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
|
|
2433
|
+
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
|
|
2434
|
+
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
|
|
2435
|
+
- test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
|
|
2394
2436
|
- Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
|
|
2395
2437
|
- Refs #256681 - Fix error in CCA Event view menu. ([React Intl] An id must be provided to format a message.) [GhitaB - [`517eeb8`](https://github.com/eea/volto-cca-policy/commit/517eeb817264a47bbfd6b9b7d22aaf22d44ed224)]
|
|
2396
2438
|
- Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
|
|
@@ -2607,6 +2649,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
2607
2649
|
|
|
2608
2650
|
#### :house: Internal changes
|
|
2609
2651
|
|
|
2652
|
+
- chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
|
|
2610
2653
|
|
|
2611
2654
|
#### :hammer_and_wrench: Others
|
|
2612
2655
|
|
|
@@ -3087,6 +3130,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
3087
3130
|
#### :hammer_and_wrench: Others
|
|
3088
3131
|
|
|
3089
3132
|
- Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
|
|
3133
|
+
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
|
|
3090
3134
|
### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
|
|
3091
3135
|
|
|
3092
3136
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -73,7 +73,7 @@ export default function CaseStudyExplorerView(props) {
|
|
|
73
73
|
}, [activeFilters, cases]);
|
|
74
74
|
|
|
75
75
|
if (__SERVER__)
|
|
76
|
-
return <div className="casestudy-explorer-map">
|
|
76
|
+
return <div className="casestudy-explorer-map">Loading...</div>;
|
|
77
77
|
|
|
78
78
|
return (
|
|
79
79
|
<div className="casestudy-explorer-map">
|
|
@@ -1,35 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { MemoryRouter } from 'react-router-dom';
|
|
3
2
|
import configureStore from 'redux-mock-store';
|
|
4
|
-
import
|
|
5
|
-
import '@testing-library/jest-dom
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
6
5
|
import { Provider } from 'react-intl-redux';
|
|
7
6
|
import DropdownListingView from './DropdownListingView';
|
|
8
|
-
import config from '@plone/volto/registry';
|
|
9
|
-
|
|
10
|
-
config.blocks = {
|
|
11
|
-
blocksConfig: {
|
|
12
|
-
contentLinks: {
|
|
13
|
-
variations: [
|
|
14
|
-
{
|
|
15
|
-
id: 'default',
|
|
16
|
-
title: 'Simple list (default)',
|
|
17
|
-
isDefault: true,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
id: 'navigationList',
|
|
21
|
-
title: 'Navigation list',
|
|
22
|
-
isDefault: false,
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
7
|
|
|
29
8
|
const mockStore = configureStore();
|
|
30
9
|
|
|
31
10
|
describe('DropdownListingView', () => {
|
|
32
|
-
it('
|
|
11
|
+
it('renders dropdown with items', () => {
|
|
33
12
|
const data = {
|
|
34
13
|
'@type': 'listing',
|
|
35
14
|
items: [
|
|
@@ -54,14 +33,18 @@ describe('DropdownListingView', () => {
|
|
|
54
33
|
},
|
|
55
34
|
});
|
|
56
35
|
|
|
57
|
-
|
|
36
|
+
render(
|
|
58
37
|
<Provider store={store}>
|
|
59
38
|
<MemoryRouter>
|
|
60
39
|
<DropdownListingView {...data} />
|
|
61
40
|
</MemoryRouter>
|
|
62
41
|
</Provider>,
|
|
63
42
|
);
|
|
64
|
-
|
|
65
|
-
|
|
43
|
+
|
|
44
|
+
// Check the placeholder text is present
|
|
45
|
+
expect(screen.getByText('Select')).toBeInTheDocument();
|
|
46
|
+
|
|
47
|
+
expect(screen.getAllByText('Item 1').length).toBeGreaterThan(0);
|
|
48
|
+
expect(screen.getAllByText('Item 2').length).toBeGreaterThan(0);
|
|
66
49
|
});
|
|
67
50
|
});
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
import { useSelector } from 'react-redux';
|
|
5
|
+
import { Icon, Accordion, Button } from 'semantic-ui-react';
|
|
6
|
+
import { ConditionalLink } from '@plone/volto/components';
|
|
7
|
+
import { When } from '@plone/volto/components/theme/View/EventDatesInfo';
|
|
8
|
+
|
|
9
|
+
import './styles.less';
|
|
10
|
+
|
|
11
|
+
function formatDateRange(startStr, endStr, locale = 'en') {
|
|
12
|
+
if (!startStr || !endStr) return null;
|
|
13
|
+
|
|
14
|
+
const startDate = new Date(startStr);
|
|
15
|
+
const endDate = new Date(endStr);
|
|
16
|
+
|
|
17
|
+
if (isNaN(startDate) || isNaN(endDate)) return null;
|
|
18
|
+
|
|
19
|
+
const sameDay = startDate.toDateString() === endDate.toDateString();
|
|
20
|
+
const sameMonth = startDate.getMonth() === endDate.getMonth();
|
|
21
|
+
const sameYear = startDate.getFullYear() === endDate.getFullYear();
|
|
22
|
+
|
|
23
|
+
const day = (date) => date.toLocaleDateString(locale, { day: 'numeric' });
|
|
24
|
+
|
|
25
|
+
const month = (date) => date.toLocaleDateString(locale, { month: 'long' });
|
|
26
|
+
|
|
27
|
+
const year = (date) => date.toLocaleDateString(locale, { year: 'numeric' });
|
|
28
|
+
|
|
29
|
+
if (sameDay) {
|
|
30
|
+
return `${day(startDate)} ${month(startDate)} ${year(startDate)}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (sameMonth && sameYear) {
|
|
34
|
+
return `${day(startDate)} - ${day(endDate)} ${month(endDate)} ${year(
|
|
35
|
+
endDate,
|
|
36
|
+
)}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (sameYear) {
|
|
40
|
+
return `${day(startDate)} ${month(startDate)} - ${day(endDate)} ${month(
|
|
41
|
+
endDate,
|
|
42
|
+
)} ${year(endDate)}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Different years
|
|
46
|
+
return `${day(startDate)} ${month(startDate)} ${year(startDate)} – ${day(
|
|
47
|
+
endDate,
|
|
48
|
+
)} ${month(endDate)} ${year(endDate)}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const EventAccordionListingView = ({ items, isEditMode }) => {
|
|
52
|
+
const currentLang = useSelector((state) => state.intl.locale);
|
|
53
|
+
const [activeIndex, setActiveIndex] = React.useState(-1);
|
|
54
|
+
const handleAccordionClick = (index) => {
|
|
55
|
+
setActiveIndex(activeIndex === index ? -1 : index);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div className="ui fluid event-accordion-view">
|
|
60
|
+
<Accordion className="primary">
|
|
61
|
+
{items.map((item, index) => {
|
|
62
|
+
const formattedDate = formatDateRange(
|
|
63
|
+
item.start,
|
|
64
|
+
item.end,
|
|
65
|
+
currentLang,
|
|
66
|
+
);
|
|
67
|
+
return (
|
|
68
|
+
<React.Fragment key={item.UID}>
|
|
69
|
+
<Accordion.Title
|
|
70
|
+
active={activeIndex === index}
|
|
71
|
+
onClick={() => handleAccordionClick(index)}
|
|
72
|
+
>
|
|
73
|
+
<Icon
|
|
74
|
+
className={
|
|
75
|
+
activeIndex === index
|
|
76
|
+
? 'ri-arrow-up-s-line'
|
|
77
|
+
: 'ri-arrow-down-s-line'
|
|
78
|
+
}
|
|
79
|
+
/>
|
|
80
|
+
<div>
|
|
81
|
+
<div className="listing-header">
|
|
82
|
+
{item?.start && <span>{formattedDate}</span>}
|
|
83
|
+
{item.location && <> - {item.location}</>}
|
|
84
|
+
</div>
|
|
85
|
+
<div>{item.title}</div>
|
|
86
|
+
</div>
|
|
87
|
+
</Accordion.Title>
|
|
88
|
+
<Accordion.Content active={activeIndex === index}>
|
|
89
|
+
{item?.description && (
|
|
90
|
+
<p className="listing-description">{item.description}</p>
|
|
91
|
+
)}
|
|
92
|
+
|
|
93
|
+
<div className="bottom-info">
|
|
94
|
+
<ConditionalLink item={item} condition={!isEditMode}>
|
|
95
|
+
<Button inverted primary>
|
|
96
|
+
<FormattedMessage
|
|
97
|
+
id="Learn more"
|
|
98
|
+
defaultMessage="Learn more"
|
|
99
|
+
/>
|
|
100
|
+
</Button>
|
|
101
|
+
</ConditionalLink>
|
|
102
|
+
<When
|
|
103
|
+
start={item.start}
|
|
104
|
+
end={item.end}
|
|
105
|
+
whole_day={item.whole_day}
|
|
106
|
+
open_end={item.open_end}
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</Accordion.Content>
|
|
110
|
+
</React.Fragment>
|
|
111
|
+
);
|
|
112
|
+
})}
|
|
113
|
+
</Accordion>
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
EventAccordionListingView.propTypes = {
|
|
119
|
+
items: PropTypes.arrayOf(PropTypes.any).isRequired,
|
|
120
|
+
isEditMode: PropTypes.bool,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export default EventAccordionListingView;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
4
|
+
import configureStore from 'redux-mock-store';
|
|
5
|
+
import { Provider } from 'react-intl-redux';
|
|
6
|
+
import EventAccordionListingView from './EventAccordionListingView';
|
|
7
|
+
|
|
8
|
+
const mockStore = configureStore();
|
|
9
|
+
|
|
10
|
+
jest.mock('@plone/volto/components', () => ({
|
|
11
|
+
ConditionalLink: ({ children }) => <div>{children}</div>,
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
jest.mock('@plone/volto/components/theme/View/EventDatesInfo', () => ({
|
|
15
|
+
When: () => <div>Event Date Info</div>,
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
describe('EventAccordionListingView', () => {
|
|
19
|
+
let store;
|
|
20
|
+
const items = [
|
|
21
|
+
{
|
|
22
|
+
UID: 'event-123',
|
|
23
|
+
title: 'Test Event One',
|
|
24
|
+
description: 'Details about Event One',
|
|
25
|
+
start: '2025-05-20T10:00:00',
|
|
26
|
+
end: '2025-05-20T12:00:00',
|
|
27
|
+
location: 'Hall A',
|
|
28
|
+
whole_day: false,
|
|
29
|
+
open_end: false,
|
|
30
|
+
'@id': '/event-1',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
UID: 'event-456',
|
|
34
|
+
title: 'Test Event Two',
|
|
35
|
+
description: 'Details about Event Two',
|
|
36
|
+
start: '2025-06-10T09:00:00',
|
|
37
|
+
end: '2025-06-10T11:00:00',
|
|
38
|
+
location: 'Room B',
|
|
39
|
+
whole_day: false,
|
|
40
|
+
open_end: false,
|
|
41
|
+
'@id': '/event-2',
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
beforeEach(() => {
|
|
46
|
+
store = mockStore({
|
|
47
|
+
intl: {
|
|
48
|
+
locale: 'en',
|
|
49
|
+
messages: {},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('renders all event titles', () => {
|
|
55
|
+
render(
|
|
56
|
+
<Provider store={store}>
|
|
57
|
+
<MemoryRouter>
|
|
58
|
+
<EventAccordionListingView items={items} isEditMode={false} />
|
|
59
|
+
</MemoryRouter>
|
|
60
|
+
</Provider>,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
expect(screen.getByText('Test Event One')).toBeInTheDocument();
|
|
64
|
+
expect(screen.getByText('Test Event Two')).toBeInTheDocument();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('toggles accordion content on title click', () => {
|
|
68
|
+
render(
|
|
69
|
+
<Provider store={store}>
|
|
70
|
+
<MemoryRouter>
|
|
71
|
+
<EventAccordionListingView items={items} isEditMode={false} />
|
|
72
|
+
</MemoryRouter>
|
|
73
|
+
</Provider>,
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const title = screen.getByText('Test Event One');
|
|
77
|
+
expect(title.closest('.title')).toHaveClass('title');
|
|
78
|
+
expect(title.closest('.title')).not.toHaveClass('active');
|
|
79
|
+
|
|
80
|
+
fireEvent.click(title);
|
|
81
|
+
|
|
82
|
+
expect(title.closest('.title')).toHaveClass('active');
|
|
83
|
+
|
|
84
|
+
expect(screen.getByText('Details about Event One')).toBeInTheDocument();
|
|
85
|
+
|
|
86
|
+
fireEvent.click(title);
|
|
87
|
+
expect(title.closest('.title')).not.toHaveClass('active');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('renders Learn more buttons', () => {
|
|
91
|
+
render(
|
|
92
|
+
<Provider store={store}>
|
|
93
|
+
<MemoryRouter>
|
|
94
|
+
<EventAccordionListingView items={items} isEditMode={false} />
|
|
95
|
+
</MemoryRouter>
|
|
96
|
+
</Provider>,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
expect(screen.getAllByText('Learn more')).toHaveLength(2);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
@@ -2,6 +2,7 @@ import OrganisationCardsListingView from './OrganisationCardsListingView';
|
|
|
2
2
|
import IndicatorCardsListingView from './IndicatorCardsListingView';
|
|
3
3
|
import EventCardsListingView from './EventCardsListingView';
|
|
4
4
|
import DropdownListingView from './DropdownListingView';
|
|
5
|
+
import EventAccordionListingView from './EventAccordionListingView';
|
|
5
6
|
|
|
6
7
|
export default function installListing(config) {
|
|
7
8
|
config.blocks.blocksConfig.listing = {
|
|
@@ -43,6 +44,13 @@ export default function installListing(config) {
|
|
|
43
44
|
isDefault: false,
|
|
44
45
|
fullobjects: true,
|
|
45
46
|
},
|
|
47
|
+
{
|
|
48
|
+
id: 'eventAccordion',
|
|
49
|
+
title: 'Event Accordion',
|
|
50
|
+
template: EventAccordionListingView,
|
|
51
|
+
isDefault: false,
|
|
52
|
+
fullobjects: true,
|
|
53
|
+
},
|
|
46
54
|
],
|
|
47
55
|
};
|
|
48
56
|
|
|
@@ -142,3 +142,22 @@ div.indicatorCards {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
+
|
|
146
|
+
.event-accordion-view {
|
|
147
|
+
.listing-header {
|
|
148
|
+
font-weight: bold;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.bottom-info {
|
|
152
|
+
display: flex;
|
|
153
|
+
flex-wrap: wrap;
|
|
154
|
+
align-items: center;
|
|
155
|
+
justify-content: flex-start;
|
|
156
|
+
margin-top: 2em;
|
|
157
|
+
gap: 1em;
|
|
158
|
+
|
|
159
|
+
p {
|
|
160
|
+
margin: 0;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -4,6 +4,8 @@ import { HTMLField } from '@eeacms/volto-cca-policy/helpers';
|
|
|
4
4
|
import { formatTextToHTML } from '@eeacms/volto-cca-policy/utils';
|
|
5
5
|
import AccordionList from '../AccordionList';
|
|
6
6
|
|
|
7
|
+
const isEmpty = (arr) => !Array.isArray(arr) || arr.length === 0;
|
|
8
|
+
|
|
7
9
|
const ActionsTabContent = ({ action }) => {
|
|
8
10
|
const hasHazards = action?.Climate_Hazards?.length > 0;
|
|
9
11
|
const hasSectors = action?.Sectors.length > 0;
|
|
@@ -69,15 +71,15 @@ const ActionPagesTab = ({ result, general_text }) => {
|
|
|
69
71
|
const { action_text, actions } = result || {};
|
|
70
72
|
const { No_Data_Reported_Label } = general_text || {};
|
|
71
73
|
const { Title, Abstract, Abstract_Line } = action_text?.[0] || {};
|
|
72
|
-
const hasNoActions = !(actions?.length > 0);
|
|
73
|
-
const hasNoText = !(action_text?.length > 0);
|
|
74
74
|
|
|
75
75
|
const sortedActions = [...(actions || [])].sort((a, b) => a.Order - b.Order);
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
const NoResults = isEmpty(action_text) && isEmpty(actions);
|
|
78
|
+
|
|
79
|
+
if (NoResults) {
|
|
78
80
|
return (
|
|
79
81
|
<Tab.Pane>
|
|
80
|
-
<
|
|
82
|
+
<p>{No_Data_Reported_Label}</p>
|
|
81
83
|
</Tab.Pane>
|
|
82
84
|
);
|
|
83
85
|
}
|
|
@@ -6,6 +6,8 @@ import AccordionList from '../AccordionList';
|
|
|
6
6
|
|
|
7
7
|
import image from '@eeacms/volto-cca-policy/../theme//assets/images/image-narrow.svg';
|
|
8
8
|
|
|
9
|
+
const isEmpty = (arr) => !Array.isArray(arr) || arr.length === 0;
|
|
10
|
+
|
|
9
11
|
const ItemsSection = ({ items }) => {
|
|
10
12
|
if (!items?.length) return null;
|
|
11
13
|
|
|
@@ -45,7 +47,7 @@ const AssessmentAccordionContent = ({ result }) => {
|
|
|
45
47
|
);
|
|
46
48
|
};
|
|
47
49
|
|
|
48
|
-
const AssessmentTab = ({ result }) => {
|
|
50
|
+
const AssessmentTab = ({ result, general_text }) => {
|
|
49
51
|
const {
|
|
50
52
|
Title,
|
|
51
53
|
Subheading,
|
|
@@ -55,12 +57,26 @@ const AssessmentTab = ({ result }) => {
|
|
|
55
57
|
Attachments,
|
|
56
58
|
Hazards_Title,
|
|
57
59
|
Hazards_Abstract,
|
|
58
|
-
} = result.assessment_text?.[0] ||
|
|
60
|
+
} = result.assessment_text?.[0] || {};
|
|
59
61
|
const assessment_risks = result.assessment_risks || [];
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
+
const assessment_hazards_sectors = result.assessment_hazards_sectors || [];
|
|
63
|
+
const { No_Data_Reported_Label } = general_text || {};
|
|
62
64
|
// const [activeIndex, setActiveIndex] = React.useState(0);
|
|
63
65
|
|
|
66
|
+
const NoResults =
|
|
67
|
+
isEmpty(result.assessment_text) &&
|
|
68
|
+
isEmpty(result.assessment_factors) &&
|
|
69
|
+
isEmpty(result.assessment_risks) &&
|
|
70
|
+
isEmpty(result.assessment_hazards_sectors);
|
|
71
|
+
|
|
72
|
+
if (NoResults) {
|
|
73
|
+
return (
|
|
74
|
+
<Tab.Pane>
|
|
75
|
+
<p>{No_Data_Reported_Label}</p>
|
|
76
|
+
</Tab.Pane>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
64
80
|
return (
|
|
65
81
|
<Tab.Pane>
|
|
66
82
|
{Title && <h2>{Title}</h2>}
|
|
@@ -110,10 +126,10 @@ const AssessmentTab = ({ result }) => {
|
|
|
110
126
|
|
|
111
127
|
<br />
|
|
112
128
|
|
|
113
|
-
{
|
|
129
|
+
{assessment_hazards_sectors && (
|
|
114
130
|
<AccordionList
|
|
115
|
-
accordions={
|
|
116
|
-
title: category.
|
|
131
|
+
accordions={assessment_hazards_sectors.map((category) => ({
|
|
132
|
+
title: category.Hazard,
|
|
117
133
|
content: (
|
|
118
134
|
<ul>
|
|
119
135
|
{category.Sectors.map((sector, idx) => (
|
|
@@ -5,7 +5,7 @@ import { formatTextToHTML } from '@eeacms/volto-cca-policy/utils';
|
|
|
5
5
|
import AccordionList from '../AccordionList';
|
|
6
6
|
import StatisticSection from '../StatisticSection';
|
|
7
7
|
|
|
8
|
-
const GovernanceTab = ({ result }) => {
|
|
8
|
+
const GovernanceTab = ({ result, general_text }) => {
|
|
9
9
|
const {
|
|
10
10
|
Title,
|
|
11
11
|
Introduction,
|
|
@@ -21,7 +21,8 @@ const GovernanceTab = ({ result }) => {
|
|
|
21
21
|
Statistic_Population_Size_Label,
|
|
22
22
|
Statistic_Population_Year,
|
|
23
23
|
Statistic_Population_Year_Label,
|
|
24
|
-
} = result;
|
|
24
|
+
} = result || {};
|
|
25
|
+
const { No_Data_Reported_Label } = general_text || {};
|
|
25
26
|
|
|
26
27
|
const statisticData = [
|
|
27
28
|
{
|
|
@@ -42,6 +43,14 @@ const GovernanceTab = ({ result }) => {
|
|
|
42
43
|
},
|
|
43
44
|
].filter((stat) => stat.value && stat.label);
|
|
44
45
|
|
|
46
|
+
if (!result) {
|
|
47
|
+
return (
|
|
48
|
+
<Tab.Pane>
|
|
49
|
+
<p>{No_Data_Reported_Label}</p>
|
|
50
|
+
</Tab.Pane>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
return (
|
|
46
55
|
<Tab.Pane>
|
|
47
56
|
{Title && <h2>{Title}</h2>}
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
import AccordionList from '../AccordionList';
|
|
10
10
|
import image from '@eeacms/volto-cca-policy/../theme/assets/images/image-narrow.svg';
|
|
11
11
|
|
|
12
|
+
const isEmpty = (arr) => !Array.isArray(arr) || arr.length === 0;
|
|
13
|
+
|
|
12
14
|
const ItemsSection = ({ items }) => {
|
|
13
15
|
if (!items?.length) return null;
|
|
14
16
|
|
|
@@ -69,12 +71,13 @@ const PlanningGoalContent = ({ goal }) => {
|
|
|
69
71
|
);
|
|
70
72
|
};
|
|
71
73
|
|
|
72
|
-
const PlanningTab = ({ result }) => {
|
|
74
|
+
const PlanningTab = ({ result, general_text }) => {
|
|
73
75
|
const {
|
|
74
76
|
planning_goals = [],
|
|
75
77
|
planning_titles = [],
|
|
76
78
|
planning_climate_action = [],
|
|
77
79
|
} = result || {};
|
|
80
|
+
const { No_Data_Reported_Label } = general_text || {};
|
|
78
81
|
|
|
79
82
|
const titleData = planning_titles?.[0];
|
|
80
83
|
const goalData = planning_goals?.[0];
|
|
@@ -85,6 +88,19 @@ const PlanningTab = ({ result }) => {
|
|
|
85
88
|
return aNum - bNum;
|
|
86
89
|
});
|
|
87
90
|
|
|
91
|
+
const NoResults =
|
|
92
|
+
isEmpty(planning_goals) &&
|
|
93
|
+
isEmpty(planning_titles) &&
|
|
94
|
+
isEmpty(planning_climate_action);
|
|
95
|
+
|
|
96
|
+
if (NoResults) {
|
|
97
|
+
return (
|
|
98
|
+
<Tab.Pane>
|
|
99
|
+
<p>{No_Data_Reported_Label}</p>
|
|
100
|
+
</Tab.Pane>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
88
104
|
return (
|
|
89
105
|
<Tab.Pane>
|
|
90
106
|
{titleData?.Title && <h2>{titleData.Title}</h2>}
|
package/src/constants.js
CHANGED
|
@@ -6,6 +6,7 @@ export const download_fields = [
|
|
|
6
6
|
{ field: 'issued', name: 'Publication Date' },
|
|
7
7
|
{ field: 'creators', name: 'Creator' },
|
|
8
8
|
{ field: 'objectProvides', name: 'Content type' },
|
|
9
|
+
{ field: 'fulltext', name: 'Description' },
|
|
9
10
|
{ field: 'cca_keywords', name: 'Keywords' },
|
|
10
11
|
{ field: 'cca_adaptation_sectors', name: 'Sectors' },
|
|
11
12
|
{ field: 'cca_climate_impacts', name: 'Climate impact' },
|
|
@@ -17,7 +18,6 @@ export const download_fields = [
|
|
|
17
18
|
{ field: 'cca_origin_websites', name: 'Origin website' },
|
|
18
19
|
{ field: 'cca_health_impacts', name: 'Health impacts' },
|
|
19
20
|
{ field: 'cca_partner_contributors', name: 'Observatory impacts' },
|
|
20
|
-
// { field: 'fulltext', name: 'Description' },
|
|
21
21
|
];
|
|
22
22
|
|
|
23
23
|
export const eea_languages = [
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Footer component.
|
|
3
|
+
* @module components/theme/Footer/Footer
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { useSelector, shallowEqual } from 'react-redux';
|
|
8
|
+
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
9
|
+
import EEAFooter from '@eeacms/volto-eea-design-system/ui/Footer/Footer';
|
|
10
|
+
import config from '@plone/volto/registry';
|
|
11
|
+
import isArray from 'lodash/isArray';
|
|
12
|
+
|
|
13
|
+
const Footer = () => {
|
|
14
|
+
const { eea } = config.settings;
|
|
15
|
+
const {
|
|
16
|
+
footerActions,
|
|
17
|
+
copyrightActions,
|
|
18
|
+
socialActions,
|
|
19
|
+
contactActions,
|
|
20
|
+
contactExtraActions,
|
|
21
|
+
} = useSelector(
|
|
22
|
+
(state) => ({
|
|
23
|
+
footerActions: state.actions?.actions?.footer_actions,
|
|
24
|
+
copyrightActions: state.actions?.actions?.copyright_actions,
|
|
25
|
+
socialActions: state.actions?.actions?.social_actions,
|
|
26
|
+
contactActions: state.actions?.actions?.contact_actions,
|
|
27
|
+
contactExtraActions: state.actions?.actions?.contact_extra_actions,
|
|
28
|
+
}),
|
|
29
|
+
shallowEqual,
|
|
30
|
+
);
|
|
31
|
+
// ZMI > portal_actions > footer_actions
|
|
32
|
+
const actions = isArray(footerActions)
|
|
33
|
+
? footerActions.map((action) => ({
|
|
34
|
+
title: action.title,
|
|
35
|
+
url: flattenToAppURL(action.url),
|
|
36
|
+
}))
|
|
37
|
+
: eea.footerOpts.actions;
|
|
38
|
+
|
|
39
|
+
// ZMI > portal_actions > copyright_actions
|
|
40
|
+
const copyright = isArray(copyrightActions)
|
|
41
|
+
? copyrightActions.map((action) => ({
|
|
42
|
+
title: action.title,
|
|
43
|
+
site: action.title,
|
|
44
|
+
url: flattenToAppURL(action.url),
|
|
45
|
+
}))
|
|
46
|
+
: eea.footerOpts.copyright;
|
|
47
|
+
|
|
48
|
+
// ZMI > portal_actions > social_actions
|
|
49
|
+
const social = isArray(socialActions)
|
|
50
|
+
? socialActions.map((action) => ({
|
|
51
|
+
name: action.id,
|
|
52
|
+
icon: action.icon,
|
|
53
|
+
url: action.url,
|
|
54
|
+
}))
|
|
55
|
+
: eea.footerOpts.social;
|
|
56
|
+
|
|
57
|
+
// ZMI > portal_actions > contact_actions
|
|
58
|
+
const contacts = isArray(contactActions)
|
|
59
|
+
? contactActions.map((action, idx) => ({
|
|
60
|
+
text: action.title,
|
|
61
|
+
icon: action.icon,
|
|
62
|
+
url: flattenToAppURL(action.url),
|
|
63
|
+
children:
|
|
64
|
+
idx === 0
|
|
65
|
+
? (contactExtraActions || []).map((child) => ({
|
|
66
|
+
text: child.title,
|
|
67
|
+
icon: child.icon,
|
|
68
|
+
url: flattenToAppURL(child.url),
|
|
69
|
+
}))
|
|
70
|
+
: [],
|
|
71
|
+
}))
|
|
72
|
+
: eea.footerOpts.contacts;
|
|
73
|
+
|
|
74
|
+
// Update options with actions from backend
|
|
75
|
+
const options = {
|
|
76
|
+
...eea.footerOpts,
|
|
77
|
+
social,
|
|
78
|
+
contacts,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<EEAFooter>
|
|
83
|
+
<EEAFooter.Header>{eea.footerOpts.logosHeader}</EEAFooter.Header>
|
|
84
|
+
<EEAFooter.SubFooter {...options} />
|
|
85
|
+
<EEAFooter.Header>{eea.footerOpts.header}</EEAFooter.Header>
|
|
86
|
+
<EEAFooter.SitesButton
|
|
87
|
+
buttonName={eea.footerOpts.buttonName}
|
|
88
|
+
hrefButton={eea.footerOpts.hrefButton}
|
|
89
|
+
/>
|
|
90
|
+
<EEAFooter.Social {...options} />
|
|
91
|
+
<EEAFooter.Actions actions={actions} copyright={copyright} />
|
|
92
|
+
</EEAFooter>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export default Footer;
|
package/src/index.js
CHANGED
|
@@ -158,6 +158,10 @@ const applyConfig = (config) => {
|
|
|
158
158
|
],
|
|
159
159
|
footerOpts: {
|
|
160
160
|
...(config.settings.eea?.footerOpts || {}),
|
|
161
|
+
buttonName: 'Explore our environmental information systems',
|
|
162
|
+
hrefButton: 'https://www.eea.europa.eu/en/information-systems#',
|
|
163
|
+
logosHeader: 'Managed by',
|
|
164
|
+
header: '',
|
|
161
165
|
description:
|
|
162
166
|
'The European Climate Adaptation Platform Climate-ADAPT is a partnership between the European Commission and the European Environment Agency.',
|
|
163
167
|
managedBy: [
|
package/src/search/common.js
CHANGED
|
@@ -251,6 +251,16 @@ iframe {
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
+
#footer {
|
|
255
|
+
.theme-sites {
|
|
256
|
+
padding: 3rem 0 ;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.footer-header {
|
|
260
|
+
margin-bottom: 1.5em;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
254
264
|
#mega-menu {
|
|
255
265
|
.ui.list.has--4--columns {
|
|
256
266
|
a.item {
|
|
@@ -303,10 +313,6 @@ iframe {
|
|
|
303
313
|
padding-left: 0.8em;
|
|
304
314
|
min-width: 10em;
|
|
305
315
|
}
|
|
306
|
-
|
|
307
|
-
.noneu-langs-label {
|
|
308
|
-
// border-bottom: 1px solid black;
|
|
309
|
-
}
|
|
310
316
|
}
|
|
311
317
|
}
|
|
312
318
|
}
|