@eeacms/volto-cca-policy 0.1.102 → 0.2.1
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 +70 -0
- package/README.md +0 -1
- package/package.json +1 -1
- package/src/components/manage/Blocks/C3SIndicatorsGlossaryBlock/C3SIndicatorsGlossaryBlockView.jsx +13 -26
- package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockEdit.jsx +32 -0
- package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockView.jsx +36 -0
- package/src/components/manage/Blocks/C3SIndicatorsListingBlock/index.js +29 -0
- package/src/components/manage/Blocks/C3SIndicatorsListingBlock/schema.js +14 -0
- package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/C3SIndicatorsOverviewBlockView.jsx +11 -40
- package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/schema.js +21 -21
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerView.js +32 -6
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.jsx +133 -54
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.test.jsx +50 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.jsx +1 -1
- package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.jsx +25 -22
- package/src/components/manage/Blocks/CaseStudyExplorer/FeatureInteraction.jsx +0 -3
- package/src/components/manage/Blocks/CaseStudyExplorer/hooks.js +2 -2
- package/src/components/manage/Blocks/CaseStudyExplorer/styles.less +41 -4
- package/src/components/manage/Blocks/CaseStudyExplorer/utils.js +23 -3
- package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.jsx +1 -1
- package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.test.jsx +93 -0
- package/src/components/manage/Blocks/CountryProfileDetail/Edit.js +5 -0
- package/src/components/manage/Blocks/CountryProfileDetail/View.js +67 -0
- package/src/components/manage/Blocks/CountryProfileDetail/index.js +25 -0
- package/src/components/manage/Blocks/RASTBlock/ContextNavigation.jsx +3 -1
- package/src/components/manage/Blocks/RASTBlock/RASTAccordion.jsx +22 -17
- package/src/components/manage/Blocks/RASTBlock/RASTMap.jsx +17 -11
- package/src/components/manage/Blocks/RASTBlock/RASTMap.test.jsx +81 -0
- package/src/components/manage/Blocks/RASTBlock/RASTView.jsx +8 -0
- package/src/components/manage/Blocks/RASTBlock/schema.js +14 -1
- package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.jsx +3 -3
- package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectView.jsx +37 -88
- package/src/components/manage/Blocks/index.js +8 -0
- package/src/components/theme/BannerTitle/BannerTitle.jsx +28 -17
- package/src/components/theme/Header/Header.jsx +11 -2
- package/src/components/theme/TranslationDisclaimer/LanguagePreference.jsx +40 -53
- package/src/components/theme/TranslationDisclaimer/TranslationDisclaimer.jsx +20 -78
- package/src/components/theme/TranslationDisclaimer/TranslationInfo.jsx +124 -0
- package/src/components/theme/Views/AdaptationOptionView.jsx +10 -5
- package/src/components/theme/Views/C3SIndicatorView.jsx +10 -7
- package/src/components/theme/Views/CaseStudyView.jsx +11 -5
- package/src/components/theme/Views/CcaEventView.jsx +1 -5
- package/src/components/theme/Views/DatabaseItemView.jsx +3 -5
- package/src/components/theme/Views/EventView.jsx +0 -2
- package/src/components/theme/Views/NewsItemView.jsx +0 -2
- package/src/components/theme/Views/ProjectView.jsx +3 -5
- package/src/components/theme/Widgets/GeolocationWidget.jsx +1 -6
- package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/Header.jsx +1 -1
- package/src/customizations/volto/components/theme/View/DefaultView.jsx +1 -6
- package/src/index.js +23 -6
- package/src/search/index.js +3 -0
- package/src/slate-styles.less +15 -0
- package/theme/assets/images/Header/climate-adapt-logo-white.svg +61 -0
- package/theme/assets/images/Header/observatory-logo.svg +1 -0
- package/theme/assets/images/Header/observatory-white-logo.svg +1 -0
- package/theme/globals/observatory.less +1 -1
- package/theme/globals/site.overrides +25 -7
- package/theme/globals/views.less +72 -24
- package/src/components/manage/Blocks/TransRegionSelect/countries.json +0 -150
- package/src/components/manage/Widgets/CreatableSelectWidget.jsx +0 -316
- package/src/components/manage/Widgets/CreatableSelectWidget.test.jsx +0 -89
|
@@ -0,0 +1,50 @@
|
|
|
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 CaseStudyFilters from './CaseStudyFilters';
|
|
8
|
+
|
|
9
|
+
const mockStore = configureStore();
|
|
10
|
+
|
|
11
|
+
describe('CaseStudyFilters', () => {
|
|
12
|
+
it('should render the component', () => {
|
|
13
|
+
const data = {
|
|
14
|
+
filters: {
|
|
15
|
+
// sectors: [{ HEALTH: 'Health' }],
|
|
16
|
+
// impacts: [{ DROUGHT: 'Drought' }],
|
|
17
|
+
sectors: [],
|
|
18
|
+
impacts: [],
|
|
19
|
+
measures: {
|
|
20
|
+
// Measure1: [
|
|
21
|
+
// { key: 'M11', value: 'm11' },
|
|
22
|
+
// { key: 'M12', value: 'm12' },
|
|
23
|
+
// ],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
activeFilters: {
|
|
27
|
+
sectors: [],
|
|
28
|
+
impacts: [],
|
|
29
|
+
measures: [],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const store = mockStore({
|
|
34
|
+
userSession: { token: '1234' },
|
|
35
|
+
intl: {
|
|
36
|
+
locale: 'en',
|
|
37
|
+
messages: {},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const { container } = render(
|
|
42
|
+
<Provider store={store}>
|
|
43
|
+
<MemoryRouter>
|
|
44
|
+
<CaseStudyFilters {...data} />
|
|
45
|
+
</MemoryRouter>
|
|
46
|
+
</Provider>,
|
|
47
|
+
);
|
|
48
|
+
expect(container).toBeTruthy();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -12,7 +12,7 @@ export default function CaseStudyMap(props) {
|
|
|
12
12
|
const { items, activeItems } = props;
|
|
13
13
|
const [selectedCase, onSelectedCase] = React.useState();
|
|
14
14
|
|
|
15
|
-
const features = getFeatures(items);
|
|
15
|
+
const features = getFeatures(items);
|
|
16
16
|
|
|
17
17
|
const [tileWMSSources] = React.useState([
|
|
18
18
|
// , setTileWMSSources
|
|
@@ -4,33 +4,35 @@ import { FormattedMessage } from 'react-intl';
|
|
|
4
4
|
export default function FeatureDisplay({ feature }) {
|
|
5
5
|
return feature ? (
|
|
6
6
|
<div id="csepopup">
|
|
7
|
-
<
|
|
7
|
+
<p>
|
|
8
|
+
<strong>{feature.title}</strong> <a href={feature.url}>open DB</a>
|
|
9
|
+
</p>
|
|
8
10
|
<span className="img">
|
|
9
11
|
<center>
|
|
10
12
|
<img src={feature.image} alt={feature.title} />
|
|
11
13
|
</center>
|
|
12
14
|
</span>
|
|
15
|
+
<p style={{ marginBottom: '10px' }}>
|
|
16
|
+
<span className="blue">
|
|
17
|
+
<FormattedMessage
|
|
18
|
+
id="Adaptation sectors"
|
|
19
|
+
defaultMessage="Adaptation sectors"
|
|
20
|
+
/>
|
|
21
|
+
{': '}
|
|
22
|
+
</span>
|
|
23
|
+
<span>{feature.adaptations}</span>
|
|
24
|
+
</p>
|
|
25
|
+
<p style={{ marginBottom: '10px' }}>
|
|
26
|
+
<span className="blue">
|
|
27
|
+
<FormattedMessage
|
|
28
|
+
id="Climate impacts"
|
|
29
|
+
defaultMessage="Climate impacts"
|
|
30
|
+
/>
|
|
31
|
+
{': '}
|
|
32
|
+
</span>
|
|
33
|
+
<span>{feature.impacts}</span>
|
|
34
|
+
</p>
|
|
13
35
|
<p>
|
|
14
|
-
<p style={{ marginBottom: '10px' }}>
|
|
15
|
-
<span className="blue">
|
|
16
|
-
<FormattedMessage
|
|
17
|
-
id="Adaptation sectors"
|
|
18
|
-
defaultMessage="Adaptation sectors"
|
|
19
|
-
/>
|
|
20
|
-
{': '}
|
|
21
|
-
</span>
|
|
22
|
-
<span>{feature.adaptations}</span>
|
|
23
|
-
</p>
|
|
24
|
-
<p style={{ marginBottom: '10px' }}>
|
|
25
|
-
<span className="blue">
|
|
26
|
-
<FormattedMessage
|
|
27
|
-
id="Climate impacts"
|
|
28
|
-
defaultMessage="Climate impacts"
|
|
29
|
-
/>
|
|
30
|
-
{': '}
|
|
31
|
-
</span>
|
|
32
|
-
<span>{feature.impacts}</span>
|
|
33
|
-
</p>
|
|
34
36
|
<span className="blue">
|
|
35
37
|
<FormattedMessage
|
|
36
38
|
id="Adaptation options"
|
|
@@ -40,7 +42,8 @@ export default function FeatureDisplay({ feature }) {
|
|
|
40
42
|
</span>
|
|
41
43
|
<span
|
|
42
44
|
dangerouslySetInnerHTML={{
|
|
43
|
-
__html: feature.adaptation_options_links.
|
|
45
|
+
__html: feature.adaptation_options_links.replaceAll('<>', '; '),
|
|
46
|
+
// __html: feature.adaptation_options_links,
|
|
44
47
|
}}
|
|
45
48
|
></span>
|
|
46
49
|
</p>
|
|
@@ -60,7 +60,6 @@ export default function FeatureInteraction({ onFeatureSelect }) {
|
|
|
60
60
|
if (subfeatures.length === 1) {
|
|
61
61
|
const selectedFeature = subfeatures[0].values_;
|
|
62
62
|
onFeatureSelect(selectedFeature);
|
|
63
|
-
// console.log('onfeatureselect');
|
|
64
63
|
} else {
|
|
65
64
|
// zoom to extent of cluster points
|
|
66
65
|
const extent = getExtentOfFeatures(subfeatures);
|
|
@@ -68,12 +67,10 @@ export default function FeatureInteraction({ onFeatureSelect }) {
|
|
|
68
67
|
let extentBuffer =
|
|
69
68
|
(extent[3] - extent[1] + extent[2] - extent[0]) / 4;
|
|
70
69
|
extentBuffer = extentBuffer < 500 ? 500 : extentBuffer;
|
|
71
|
-
// console.log('extentBuffer', { extent, extentBuffer });
|
|
72
70
|
const paddedExtent = ol.extent.buffer(extent, extentBuffer);
|
|
73
71
|
|
|
74
72
|
// const paddedExtent = ol.extent.buffer(extent, 50000);
|
|
75
73
|
map.getView().fit(paddedExtent, { ...map.getSize(), duration: 1000 });
|
|
76
|
-
// console.log('onclusterzoom');
|
|
77
74
|
}
|
|
78
75
|
});
|
|
79
76
|
|
|
@@ -4,7 +4,7 @@ import superagent from 'superagent';
|
|
|
4
4
|
const cases_url = '@@case-studies-map.arcgis.json';
|
|
5
5
|
|
|
6
6
|
export function useCases(url) {
|
|
7
|
-
const [cases, setCases] = React.useState([]);
|
|
7
|
+
const [cases, setCases] = React.useState([[], []]);
|
|
8
8
|
|
|
9
9
|
React.useEffect(() => {
|
|
10
10
|
superagent
|
|
@@ -12,7 +12,7 @@ export function useCases(url) {
|
|
|
12
12
|
.set('accept', 'json')
|
|
13
13
|
.then((resp) => {
|
|
14
14
|
const res = JSON.parse(resp.text);
|
|
15
|
-
setCases(res.features);
|
|
15
|
+
setCases({ features: res.features, filters: res.filters });
|
|
16
16
|
});
|
|
17
17
|
}, []);
|
|
18
18
|
|
|
@@ -5,12 +5,19 @@
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
#csepopup {
|
|
8
|
+
border-bottom: 6px solid #005c96;
|
|
9
|
+
|
|
8
10
|
p {
|
|
11
|
+
padding: 0 10px 0 10px;
|
|
9
12
|
font-size: 13px;
|
|
10
13
|
|
|
11
14
|
p {
|
|
12
15
|
margin-bottom: 10px;
|
|
13
16
|
}
|
|
17
|
+
|
|
18
|
+
a {
|
|
19
|
+
text-decoration: underline;
|
|
20
|
+
}
|
|
14
21
|
}
|
|
15
22
|
|
|
16
23
|
span.blue {
|
|
@@ -33,16 +40,18 @@
|
|
|
33
40
|
position: relative;
|
|
34
41
|
padding: 10px;
|
|
35
42
|
border-bottom: 1px solid #d8d8d8;
|
|
43
|
+
margin-top: 0 !important;
|
|
36
44
|
margin-bottom: 0 !important;
|
|
37
|
-
background-color: #
|
|
38
|
-
|
|
45
|
+
background-color: #fff;
|
|
46
|
+
clear: both;
|
|
47
|
+
color: #005c96;
|
|
39
48
|
cursor: pointer;
|
|
40
49
|
font-size: 14px;
|
|
41
50
|
}
|
|
42
51
|
|
|
43
52
|
p {
|
|
44
|
-
padding: 2px;
|
|
45
|
-
padding-
|
|
53
|
+
// padding: 2px;
|
|
54
|
+
padding-bottom: 10px;
|
|
46
55
|
clear: both;
|
|
47
56
|
line-height: 20px;
|
|
48
57
|
|
|
@@ -56,4 +65,32 @@
|
|
|
56
65
|
float: right;
|
|
57
66
|
}
|
|
58
67
|
}
|
|
68
|
+
|
|
69
|
+
div.title {
|
|
70
|
+
width: 100%;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ui.accordion > .title > .icon {
|
|
74
|
+
line-height: 1rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ui.accordion p {
|
|
78
|
+
margin: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ui.accordion .subcategory {
|
|
82
|
+
margin-bottom: 30px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
button.reset {
|
|
86
|
+
margin-top: 20px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.ui.checkbox {
|
|
90
|
+
width: 100%;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.section-case-study-explorer #popup-overlay {
|
|
95
|
+
padding: 0;
|
|
59
96
|
}
|
|
@@ -19,6 +19,7 @@ export function getFeatures(cases) {
|
|
|
19
19
|
impacts: c.properties.impacts_str,
|
|
20
20
|
adaptation_options_links: c.properties.adaptation_options_links,
|
|
21
21
|
index: index,
|
|
22
|
+
url: c.properties.url,
|
|
22
23
|
},
|
|
23
24
|
false,
|
|
24
25
|
);
|
|
@@ -29,7 +30,12 @@ export function getFeatures(cases) {
|
|
|
29
30
|
|
|
30
31
|
export function filterCases(cases, activeFilters) {
|
|
31
32
|
const data = cases.filter((_case) => {
|
|
32
|
-
if (
|
|
33
|
+
if (
|
|
34
|
+
activeFilters.sectors.length === 0 &&
|
|
35
|
+
activeFilters.measures.length === 0 &&
|
|
36
|
+
activeFilters.impacts.length === 0
|
|
37
|
+
)
|
|
38
|
+
return _case;
|
|
33
39
|
|
|
34
40
|
let flag = false;
|
|
35
41
|
|
|
@@ -41,6 +47,10 @@ export function filterCases(cases, activeFilters) {
|
|
|
41
47
|
if (_case.properties.impacts.includes(',' + filter + ',')) flag = true;
|
|
42
48
|
});
|
|
43
49
|
|
|
50
|
+
activeFilters.measures.forEach((filter) => {
|
|
51
|
+
if (_case.properties.ktms.includes(',' + filter + ',')) flag = true;
|
|
52
|
+
});
|
|
53
|
+
|
|
44
54
|
return flag ? _case : false;
|
|
45
55
|
});
|
|
46
56
|
|
|
@@ -48,10 +58,11 @@ export function filterCases(cases, activeFilters) {
|
|
|
48
58
|
}
|
|
49
59
|
|
|
50
60
|
export function getFilters(cases) {
|
|
51
|
-
let _filters = { sectors: {}, impacts: {} };
|
|
61
|
+
let _filters = { sectors: {}, impacts: {}, measures: {} };
|
|
52
62
|
|
|
53
63
|
for (let key of Object.keys(cases)) {
|
|
54
64
|
const _case = cases[key];
|
|
65
|
+
|
|
55
66
|
let sectorKeys = _case.properties.sectors.split(',');
|
|
56
67
|
let sectorNames = _case.properties.sectors_str.split(',');
|
|
57
68
|
for (let i = 0; i < sectorNames.length; i++) {
|
|
@@ -59,15 +70,24 @@ export function getFilters(cases) {
|
|
|
59
70
|
_filters.sectors[sectorKeys[i + 1]] = sectorNames[i];
|
|
60
71
|
}
|
|
61
72
|
}
|
|
73
|
+
|
|
62
74
|
let impactKeys = _case.properties.impacts.split(',');
|
|
63
75
|
let impactNames = _case.properties.impacts_str.split(',');
|
|
64
|
-
|
|
65
76
|
for (let i = 0; i < impactNames.length; i++) {
|
|
66
77
|
if (!_filters.impacts.hasOwnProperty(impactKeys[i + 1])) {
|
|
67
78
|
_filters.impacts[impactKeys[i + 1]] = impactNames[i];
|
|
68
79
|
}
|
|
69
80
|
}
|
|
81
|
+
|
|
82
|
+
// let ktmKeys = _case.properties.ktms.split(',');
|
|
83
|
+
// let ktmNames = _case.properties.impacts_str.split(',');
|
|
84
|
+
// for (let i = 0; i < ktmKeys.length; i++) {
|
|
85
|
+
// if (!_filters.ktms.hasOwnProperty(ktmKeys[i])) {
|
|
86
|
+
// _filters.ktms[ktmKeys[i]] = 1;
|
|
87
|
+
// }
|
|
88
|
+
// }
|
|
70
89
|
}
|
|
90
|
+
// console.log('getFilters:', _filters);
|
|
71
91
|
|
|
72
92
|
return _filters;
|
|
73
93
|
}
|
|
@@ -90,7 +90,7 @@ export default function CollectionStatsView(props) {
|
|
|
90
90
|
let stats = useStats(getBaseUrl(pathname), id, data);
|
|
91
91
|
|
|
92
92
|
const groupDefinition =
|
|
93
|
-
config.blocks.blocksConfig.collectionStats
|
|
93
|
+
config.blocks.blocksConfig.collectionStats?.groups?.[field] || {};
|
|
94
94
|
const { cleanup, icons = {}, iconComponent: IconComponent } = groupDefinition;
|
|
95
95
|
|
|
96
96
|
if (cleanup) stats = cleanup(stats);
|
|
@@ -0,0 +1,93 @@
|
|
|
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 CollectionStatsView from './CollectionStatsView';
|
|
8
|
+
import config from '@plone/volto/registry';
|
|
9
|
+
import applyConfig from './index';
|
|
10
|
+
|
|
11
|
+
const mockStore = configureStore();
|
|
12
|
+
|
|
13
|
+
applyConfig(config);
|
|
14
|
+
|
|
15
|
+
describe('CollectionStatsView', () => {
|
|
16
|
+
it('should render the component', () => {
|
|
17
|
+
const data = {
|
|
18
|
+
id: 'id-1',
|
|
19
|
+
data: {
|
|
20
|
+
aggregateField: {
|
|
21
|
+
label: 'Portal type',
|
|
22
|
+
value: 'portal_type',
|
|
23
|
+
},
|
|
24
|
+
href: [
|
|
25
|
+
{
|
|
26
|
+
'@id': '/en/observatory/advanced-search',
|
|
27
|
+
title: 'Resource catalogue',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
query: {
|
|
31
|
+
query: [
|
|
32
|
+
{
|
|
33
|
+
i: 'include_in_observatory',
|
|
34
|
+
o: 'plone.app.querystring.operation.boolean.isTrue',
|
|
35
|
+
v: '',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
i: 'path',
|
|
39
|
+
o: 'plone.app.querystring.operation.string.absolutePath',
|
|
40
|
+
v: '/en',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
i: 'review_state',
|
|
44
|
+
o: 'plone.app.querystring.operation.selection.any',
|
|
45
|
+
v: ['published'],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
sort_order: 'ascending',
|
|
49
|
+
queryParameterStyle: 'EEASemanticSearch',
|
|
50
|
+
showLabel: true,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
path: '/some-location',
|
|
54
|
+
pathname: '/some-location',
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const store = mockStore({
|
|
58
|
+
userSession: { token: '1234' },
|
|
59
|
+
intl: {
|
|
60
|
+
locale: 'en',
|
|
61
|
+
messages: {},
|
|
62
|
+
},
|
|
63
|
+
querystats: {
|
|
64
|
+
'id-1': {
|
|
65
|
+
items: {
|
|
66
|
+
Event: 82,
|
|
67
|
+
'News Item': 116,
|
|
68
|
+
'eea.climateadapt.aceproject': 60,
|
|
69
|
+
'eea.climateadapt.adaptationoption': 1,
|
|
70
|
+
'eea.climateadapt.c3sindicator': 9,
|
|
71
|
+
'eea.climateadapt.casestudy': 32,
|
|
72
|
+
'eea.climateadapt.guidancedocument': 21,
|
|
73
|
+
'eea.climateadapt.indicator': 14,
|
|
74
|
+
'eea.climateadapt.informationportal': 27,
|
|
75
|
+
'eea.climateadapt.organisation': 22,
|
|
76
|
+
'eea.climateadapt.publicationreport': 187,
|
|
77
|
+
'eea.climateadapt.tool': 14,
|
|
78
|
+
'eea.climateadapt.video': 17,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const { container } = render(
|
|
85
|
+
<Provider store={store}>
|
|
86
|
+
<MemoryRouter>
|
|
87
|
+
<CollectionStatsView {...data} />
|
|
88
|
+
</MemoryRouter>
|
|
89
|
+
</Provider>,
|
|
90
|
+
);
|
|
91
|
+
expect(container.querySelector('.collection-stats')).toBeInTheDocument();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TabPane, Tab } from 'semantic-ui-react';
|
|
3
|
+
|
|
4
|
+
const extract_body = (html_string) => {
|
|
5
|
+
let parser = new DOMParser();
|
|
6
|
+
let dom_document = parser.parseFromString(html_string, 'text/html');
|
|
7
|
+
|
|
8
|
+
let list = dom_document
|
|
9
|
+
.getElementById('third-level-menu')
|
|
10
|
+
.getElementsByTagName('a');
|
|
11
|
+
let response = { options: [], values: [] };
|
|
12
|
+
for (let i = 0; i < list.length; i++) {
|
|
13
|
+
let theId = list[i].href.split('#')[1];
|
|
14
|
+
response.options.push({
|
|
15
|
+
id: theId,
|
|
16
|
+
name: list[i].innerHTML.replace('&', '&'),
|
|
17
|
+
});
|
|
18
|
+
response.values.push(dom_document.getElementById(theId).innerHTML);
|
|
19
|
+
}
|
|
20
|
+
return response;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default function View(props) {
|
|
24
|
+
const [data, setData] = React.useState();
|
|
25
|
+
const html = props.properties['@components'].countryprofile.html;
|
|
26
|
+
|
|
27
|
+
React.useEffect(
|
|
28
|
+
() =>
|
|
29
|
+
setData(extract_body(html.replaceAll('\n', '').replaceAll('\\"', '"'))),
|
|
30
|
+
[html],
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const panes = [];
|
|
34
|
+
if (data?.options) {
|
|
35
|
+
data.options.forEach((element, index) => {
|
|
36
|
+
panes.push({
|
|
37
|
+
menuItem: element.name,
|
|
38
|
+
render: () => (
|
|
39
|
+
<TabPane>
|
|
40
|
+
{!!data && (
|
|
41
|
+
<div
|
|
42
|
+
dangerouslySetInnerHTML={{ __html: data.values[index] }}
|
|
43
|
+
></div>
|
|
44
|
+
)}
|
|
45
|
+
</TabPane>
|
|
46
|
+
),
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Tab
|
|
53
|
+
className="secondary mnu"
|
|
54
|
+
panes={panes}
|
|
55
|
+
grid={{ paneWidth: 8, tabWidth: 4 }}
|
|
56
|
+
menu={{
|
|
57
|
+
tabular: true,
|
|
58
|
+
vertical: true,
|
|
59
|
+
inverted: false,
|
|
60
|
+
pointing: true,
|
|
61
|
+
fluid: true,
|
|
62
|
+
className: 'secondary',
|
|
63
|
+
tabIndex: 0,
|
|
64
|
+
}}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import worldSVG from '@plone/volto/icons/world.svg';
|
|
2
|
+
import Edit from './Edit';
|
|
3
|
+
import View from './View';
|
|
4
|
+
// import { blockAvailableInMission } from '@eeacms/volto-cca-policy/utils';
|
|
5
|
+
|
|
6
|
+
export default function installCountryProfileDetailBlock(config) {
|
|
7
|
+
config.blocks.blocksConfig.countryProfileDetail = {
|
|
8
|
+
id: 'countryProfileDetail',
|
|
9
|
+
title: 'Country Profile Detail',
|
|
10
|
+
icon: worldSVG,
|
|
11
|
+
group: 'site',
|
|
12
|
+
edit: Edit,
|
|
13
|
+
view: View,
|
|
14
|
+
sidebarTab: 1,
|
|
15
|
+
security: {
|
|
16
|
+
addPermission: [],
|
|
17
|
+
view: [],
|
|
18
|
+
},
|
|
19
|
+
restricted: ({ properties, block }) => {
|
|
20
|
+
return false;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return config;
|
|
25
|
+
}
|
|
@@ -11,7 +11,7 @@ import { useLocation } from 'react-router-dom';
|
|
|
11
11
|
* INavigationPortlet
|
|
12
12
|
*/
|
|
13
13
|
export function ContextNavigationComponent(props) {
|
|
14
|
-
const { location, items } = props;
|
|
14
|
+
const { location, items, skip_items, show_subfolders } = props;
|
|
15
15
|
let activeMenu = null;
|
|
16
16
|
|
|
17
17
|
const curent_location = useLocation();
|
|
@@ -28,12 +28,14 @@ export function ContextNavigationComponent(props) {
|
|
|
28
28
|
<>
|
|
29
29
|
<RASTMap
|
|
30
30
|
items={items}
|
|
31
|
+
skip_items={skip_items}
|
|
31
32
|
pathname={location.pathname}
|
|
32
33
|
activeMenu={activeMenu}
|
|
33
34
|
/>
|
|
34
35
|
{items.length ? (
|
|
35
36
|
<RASTAccordion
|
|
36
37
|
items={items}
|
|
38
|
+
show_subfolders={show_subfolders}
|
|
37
39
|
curent_location={curent_location}
|
|
38
40
|
activeMenu={activeMenu}
|
|
39
41
|
/>
|
|
@@ -4,7 +4,7 @@ import RASTAccordionContent from './RASTAccordionContent';
|
|
|
4
4
|
import { useHistory } from 'react-router-dom';
|
|
5
5
|
|
|
6
6
|
const RASTAccordion = (props) => {
|
|
7
|
-
const { items = {}, curent_location, activeMenu } = props;
|
|
7
|
+
const { items = {}, curent_location, activeMenu, show_subfolders } = props;
|
|
8
8
|
|
|
9
9
|
const history = useHistory();
|
|
10
10
|
|
|
@@ -12,6 +12,7 @@ const RASTAccordion = (props) => {
|
|
|
12
12
|
let itemUrl = '/' + item['@id'].split('/').slice(3).join('/');
|
|
13
13
|
history.push(itemUrl);
|
|
14
14
|
};
|
|
15
|
+
|
|
15
16
|
return (
|
|
16
17
|
<>
|
|
17
18
|
{items.map((item, index) => {
|
|
@@ -35,23 +36,27 @@ const RASTAccordion = (props) => {
|
|
|
35
36
|
}}
|
|
36
37
|
>
|
|
37
38
|
<span className="item-title">{item.title}</span>
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
{show_subfolders ? (
|
|
40
|
+
active ? (
|
|
41
|
+
<Icon className="ri-arrow-up-s-line" />
|
|
42
|
+
) : (
|
|
43
|
+
<Icon className="ri-arrow-down-s-line" />
|
|
44
|
+
)
|
|
45
|
+
) : null}
|
|
43
46
|
</Accordion.Title>
|
|
44
|
-
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
{show_subfolders ? (
|
|
48
|
+
<Accordion.Content active={active}>
|
|
49
|
+
<RASTAccordionContent
|
|
50
|
+
curent_location={curent_location}
|
|
51
|
+
key={index}
|
|
52
|
+
main={{
|
|
53
|
+
title: item.title,
|
|
54
|
+
href: item['@id'],
|
|
55
|
+
url: item.url,
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
</Accordion.Content>
|
|
59
|
+
) : null}
|
|
55
60
|
</Accordion>
|
|
56
61
|
);
|
|
57
62
|
})}
|