@eeacms/volto-cca-policy 0.2.26 → 0.2.27
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 +24 -8
- package/package.json +1 -1
- package/src/cntrg.data +39487 -1
- package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.jsx +9 -1
- package/src/components/manage/Blocks/CollectionStatistics/index.js +7 -7
- package/src/components/manage/Blocks/ContentLinks/DropdownListView.test.jsx +78 -0
- package/src/components/manage/Blocks/CountryMapProfile/Interactions.jsx +7 -0
- package/src/components/manage/Blocks/CountryMapProfile/OLView.jsx +7 -2
- package/src/components/manage/Blocks/CountryMapProfile/mapstyle.js +4 -4
- package/src/components/manage/Blocks/CountryMapProfile/styles.less +10 -0
- package/src/components/manage/Blocks/FilterAceContent/FilterAceContentView.jsx +150 -42
- package/src/components/manage/Blocks/FilterAceContent/schema.js +1 -0
- package/src/components/manage/Blocks/FilterAceContent/style.less +16 -0
- package/src/components/manage/Blocks/Listing/DropdownListingView.test.jsx +67 -0
- package/src/helpers/country_map/countryMap.js +15 -49
- package/theme/globals/blocks.less +12 -0
- package/src/components/manage/Blocks/CountryMapHeatIndex/euro-countries-simplified.js +0 -46195
- package/src/components/manage/Blocks/CountryMapProfile/euro-countries-simplified.js +0 -46195
|
@@ -69,7 +69,15 @@ const makeSearchBlockQuery = ({ base, query, field, value }) => {
|
|
|
69
69
|
const makeEEASearchQuery = ({ base, field, value }) => {
|
|
70
70
|
// TODO: don't hardcode the language
|
|
71
71
|
const rest =
|
|
72
|
-
'filters[1][field]=issued.date
|
|
72
|
+
'filters[1][field]=issued.date' +
|
|
73
|
+
'&filters[1][values][0]=Last 5 years' +
|
|
74
|
+
'&filters[1][type]=any' +
|
|
75
|
+
'&filters[2][field]=language' +
|
|
76
|
+
'&filters[2][values][0]=en' +
|
|
77
|
+
'&filters[2][type]=any' +
|
|
78
|
+
'&sort-field=issued.date' +
|
|
79
|
+
'&sort-direction=desc';
|
|
80
|
+
|
|
73
81
|
const filter = `filters[0][field]=${field}&filters[0][type]=any&filters[0][values][0]=${value}`;
|
|
74
82
|
|
|
75
83
|
return `${base}?size=n_10_n&${filter}&${rest}`;
|
|
@@ -20,19 +20,19 @@ const healthImpactIcons = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
const portalTypeIcons = {
|
|
23
|
+
'Adaptation option': 'cogs',
|
|
23
24
|
'Case study': 'file text',
|
|
24
25
|
Guidance: 'compass',
|
|
25
26
|
Indicator: 'area chart',
|
|
26
27
|
'Information portal': 'info circle',
|
|
27
|
-
|
|
28
|
+
Organisation: 'sitemap',
|
|
29
|
+
'Publication and report': 'newspaper',
|
|
28
30
|
'Research and knowledge project': 'university',
|
|
29
31
|
Tool: 'wrench',
|
|
30
|
-
'
|
|
32
|
+
'Video and podcast': 'video play',
|
|
31
33
|
// 'eea.climateadapt.aceproject': '',
|
|
32
|
-
// 'eea.climateadapt.adaptationoption': '',
|
|
33
34
|
// 'eea.climateadapt.c3sindicator': '',
|
|
34
35
|
// 'eea.climateadapt.mapgraphdataset': '',
|
|
35
|
-
// 'eea.climateadapt.organisation': '',
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const portalTypesToSearchTypes = {
|
|
@@ -42,15 +42,15 @@ const portalTypesToSearchTypes = {
|
|
|
42
42
|
'eea.climateadapt.indicator': 'Indicator',
|
|
43
43
|
'eea.climateadapt.c3sindicator': 'Indicator',
|
|
44
44
|
'eea.climateadapt.informationportal': 'Information portal',
|
|
45
|
-
'eea.climateadapt.
|
|
45
|
+
'eea.climateadapt.organisation': 'Organisation',
|
|
46
|
+
'eea.climateadapt.publicationreport': 'Publication and report',
|
|
46
47
|
'eea.climateadapt.aceproject': 'Research and knowledge project',
|
|
47
48
|
'eea.climateadapt.researchproject': 'Research and knowledge project',
|
|
48
49
|
'eea.climateadapt.tool': 'Tool',
|
|
49
|
-
'eea.climateadapt.video': '
|
|
50
|
+
'eea.climateadapt.video': 'Video and podcast',
|
|
50
51
|
// TODO: what about these?
|
|
51
52
|
// 'eea.climateadapt.aceproject': '',
|
|
52
53
|
// 'eea.climateadapt.mapgraphdataset': '',
|
|
53
|
-
// 'eea.climateadapt.organisation': '',
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
export default function installCollectionStatsBlock(config) {
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
3
|
+
import configureStore from 'redux-mock-store';
|
|
4
|
+
import renderer from 'react-test-renderer';
|
|
5
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
6
|
+
import { Provider } from 'react-intl-redux';
|
|
7
|
+
import DropdownListView from './DropdownListView';
|
|
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
|
+
|
|
29
|
+
const mockStore = configureStore();
|
|
30
|
+
|
|
31
|
+
describe('DropdownListView', () => {
|
|
32
|
+
it('should render the component', () => {
|
|
33
|
+
const data = {
|
|
34
|
+
'@type': 'contentLinks',
|
|
35
|
+
items: [
|
|
36
|
+
{
|
|
37
|
+
item_title: 'Item 1',
|
|
38
|
+
source: [
|
|
39
|
+
{
|
|
40
|
+
'@id': '/item-1',
|
|
41
|
+
title: 'Item 1',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
item_title: 'Item 2',
|
|
47
|
+
source: [
|
|
48
|
+
{
|
|
49
|
+
'@id': '/item-2',
|
|
50
|
+
title: 'Item 2',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
show_share_btn: false,
|
|
56
|
+
title: 'Navigation',
|
|
57
|
+
variation: 'default',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const store = mockStore({
|
|
61
|
+
userSession: { token: '1234' },
|
|
62
|
+
intl: {
|
|
63
|
+
locale: 'en',
|
|
64
|
+
messages: {},
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const component = renderer.create(
|
|
69
|
+
<Provider store={store}>
|
|
70
|
+
<MemoryRouter>
|
|
71
|
+
<DropdownListView {...data} />
|
|
72
|
+
</MemoryRouter>
|
|
73
|
+
</Provider>,
|
|
74
|
+
);
|
|
75
|
+
const json = component.toJSON();
|
|
76
|
+
expect(json).toMatchSnapshot();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
setTooltipVisibility,
|
|
6
6
|
getClosestFeatureToCoordinate,
|
|
7
7
|
} from '@eeacms/volto-cca-policy/helpers/country_map/countryMap';
|
|
8
|
+
import { openlayers as ol } from '@eeacms/volto-openlayers-map';
|
|
8
9
|
import { useMapContext } from '@eeacms/volto-openlayers-map/api';
|
|
9
10
|
|
|
10
11
|
export const Interactions = ({
|
|
@@ -30,7 +31,12 @@ export const Interactions = ({
|
|
|
30
31
|
const feature = getClosestFeatureToCoordinate(
|
|
31
32
|
evt.coordinate,
|
|
32
33
|
euCountryFeatures.current,
|
|
34
|
+
ol,
|
|
33
35
|
);
|
|
36
|
+
if (!feature) {
|
|
37
|
+
const node = tooltipRef.current;
|
|
38
|
+
node.style.visibility = 'hidden';
|
|
39
|
+
}
|
|
34
40
|
const domEvt = evt.originalEvent;
|
|
35
41
|
|
|
36
42
|
if (
|
|
@@ -105,6 +111,7 @@ Information is available
|
|
|
105
111
|
const feature = getClosestFeatureToCoordinate(
|
|
106
112
|
evt.coordinate,
|
|
107
113
|
euCountryFeatures.current,
|
|
114
|
+
ol,
|
|
108
115
|
);
|
|
109
116
|
|
|
110
117
|
highlight.current = feature && feature.get('na');
|
|
@@ -113,7 +113,12 @@ const View = (props) => {
|
|
|
113
113
|
new ol.source.TileWMS({
|
|
114
114
|
url: 'https://gisco-services.ec.europa.eu/maps/service',
|
|
115
115
|
params: {
|
|
116
|
-
// LAYERS: 'OSMBlossomComposite',
|
|
116
|
+
// LAYERS: 'OSMBlossomComposite',
|
|
117
|
+
// LAYERS: 'OSMCartoComposite',
|
|
118
|
+
// LAYERS: 'OSMPositronComposite',
|
|
119
|
+
// LAYERS: 'GreyEarth',
|
|
120
|
+
// LAYERS: 'OSMCarto',
|
|
121
|
+
// LAYERS: 'NaturalEarth',
|
|
117
122
|
LAYERS: 'OSMBrightBackground',
|
|
118
123
|
TILED: true,
|
|
119
124
|
},
|
|
@@ -137,7 +142,7 @@ const View = (props) => {
|
|
|
137
142
|
// console.log('filtered', euCountriesSource?.getFeatures() || 'NOT SET YET');
|
|
138
143
|
|
|
139
144
|
return (
|
|
140
|
-
<div>
|
|
145
|
+
<div className="ol-country-map">
|
|
141
146
|
<Grid columns="12">
|
|
142
147
|
<Grid.Column mobile={12} tablet={12} computer={10} className="col-left">
|
|
143
148
|
{tileWMSSources ? (
|
|
@@ -33,7 +33,7 @@ export const makeStyles = (highlight) => {
|
|
|
33
33
|
const fill = new ol.style.Fill({ color: 'rgb(251,250,230, 0.8)' });
|
|
34
34
|
const stroke = new ol.style.Stroke({
|
|
35
35
|
// color: 'rgba(255,255,255,0.8)',
|
|
36
|
-
color: '#
|
|
36
|
+
color: '#333333',
|
|
37
37
|
width: 1,
|
|
38
38
|
});
|
|
39
39
|
|
|
@@ -43,13 +43,13 @@ export const makeStyles = (highlight) => {
|
|
|
43
43
|
|
|
44
44
|
const getFillColor = (feature) => {
|
|
45
45
|
if (feature.get('fillBlue') === 'blue1') {
|
|
46
|
-
return new ol.style.Fill({ color: 'rgb(0, 75, 127,
|
|
46
|
+
return new ol.style.Fill({ color: 'rgb(0, 75, 127, 1)' });
|
|
47
47
|
}
|
|
48
48
|
if (feature.get('fillBlue') === 'blue2') {
|
|
49
|
-
return new ol.style.Fill({ color: 'rgb(10, 153, 255,
|
|
49
|
+
return new ol.style.Fill({ color: 'rgb(10, 153, 255, 1)' });
|
|
50
50
|
}
|
|
51
51
|
if (feature.get('fillBlue') === 'blue3') {
|
|
52
|
-
return new ol.style.Fill({ color: 'rgb(120, 217, 252,
|
|
52
|
+
return new ol.style.Fill({ color: 'rgb(120, 217, 252, 1)' });
|
|
53
53
|
}
|
|
54
54
|
// console.log(feature.get('fillBlue'));
|
|
55
55
|
return fill;
|
|
@@ -4,6 +4,7 @@ import ListingBody from '@plone/volto/components/manage/Blocks/Listing/ListingBo
|
|
|
4
4
|
import { useSelector, useDispatch } from 'react-redux';
|
|
5
5
|
import { getVocabulary } from '@plone/volto/actions';
|
|
6
6
|
import { OTHER_REGIONS } from '@eeacms/volto-cca-policy/helpers';
|
|
7
|
+
import { Link } from 'react-router-dom';
|
|
7
8
|
import {
|
|
8
9
|
Option,
|
|
9
10
|
DropdownIndicator,
|
|
@@ -19,6 +20,7 @@ const Select = loadable(() => import('react-select'));
|
|
|
19
20
|
|
|
20
21
|
const IMPACTS = 'eea.climateadapt.aceitems_climateimpacts';
|
|
21
22
|
const SECTORS = 'eea.climateadapt.aceitems_sectors';
|
|
23
|
+
const KEY_TYPE = 'eea.climateadapt.aceitems_key_type_measures_short';
|
|
22
24
|
|
|
23
25
|
const FIELDS = [
|
|
24
26
|
'bio_regions',
|
|
@@ -68,7 +70,14 @@ const sectors_no_value = [
|
|
|
68
70
|
},
|
|
69
71
|
];
|
|
70
72
|
|
|
71
|
-
const
|
|
73
|
+
const measures_no_value = [
|
|
74
|
+
{
|
|
75
|
+
label: 'All key type measures',
|
|
76
|
+
value: '',
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
const applyQuery = (id, data, currentLang, impacts, sectors, measures) => {
|
|
72
81
|
const defaultQuery = Object.entries(data)
|
|
73
82
|
.filter(
|
|
74
83
|
([field, value]) => FIELDS.includes(field) && value && value.length > 0,
|
|
@@ -95,20 +104,73 @@ const applyQuery = (id, data, currentLang, impacts, sectors) => {
|
|
|
95
104
|
v: currentLang,
|
|
96
105
|
});
|
|
97
106
|
|
|
107
|
+
defaultQuery.push({
|
|
108
|
+
i: 'review_state',
|
|
109
|
+
o: 'plone.app.querystring.operation.selection.any',
|
|
110
|
+
v: 'published',
|
|
111
|
+
});
|
|
112
|
+
|
|
98
113
|
if (impacts) defaultQuery.push(impacts);
|
|
99
114
|
if (sectors) defaultQuery.push(sectors);
|
|
115
|
+
if (measures) defaultQuery.push(measures);
|
|
100
116
|
|
|
117
|
+
const sort_on = data.sortBy || 'effective';
|
|
101
118
|
return {
|
|
102
119
|
block: id,
|
|
103
120
|
limit: data.nr_items,
|
|
104
121
|
query: defaultQuery,
|
|
105
|
-
sort_on
|
|
106
|
-
sort_order: 'descending',
|
|
122
|
+
sort_on,
|
|
123
|
+
sort_order: sort_on === 'getId' ? 'ascending' : 'descending',
|
|
107
124
|
template: 'summary',
|
|
108
125
|
itemModel: { '@type': 'simpleItem' },
|
|
109
126
|
};
|
|
110
127
|
};
|
|
111
128
|
|
|
129
|
+
const eeaSearchFieldMap = {
|
|
130
|
+
impacts: 'cca_climate_impacts.keyword',
|
|
131
|
+
sectors: 'cca_adaptation_sectors.keyword',
|
|
132
|
+
measures: 'cca_key_type_measure.keyword',
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
function toLabel(value, key, vocab) {
|
|
136
|
+
if (key === 'measures') {
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
return vocab.find(({ value: v }) => value === v).label;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function buildQueryUrl({ vocabs, ...data }) {
|
|
143
|
+
let filters = Object.keys(data).reduce((acc, key) => {
|
|
144
|
+
const name = eeaSearchFieldMap[key];
|
|
145
|
+
const ploneFilter = data[key];
|
|
146
|
+
if (ploneFilter) {
|
|
147
|
+
const value = toLabel(ploneFilter.v, key, vocabs[key]);
|
|
148
|
+
const filter = [
|
|
149
|
+
`filters[$index][field]=${name}`,
|
|
150
|
+
`filters[$index][type]=any`,
|
|
151
|
+
`filters[$index][values][]=${encodeURIComponent(value)}`,
|
|
152
|
+
].join('&');
|
|
153
|
+
acc.push(filter);
|
|
154
|
+
}
|
|
155
|
+
return acc;
|
|
156
|
+
}, []);
|
|
157
|
+
filters = filters
|
|
158
|
+
.map((line, index) => line.replaceAll('$index', index))
|
|
159
|
+
.join('&');
|
|
160
|
+
|
|
161
|
+
return `/en/data-and-downloads?size=n_10&${filters}`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const vocabImpactsAction = getVocabulary({
|
|
165
|
+
vocabNameOrURL: IMPACTS,
|
|
166
|
+
});
|
|
167
|
+
const vocabSectorsAction = getVocabulary({
|
|
168
|
+
vocabNameOrURL: SECTORS,
|
|
169
|
+
});
|
|
170
|
+
const vocabMeasuresAction = getVocabulary({
|
|
171
|
+
vocabNameOrURL: KEY_TYPE,
|
|
172
|
+
});
|
|
173
|
+
|
|
112
174
|
const FilterAceContentView = (props) => {
|
|
113
175
|
const { data, id, mode = 'view' } = props;
|
|
114
176
|
const dispatch = useDispatch();
|
|
@@ -123,22 +185,20 @@ const FilterAceContentView = (props) => {
|
|
|
123
185
|
? state.vocabularies[SECTORS].items
|
|
124
186
|
: [],
|
|
125
187
|
);
|
|
188
|
+
const measuresVocabItems = useSelector((state) =>
|
|
189
|
+
state.vocabularies[KEY_TYPE]?.loaded
|
|
190
|
+
? state.vocabularies[KEY_TYPE].items
|
|
191
|
+
: [],
|
|
192
|
+
);
|
|
126
193
|
|
|
127
194
|
const [impactsQuery, setImpactsQueryQuery] = React.useState();
|
|
128
195
|
const [sectorsQuery, setSectorsQuery] = React.useState();
|
|
196
|
+
const [measuresQuery, setMeasuresQuery] = React.useState();
|
|
129
197
|
|
|
130
198
|
React.useEffect(() => {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
dispatch(action);
|
|
135
|
-
}, [dispatch]);
|
|
136
|
-
|
|
137
|
-
React.useEffect(() => {
|
|
138
|
-
const action = getVocabulary({
|
|
139
|
-
vocabNameOrURL: SECTORS,
|
|
140
|
-
});
|
|
141
|
-
dispatch(action);
|
|
199
|
+
dispatch(vocabImpactsAction);
|
|
200
|
+
dispatch(vocabSectorsAction);
|
|
201
|
+
dispatch(vocabMeasuresAction);
|
|
142
202
|
}, [dispatch]);
|
|
143
203
|
|
|
144
204
|
const listingBodyData = applyQuery(
|
|
@@ -147,41 +207,54 @@ const FilterAceContentView = (props) => {
|
|
|
147
207
|
currentLang,
|
|
148
208
|
impactsQuery,
|
|
149
209
|
sectorsQuery,
|
|
210
|
+
measuresQuery,
|
|
150
211
|
);
|
|
212
|
+
const viewAllUrl = buildQueryUrl({
|
|
213
|
+
impacts: impactsQuery,
|
|
214
|
+
sectors: sectorsQuery,
|
|
215
|
+
measures: measuresQuery,
|
|
216
|
+
vocabs: {
|
|
217
|
+
sectors: sectorsVocabItems,
|
|
218
|
+
measures: measuresVocabItems,
|
|
219
|
+
impacts: impactsVocabItems,
|
|
220
|
+
},
|
|
221
|
+
});
|
|
151
222
|
|
|
152
223
|
return (
|
|
153
224
|
<div className="block filter-acecontent-block">
|
|
154
225
|
{data.title && <h4>{data.title}</h4>}
|
|
155
|
-
<
|
|
226
|
+
<span className="filter-title">
|
|
156
227
|
<FormattedMessage id="Climate impact" defaultMessage="Climate impact" />
|
|
157
|
-
</
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
228
|
+
</span>
|
|
229
|
+
<div>
|
|
230
|
+
<Select
|
|
231
|
+
id="field-impacts"
|
|
232
|
+
name="impacts"
|
|
233
|
+
disabled={false}
|
|
234
|
+
className="react-select-container"
|
|
235
|
+
classNamePrefix="react-select"
|
|
236
|
+
options={[impacts_no_value[0], ...(impactsVocabItems || [])]}
|
|
237
|
+
styles={customSelectStyles}
|
|
238
|
+
theme={selectTheme}
|
|
239
|
+
components={{ DropdownIndicator, Option }}
|
|
240
|
+
defaultValue={impacts_no_value}
|
|
241
|
+
onChange={({ value }) => {
|
|
242
|
+
if (value) {
|
|
243
|
+
setImpactsQueryQuery({
|
|
244
|
+
i: 'climate_impacts',
|
|
245
|
+
o: 'plone.app.querystring.operation.selection.any',
|
|
246
|
+
v: value,
|
|
247
|
+
});
|
|
248
|
+
} else {
|
|
249
|
+
setImpactsQueryQuery(null);
|
|
250
|
+
}
|
|
251
|
+
}}
|
|
252
|
+
/>
|
|
253
|
+
</div>
|
|
181
254
|
|
|
182
|
-
<
|
|
255
|
+
<span className="filter-title">
|
|
183
256
|
<FormattedMessage id="Sector" defaultMessage="Sector" />
|
|
184
|
-
</
|
|
257
|
+
</span>
|
|
185
258
|
<Select
|
|
186
259
|
id="field-sectors"
|
|
187
260
|
name="sectors"
|
|
@@ -198,13 +271,45 @@ const FilterAceContentView = (props) => {
|
|
|
198
271
|
setSectorsQuery({
|
|
199
272
|
i: 'sectors',
|
|
200
273
|
o: 'plone.app.querystring.operation.selection.any',
|
|
201
|
-
v: value,
|
|
274
|
+
v: value.toUpperCase(),
|
|
202
275
|
});
|
|
203
276
|
} else {
|
|
204
277
|
setSectorsQuery(null);
|
|
205
278
|
}
|
|
206
279
|
}}
|
|
207
280
|
/>
|
|
281
|
+
|
|
282
|
+
<div id="key-type-measure">
|
|
283
|
+
<span className="filter-title">
|
|
284
|
+
<FormattedMessage
|
|
285
|
+
id="Key Type Measure"
|
|
286
|
+
defaultMessage="Key Type Measure"
|
|
287
|
+
/>
|
|
288
|
+
</span>
|
|
289
|
+
<Select
|
|
290
|
+
id="field-measure"
|
|
291
|
+
name="measure"
|
|
292
|
+
disabled={false}
|
|
293
|
+
className="react-select-container"
|
|
294
|
+
classNamePrefix="react-select"
|
|
295
|
+
options={[measures_no_value[0], ...(measuresVocabItems || [])]}
|
|
296
|
+
styles={customSelectStyles}
|
|
297
|
+
theme={selectTheme}
|
|
298
|
+
components={{ DropdownIndicator, Option }}
|
|
299
|
+
defaultValue={measures_no_value}
|
|
300
|
+
onChange={({ value }) => {
|
|
301
|
+
if (value) {
|
|
302
|
+
setMeasuresQuery({
|
|
303
|
+
i: 'key_type_measures',
|
|
304
|
+
o: 'plone.app.querystring.operation.selection.any',
|
|
305
|
+
v: value,
|
|
306
|
+
});
|
|
307
|
+
} else {
|
|
308
|
+
setMeasuresQuery(null);
|
|
309
|
+
}
|
|
310
|
+
}}
|
|
311
|
+
/>
|
|
312
|
+
</div>
|
|
208
313
|
<div className="listing-wrapper">
|
|
209
314
|
<ListingBody
|
|
210
315
|
id={id}
|
|
@@ -213,6 +318,9 @@ const FilterAceContentView = (props) => {
|
|
|
213
318
|
isEditMode={mode === 'edit'}
|
|
214
319
|
/>
|
|
215
320
|
</div>
|
|
321
|
+
<Link className="ui button secondary inverted" to={viewAllUrl}>
|
|
322
|
+
View all
|
|
323
|
+
</Link>
|
|
216
324
|
</div>
|
|
217
325
|
);
|
|
218
326
|
};
|
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
.listing-wrapper {
|
|
2
2
|
margin-top: 1.5em;
|
|
3
3
|
}
|
|
4
|
+
|
|
5
|
+
.filter-title {
|
|
6
|
+
display: block;
|
|
7
|
+
margin: 0.7em 0 0.3em 0;
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
font-weight: 600;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
#key-type-measure {
|
|
13
|
+
display: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
body.section-adaptation-options #key-type-measure,
|
|
17
|
+
body.section-adaptation-support-tool.section-step-3-1 #key-type-measure {
|
|
18
|
+
display: block !important;
|
|
19
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
3
|
+
import configureStore from 'redux-mock-store';
|
|
4
|
+
import renderer from 'react-test-renderer';
|
|
5
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
6
|
+
import { Provider } from 'react-intl-redux';
|
|
7
|
+
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
|
+
|
|
29
|
+
const mockStore = configureStore();
|
|
30
|
+
|
|
31
|
+
describe('DropdownListingView', () => {
|
|
32
|
+
it('should render the component', () => {
|
|
33
|
+
const data = {
|
|
34
|
+
'@type': 'listing',
|
|
35
|
+
items: [
|
|
36
|
+
{
|
|
37
|
+
'@id': '/item-1',
|
|
38
|
+
title: 'Item 1',
|
|
39
|
+
id: 'item-1',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
'@id': '/item-2',
|
|
43
|
+
title: 'Item 2',
|
|
44
|
+
id: 'item-2',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const store = mockStore({
|
|
50
|
+
userSession: { token: '1234' },
|
|
51
|
+
intl: {
|
|
52
|
+
locale: 'en',
|
|
53
|
+
messages: {},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const component = renderer.create(
|
|
58
|
+
<Provider store={store}>
|
|
59
|
+
<MemoryRouter>
|
|
60
|
+
<DropdownListingView {...data} />
|
|
61
|
+
</MemoryRouter>
|
|
62
|
+
</Provider>,
|
|
63
|
+
);
|
|
64
|
+
const json = component.toJSON();
|
|
65
|
+
expect(json).toMatchSnapshot();
|
|
66
|
+
});
|
|
67
|
+
});
|