@eeacms/volto-cca-policy 0.1.49 → 0.1.50
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 +16 -0
- package/package.json +1 -1
- package/src/components/manage/Blocks/CaseStudyExplorer/styles.less +1 -1
- package/src/components/manage/Blocks/CountryMapProfile/styles.css +0 -2
- package/src/components/manage/Blocks/RASTBlock/ContextNavigation.jsx +49 -0
- package/src/components/manage/Blocks/RASTBlock/RASTAccordion.jsx +79 -0
- package/src/components/manage/Blocks/RASTBlock/RASTAccordion.test.jsx +42 -0
- package/src/components/manage/Blocks/RASTBlock/RASTAccordionContent.jsx +44 -0
- package/src/components/manage/Blocks/RASTBlock/RASTMap.jsx +371 -0
- package/src/components/manage/Blocks/RASTBlock/RASTView.jsx +12 -346
- package/src/components/manage/Blocks/RASTBlock/schema.js +7 -30
- package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.test.jsx +44 -0
- package/src/components/theme/Views/AdaptationOptionView.jsx +1 -1
- package/src/components/theme/Views/AdaptationOptionView.test.jsx +53 -0
- package/src/components/theme/Views/CaseStudyView.jsx +1 -1
- package/src/components/theme/Views/CaseStudyView.test.jsx +42 -0
- package/src/components/theme/Views/CcaEventView.jsx +1 -1
- package/src/components/theme/Views/GuidanceView.test.jsx +41 -0
- package/src/components/theme/Views/IndicatorView.test.jsx +41 -0
- package/src/components/theme/Views/InformationPortalView.test.jsx +41 -0
- package/src/components/theme/Views/OrganisationView.test.jsx +41 -0
- package/src/components/theme/Views/ProjectView.test.jsx +41 -0
- package/src/components/theme/Views/PublicationReportView.test.jsx +41 -0
- package/src/components/theme/Views/ToolView.test.jsx +41 -0
- package/src/components/theme/Views/VideoView.test.jsx +41 -0
- package/src/helpers/Utils.jsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ 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.1.50](https://github.com/eea/volto-cca-policy/compare/0.1.49...0.1.50) - 8 December 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- test: increase coverage [kreafox - [`b80a73b`](https://github.com/eea/volto-cca-policy/commit/b80a73b8cf69d09ca1b30ccaf73771367ffb0f35)]
|
|
12
|
+
- Make test pass [Tiberiu Ichim - [`9adf2ce`](https://github.com/eea/volto-cca-policy/commit/9adf2cec0d2d4f5c920a1524599765a5e0ae5508)]
|
|
13
|
+
- Refs #260715 rast-block jest test [Tripon Eugen - [`307a8b9`](https://github.com/eea/volto-cca-policy/commit/307a8b953c9d1ef8e51411d8e14e699aaeae235b)]
|
|
14
|
+
- Refs #260715 - sonar qube warnings [Tripon Eugen - [`09dfe3a`](https://github.com/eea/volto-cca-policy/commit/09dfe3a91a0ccc54f6c87ca5a8cabfcdb3e7f3e5)]
|
|
15
|
+
- Refs #260715 rast-block wip [Tripon Eugen - [`20955a3`](https://github.com/eea/volto-cca-policy/commit/20955a3dd39bb8ccaa807efea463b6e8b678a59b)]
|
|
16
|
+
- Refs #260715 rast-block wip [Tripon Eugen - [`5dd47cb`](https://github.com/eea/volto-cca-policy/commit/5dd47cbe32a78664646f9fa75f4ee2e73d0475f2)]
|
|
17
|
+
- Refs #260715 rast-block wip [Tripon Eugen - [`a932a26`](https://github.com/eea/volto-cca-policy/commit/a932a2619b776aab5042b9f24e29df4d6962829f)]
|
|
18
|
+
- Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
|
|
19
|
+
- Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
|
|
20
|
+
- Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
|
|
21
|
+
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
|
|
22
|
+
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
|
|
7
23
|
### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
|
|
8
24
|
|
|
9
25
|
#### :house: Internal changes
|
package/package.json
CHANGED
|
@@ -140,7 +140,6 @@
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
.country-noportal {
|
|
143
|
-
//background-color: #999;
|
|
144
143
|
background-color: #c0c0c0;
|
|
145
144
|
}
|
|
146
145
|
}
|
|
@@ -156,7 +155,6 @@
|
|
|
156
155
|
}
|
|
157
156
|
|
|
158
157
|
.country-noportal path {
|
|
159
|
-
//fill: #999;
|
|
160
158
|
cursor: pointer;
|
|
161
159
|
fill: #e0e0e0;
|
|
162
160
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { compose } from 'redux';
|
|
3
|
+
import { withRouter } from 'react-router';
|
|
4
|
+
|
|
5
|
+
import RASTMap from './RASTMap';
|
|
6
|
+
import RASTAccordion from './RASTAccordion';
|
|
7
|
+
|
|
8
|
+
import { withContentNavigation } from '@plone/volto/components/theme/Navigation/withContentNavigation';
|
|
9
|
+
|
|
10
|
+
import { useLocation } from 'react-router-dom';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A navigation slot implementation, similar to the classic Plone navigation
|
|
14
|
+
* portlet. It uses the same API, so the options are similar to
|
|
15
|
+
* INavigationPortlet
|
|
16
|
+
*/
|
|
17
|
+
export function ContextNavigationComponent(props) {
|
|
18
|
+
const { navigation = {} } = props;
|
|
19
|
+
const { items = [] } = navigation;
|
|
20
|
+
let activeMenu = null;
|
|
21
|
+
|
|
22
|
+
const location = useLocation();
|
|
23
|
+
for (let i = 0; i < items.length; i++) {
|
|
24
|
+
let itemUrl = '/' + items[i].href.split('/').slice(3).join('/');
|
|
25
|
+
items[i].is_active = false;
|
|
26
|
+
if (location.pathname.includes(itemUrl)) {
|
|
27
|
+
activeMenu = i;
|
|
28
|
+
items[i].is_active = true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return items.length ? (
|
|
33
|
+
<>
|
|
34
|
+
<RASTMap
|
|
35
|
+
items={items}
|
|
36
|
+
pathname={location.pathname}
|
|
37
|
+
activeMenu={activeMenu}
|
|
38
|
+
/>
|
|
39
|
+
<RASTAccordion datasets={items} activeMenu={activeMenu} />
|
|
40
|
+
</>
|
|
41
|
+
) : (
|
|
42
|
+
''
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default compose(
|
|
47
|
+
withRouter,
|
|
48
|
+
withContentNavigation,
|
|
49
|
+
)(ContextNavigationComponent);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Accordion, Icon } from 'semantic-ui-react';
|
|
3
|
+
import RASTAccordionContent from './RASTAccordionContent';
|
|
4
|
+
|
|
5
|
+
const RASTAccordion = (props) => {
|
|
6
|
+
const { datasets = {}, activeMenu } = props;
|
|
7
|
+
|
|
8
|
+
const [activeIndex, setActiveIndex] = React.useState([activeMenu]);
|
|
9
|
+
|
|
10
|
+
const handleActiveIndex = (index) => {
|
|
11
|
+
setActiveIndex(index);
|
|
12
|
+
};
|
|
13
|
+
const handleClick = (e, titleProps) => {
|
|
14
|
+
const { index } = titleProps;
|
|
15
|
+
|
|
16
|
+
const newIndex =
|
|
17
|
+
activeIndex.indexOf(index) === -1
|
|
18
|
+
? [...activeIndex, index]
|
|
19
|
+
: activeIndex.filter((item) => item !== index);
|
|
20
|
+
|
|
21
|
+
handleActiveIndex(newIndex);
|
|
22
|
+
};
|
|
23
|
+
const isActive = (id) => {
|
|
24
|
+
return activeIndex.includes(id);
|
|
25
|
+
};
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
{datasets.map((dataset, index) => {
|
|
29
|
+
const { id } = dataset;
|
|
30
|
+
const active = isActive(index);
|
|
31
|
+
let datasetPath = '/' + dataset.href.split('/').slice(3).join('/');
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Accordion id={id} key={index} className="secondary">
|
|
35
|
+
<Accordion.Title
|
|
36
|
+
role="button"
|
|
37
|
+
tabIndex={0}
|
|
38
|
+
active={active}
|
|
39
|
+
aria-expanded={active}
|
|
40
|
+
index={index}
|
|
41
|
+
onClick={(e) => handleClick(e, { index, id, dataset })}
|
|
42
|
+
onKeyDown={(e) => {
|
|
43
|
+
if (e.keyCode === 13 || e.keyCode === 32) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
handleClick(e, { index, id, dataset });
|
|
46
|
+
}
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<span className="dataset-title">{dataset.title}</span>
|
|
50
|
+
{active ? (
|
|
51
|
+
<Icon className="ri-arrow-up-s-line" />
|
|
52
|
+
) : (
|
|
53
|
+
<Icon className="ri-arrow-down-s-line" />
|
|
54
|
+
)}
|
|
55
|
+
</Accordion.Title>
|
|
56
|
+
<Accordion.Content active={active}>
|
|
57
|
+
<RASTAccordionContent
|
|
58
|
+
key={index}
|
|
59
|
+
params={{
|
|
60
|
+
name: 'CurrentTitle',
|
|
61
|
+
includeTop: false,
|
|
62
|
+
currentFolderOnly: true,
|
|
63
|
+
topLevel: 3,
|
|
64
|
+
bottomLevel: 6,
|
|
65
|
+
rootPath: datasetPath,
|
|
66
|
+
title: dataset.title,
|
|
67
|
+
}}
|
|
68
|
+
location={{ pathname: datasetPath }}
|
|
69
|
+
main={{ title: dataset.title, href: dataset['@id'] }}
|
|
70
|
+
/>
|
|
71
|
+
</Accordion.Content>
|
|
72
|
+
</Accordion>
|
|
73
|
+
);
|
|
74
|
+
})}
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default RASTAccordion;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
3
|
+
import configureStore from 'redux-mock-store';
|
|
4
|
+
import { render } from '@testing-library/react';
|
|
5
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
6
|
+
import { Provider } from 'react-intl-redux';
|
|
7
|
+
import RASTAccordion from './RASTAccordion';
|
|
8
|
+
|
|
9
|
+
const mockStore = configureStore();
|
|
10
|
+
|
|
11
|
+
describe('RASTAccordion', () => {
|
|
12
|
+
it('should render the component', () => {
|
|
13
|
+
const data = {
|
|
14
|
+
datasets: [
|
|
15
|
+
{
|
|
16
|
+
id: 'my-dataset',
|
|
17
|
+
title: 'Hello',
|
|
18
|
+
'@id': '/my-dataset',
|
|
19
|
+
href: '/my-dataset-href',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
activeMenu: 1,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const store = mockStore({
|
|
26
|
+
userSession: { token: '1234' },
|
|
27
|
+
intl: {
|
|
28
|
+
locale: 'en',
|
|
29
|
+
messages: {},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const { container } = render(
|
|
34
|
+
<Provider store={store}>
|
|
35
|
+
<MemoryRouter>
|
|
36
|
+
<RASTAccordion {...data} />
|
|
37
|
+
</MemoryRouter>
|
|
38
|
+
</Provider>,
|
|
39
|
+
);
|
|
40
|
+
expect(container.querySelector('.accordion')).toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { List } from 'semantic-ui-react';
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import { compose } from 'redux';
|
|
4
|
+
import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers';
|
|
5
|
+
|
|
6
|
+
import { withContentNavigation } from '@plone/volto/components/theme/Navigation/withContentNavigation';
|
|
7
|
+
|
|
8
|
+
const RASTAccordionContent = (props) => {
|
|
9
|
+
const { main } = props;
|
|
10
|
+
const items = props.navigation?.items;
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div className="dataset-content">
|
|
14
|
+
<div>
|
|
15
|
+
<List.Item key={'0'}>
|
|
16
|
+
<List.Content>
|
|
17
|
+
<div className="dataset-item">
|
|
18
|
+
<Link to={flattenToAppURL(getBaseUrl(main.href))}>
|
|
19
|
+
{main.title}
|
|
20
|
+
</Link>
|
|
21
|
+
</div>
|
|
22
|
+
</List.Content>
|
|
23
|
+
</List.Item>
|
|
24
|
+
{items
|
|
25
|
+
? items.map((item, index) => {
|
|
26
|
+
return (
|
|
27
|
+
<List.Item key={item.id}>
|
|
28
|
+
<List.Content>
|
|
29
|
+
<div className="dataset-item">
|
|
30
|
+
<Link to={flattenToAppURL(getBaseUrl(item['@id']))}>
|
|
31
|
+
{item.title}
|
|
32
|
+
</Link>
|
|
33
|
+
</div>
|
|
34
|
+
</List.Content>
|
|
35
|
+
</List.Item>
|
|
36
|
+
);
|
|
37
|
+
})
|
|
38
|
+
: null}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default compose(withContentNavigation)(RASTAccordionContent);
|