@eeacms/volto-cca-policy 0.1.42 → 0.1.44
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/.husky/pre-commit +2 -0
- package/CHANGELOG.md +28 -0
- package/cypress.config.js +2 -2
- package/locales/en/LC_MESSAGES/volto.po +14 -0
- package/package.json +28 -2
- package/src/components/Result/HealthHorizontalCardItem.jsx +103 -0
- package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/C3SIndicatorsOverviewBlockEdit.jsx +32 -0
- package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/C3SIndicatorsOverviewBlockView.jsx +54 -0
- package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/index.js +28 -0
- package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/schema.js +35 -0
- package/src/components/manage/Blocks/ReadMore/ReadMoreEdit.jsx +32 -0
- package/src/components/manage/Blocks/ReadMore/ReadMoreView.jsx +86 -0
- package/src/components/manage/Blocks/ReadMore/index.js +22 -0
- package/src/components/manage/Blocks/ReadMore/schema.js +42 -0
- package/src/components/manage/Blocks/ReadMore/style.less +25 -0
- package/src/components/manage/Blocks/index.js +4 -0
- package/src/components/theme/Header.jsx +10 -4
- package/src/components/theme/Widgets/GeocharsWidget.jsx +16 -9
- package/src/components/theme/Widgets/GeolocationWidget.jsx +12 -5
- package/src/customizations/volto/components/theme/View/DefaultView.jsx +0 -1
- package/src/index.js +7 -0
- package/src/search/config-health.js +9 -1
- package/src/search/facets-health.js +1 -1
- package/src/search/views-health.js +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,34 @@ 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.44](https://github.com/eea/volto-cca-policy/compare/0.1.43...0.1.44) - 22 September 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- Allow subsite behavior in folders that are not subsites [Tiberiu Ichim - [`28faeb4`](https://github.com/eea/volto-cca-policy/commit/28faeb41c43833352da3ed4002c82cc0429e4a47)]
|
|
12
|
+
- Support subsite logo uploaded as svg [Tiberiu Ichim - [`c1c0874`](https://github.com/eea/volto-cca-policy/commit/c1c08740c838da4f3f5fe2a8b74c4fa87364edce)]
|
|
13
|
+
- Refs #161483 - Fix description html - C3S Indicators Overview block. [GhitaB - [`0853fc4`](https://github.com/eea/volto-cca-policy/commit/0853fc449b64620d173582cadfe6763d73ce8551)]
|
|
14
|
+
- Refs #161483 - Use universal link - C3S Indicators Overview block. [GhitaB - [`054fa8d`](https://github.com/eea/volto-cca-policy/commit/054fa8d62bfd9824ceddf52cc3ebc51b456c935b)]
|
|
15
|
+
- Refs #161483 - Select category - C3S Indicators Overview block. [GhitaB - [`eb75b38`](https://github.com/eea/volto-cca-policy/commit/eb75b3858d6e83fbe87f123381df65f9de4b84ca)]
|
|
16
|
+
- Refs #161483 - Add C3S Indicators Overview block. [GhitaB - [`cf86213`](https://github.com/eea/volto-cca-policy/commit/cf862135713780355a38a1eb683abd1166041cb9)]
|
|
17
|
+
- Cleanup in read more block [kreafox - [`20ac717`](https://github.com/eea/volto-cca-policy/commit/20ac7171575a1966a8aabb50d5ae9e2808429423)]
|
|
18
|
+
- Refs #161485 - Fix error in GeocharsWidget. [GhitaB - [`6fda82d`](https://github.com/eea/volto-cca-policy/commit/6fda82ded95cba32b7519c8bcfa49358887bac6b)]
|
|
19
|
+
- Add read more block [kreafox - [`7fafeaa`](https://github.com/eea/volto-cca-policy/commit/7fafeaabf7bb091db76f9fc083cf61fce2bf6c06)]
|
|
20
|
+
- Refs #161485 - Fix field for Observatory partner. Add facet in search landing page. [GhitaB - [`c21d23e`](https://github.com/eea/volto-cca-policy/commit/c21d23e38ce07733775a3513544c2d3bb5f99edb)]
|
|
21
|
+
### [0.1.43](https://github.com/eea/volto-cca-policy/compare/0.1.42...0.1.43) - 15 September 2023
|
|
22
|
+
|
|
23
|
+
#### :hammer_and_wrench: Others
|
|
24
|
+
|
|
25
|
+
- Refs #161485 - Solve search result breadcrumbs format in Health Catalogue. [GhitaB - [`46c4fb9`](https://github.com/eea/volto-cca-policy/commit/46c4fb99416763258116f14a449a4c6e2464d6d3)]
|
|
26
|
+
- Refs #161485 - Solve URL format in Health Catalogue. [GhitaB - [`5cbf970`](https://github.com/eea/volto-cca-policy/commit/5cbf9709681899cba2de0d0790e0fb0ef4735583)]
|
|
27
|
+
- Refs #161485 - WIP add custom horizontal card result, in order to personalize results URLS. [GhitaB - [`cebb56f`](https://github.com/eea/volto-cca-policy/commit/cebb56f0e45600aa005167d822693512e6559941)]
|
|
28
|
+
- Refs #257521 - Fix error in GeocharsWidget, when no value. [GhitaB - [`e372af6`](https://github.com/eea/volto-cca-policy/commit/e372af6bf417c74ea81a7c77852f3e829bdc656e)]
|
|
29
|
+
- Refs #257521 - Try: fix Jenkins [GhitaB - [`292618a`](https://github.com/eea/volto-cca-policy/commit/292618a8e9ecf1f748cb225af9c1371a5d3e27ca)]
|
|
30
|
+
- Refs #257521 - Fix GeolocationWidget error when no value (error in case study add form). [GhitaB - [`355478b`](https://github.com/eea/volto-cca-policy/commit/355478bcc7349a295b074d416b10ccfd5b807e8c)]
|
|
31
|
+
- test: fix comments [valentinab25 - [`dd918df`](https://github.com/eea/volto-cca-policy/commit/dd918df04d718c222a219b6a5d361872e5535bf6)]
|
|
32
|
+
- Refs #257521 - Enable slate popup (volto-slate-label). [GhitaB - [`f299392`](https://github.com/eea/volto-cca-policy/commit/f299392787ea01a1e3a60064d4d7c01dd1864ca2)]
|
|
33
|
+
- Code cleanup [Tiberiu Ichim - [`9704770`](https://github.com/eea/volto-cca-policy/commit/97047707c6916d55b617786ccdc8f52e6ed6b67b)]
|
|
34
|
+
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`2cacb91`](https://github.com/eea/volto-cca-policy/commit/2cacb91dd8d09807c5835a30e5b53f7d6dd31f5a)]
|
|
7
35
|
### [0.1.42](https://github.com/eea/volto-cca-policy/compare/0.1.41...0.1.42) - 5 September 2023
|
|
8
36
|
|
|
9
37
|
#### :hammer_and_wrench: Others
|
package/cypress.config.js
CHANGED
|
@@ -2,12 +2,12 @@ const { defineConfig } = require('cypress');
|
|
|
2
2
|
|
|
3
3
|
module.exports = defineConfig({
|
|
4
4
|
viewportWidth: 1280,
|
|
5
|
-
defaultCommandTimeout:
|
|
5
|
+
defaultCommandTimeout: 5000,
|
|
6
6
|
chromeWebSecurity: false,
|
|
7
7
|
reporter: 'junit',
|
|
8
8
|
video: true,
|
|
9
9
|
retries: {
|
|
10
|
-
runMode:
|
|
10
|
+
runMode: 1,
|
|
11
11
|
openMode: 0,
|
|
12
12
|
},
|
|
13
13
|
reporterOptions: {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
msgid ""
|
|
2
|
+
msgstr ""
|
|
3
|
+
"Project-Id-Version: \n"
|
|
4
|
+
"Report-Msgid-Bugs-To: \n"
|
|
5
|
+
"POT-Creation-Date: \n"
|
|
6
|
+
"PO-Revision-Date: \n"
|
|
7
|
+
"Last-Translator: \n"
|
|
8
|
+
"Language: \n"
|
|
9
|
+
"Language-Team: \n"
|
|
10
|
+
"Content-Type: \n"
|
|
11
|
+
"Content-Transfer-Encoding: \n"
|
|
12
|
+
"Plural-Forms: \n"
|
|
13
|
+
|
|
14
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-cca-policy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.44",
|
|
4
4
|
"description": "@eeacms/volto-cca-policy: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"@eeacms/volto-widget-geolocation",
|
|
23
23
|
"@eeacms/volto-widget-dataprovenance",
|
|
24
24
|
"@eeacms/volto-accordion-block",
|
|
25
|
+
"@eeacms/volto-slate-label",
|
|
25
26
|
"@eeacms/volto-eea-design-system",
|
|
26
27
|
"@eeacms/volto-globalsearch"
|
|
27
28
|
],
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
"@eeacms/volto-eea-design-system": "*",
|
|
31
32
|
"@eeacms/volto-globalsearch": "*",
|
|
32
33
|
"@eeacms/volto-openlayers-map": "*",
|
|
34
|
+
"@eeacms/volto-slate-label": "*",
|
|
33
35
|
"@eeacms/volto-widget-dataprovenance": "*",
|
|
34
36
|
"@eeacms/volto-widget-geolocation": "*",
|
|
35
37
|
"@eeacms/volto-widget-temporal-coverage": "*",
|
|
@@ -41,8 +43,31 @@
|
|
|
41
43
|
"@plone/scripts": "*",
|
|
42
44
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
43
45
|
"cypress-fail-fast": "^5.0.1",
|
|
46
|
+
"husky": "*",
|
|
47
|
+
"lint-staged": "*",
|
|
44
48
|
"md5": "^2.3.0"
|
|
45
49
|
},
|
|
50
|
+
"lint-staged": {
|
|
51
|
+
"src/**/*.{js,jsx,ts,tsx,json}": [
|
|
52
|
+
"make lint-fix",
|
|
53
|
+
"make prettier-fix"
|
|
54
|
+
],
|
|
55
|
+
"src/**/*.{jsx}": [
|
|
56
|
+
"make i18n"
|
|
57
|
+
],
|
|
58
|
+
"theme/**/*.{css,less}": [
|
|
59
|
+
"make stylelint-fix"
|
|
60
|
+
],
|
|
61
|
+
"src/**/*.{css,less}": [
|
|
62
|
+
"make stylelint-fix"
|
|
63
|
+
],
|
|
64
|
+
"theme/**/*.overrides": [
|
|
65
|
+
"make stylelint-fix"
|
|
66
|
+
],
|
|
67
|
+
"src/**/*.overrides": [
|
|
68
|
+
"make stylelint-fix"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
46
71
|
"scripts": {
|
|
47
72
|
"release": "release-it",
|
|
48
73
|
"release-major-beta": "release-it major --preRelease=beta",
|
|
@@ -60,6 +85,7 @@
|
|
|
60
85
|
"lint:fix": "make lint-fix",
|
|
61
86
|
"i18n": "make i18n",
|
|
62
87
|
"cypress:run": "make cypress-run",
|
|
63
|
-
"cypress:open": "make cypress-open"
|
|
88
|
+
"cypress:open": "make cypress-open",
|
|
89
|
+
"prepare": "husky install"
|
|
64
90
|
}
|
|
65
91
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Original: https://github.com/eea/volto-searchlib/blob/master/searchlib/components/Result/HorizontalCardItem.jsx
|
|
2
|
+
// We need custom href for results.
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Label } from 'semantic-ui-react';
|
|
5
|
+
import {
|
|
6
|
+
SegmentedBreadcrumb,
|
|
7
|
+
StringList,
|
|
8
|
+
DateTime,
|
|
9
|
+
} from '@eeacms/search/components';
|
|
10
|
+
import { useAppConfig } from '@eeacms/search/lib/hocs';
|
|
11
|
+
import { firstWords, getTermDisplayValue } from '@eeacms/search/lib/utils';
|
|
12
|
+
|
|
13
|
+
import ExternalLink from '@eeacms/search/components/Result/ExternalLink';
|
|
14
|
+
import ResultContext from '@eeacms/search/components/Result/ResultContext';
|
|
15
|
+
import ContentClusters from '@eeacms/search/components/Result/ContentClusters';
|
|
16
|
+
|
|
17
|
+
const healthURL = (href) => {
|
|
18
|
+
return href.replace(/\/metadata\//, '/observatory/++aq++metadata/');
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const healthBreadcrumb = (href) => {
|
|
22
|
+
// It's only cosmetic. We don't want to show ++aq...
|
|
23
|
+
return href.replace(/\/metadata\//, '/observatory/');
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const ExtraContent = (props) => {
|
|
27
|
+
const { result, vocab } = props;
|
|
28
|
+
return (
|
|
29
|
+
<div>
|
|
30
|
+
<div className="result-bottom">
|
|
31
|
+
<div className="result-info">
|
|
32
|
+
{/* <span className="result-info-title">Published: </span> */}
|
|
33
|
+
<DateTime format="DATE_MED" value={result.issued} />
|
|
34
|
+
</div>
|
|
35
|
+
<div className="result-info">
|
|
36
|
+
<span className="result-info-title">Topics: </span>
|
|
37
|
+
<StringList value={result.tags} />
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div>
|
|
41
|
+
<div className="result-info result-source">
|
|
42
|
+
<span className="result-info-title">Source: </span>
|
|
43
|
+
<ExternalLink href={healthURL(result.href)}>
|
|
44
|
+
<strong title={result.source} className="source">
|
|
45
|
+
{firstWords(
|
|
46
|
+
getTermDisplayValue({
|
|
47
|
+
vocab,
|
|
48
|
+
field: 'cluster_name',
|
|
49
|
+
term: result.source,
|
|
50
|
+
}),
|
|
51
|
+
8,
|
|
52
|
+
)}
|
|
53
|
+
</strong>
|
|
54
|
+
<SegmentedBreadcrumb
|
|
55
|
+
href={healthBreadcrumb(result.href)}
|
|
56
|
+
short={true}
|
|
57
|
+
maxChars={40}
|
|
58
|
+
/>
|
|
59
|
+
</ExternalLink>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const HealthHorizontalCardItem = (props) => {
|
|
67
|
+
const { result } = props;
|
|
68
|
+
const { appConfig, registry } = useAppConfig();
|
|
69
|
+
const { vocab = {} } = appConfig;
|
|
70
|
+
const clusters = result.clusterInfo;
|
|
71
|
+
|
|
72
|
+
const UniversalCard = registry.resolve['UniversalCard'].component;
|
|
73
|
+
|
|
74
|
+
const item = {
|
|
75
|
+
'@id': result.href,
|
|
76
|
+
title: (
|
|
77
|
+
<>
|
|
78
|
+
<ExternalLink href={healthURL(result.href)} title={result.title}>
|
|
79
|
+
{result.title}
|
|
80
|
+
{result.isNew && <Label className="new-item">New</Label>}
|
|
81
|
+
{result.isExpired && (
|
|
82
|
+
<Label className="archived-item">Archived</Label>
|
|
83
|
+
)}
|
|
84
|
+
</ExternalLink>
|
|
85
|
+
</>
|
|
86
|
+
),
|
|
87
|
+
meta: <ContentClusters clusters={clusters} item={result} />,
|
|
88
|
+
description: props.children ? props.children : <ResultContext {...props} />,
|
|
89
|
+
preview_image_url: result.hasImage ? result.thumbUrl : undefined,
|
|
90
|
+
extra: <ExtraContent result={result} vocab={vocab} />,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const itemModel = {
|
|
94
|
+
hasImage: result.hasImage,
|
|
95
|
+
hasDescription: true,
|
|
96
|
+
imageOnRightSide: true,
|
|
97
|
+
'@type': 'searchItem',
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return <UniversalCard item={item} itemModel={itemModel} />;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export default HealthHorizontalCardItem;
|
package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/C3SIndicatorsOverviewBlockEdit.jsx
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { SidebarPortal } from '@plone/volto/components';
|
|
4
|
+
import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
|
|
5
|
+
|
|
6
|
+
import C3SIndicatorsOverviewBlockView from './C3SIndicatorsOverviewBlockView';
|
|
7
|
+
import schema from './schema';
|
|
8
|
+
|
|
9
|
+
export default function C3SIndicatorsOverviewBlockEdit(props) {
|
|
10
|
+
const { block, data, onChangeBlock, selected, id } = props;
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div>
|
|
14
|
+
<C3SIndicatorsOverviewBlockView data={data} id={id} mode="edit" />
|
|
15
|
+
<SidebarPortal selected={selected}>
|
|
16
|
+
<BlockDataForm
|
|
17
|
+
block={block}
|
|
18
|
+
title={schema.title}
|
|
19
|
+
schema={schema}
|
|
20
|
+
onChangeField={(id, value) => {
|
|
21
|
+
onChangeBlock(block, {
|
|
22
|
+
...data,
|
|
23
|
+
[id]: value,
|
|
24
|
+
});
|
|
25
|
+
}}
|
|
26
|
+
onChangeBlock={onChangeBlock}
|
|
27
|
+
formData={data}
|
|
28
|
+
/>
|
|
29
|
+
</SidebarPortal>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/C3SIndicatorsOverviewBlockView.jsx
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import { UniversalLink } from '@plone/volto/components';
|
|
4
|
+
|
|
5
|
+
export default function C3SIndicatorsOverviewBlockView(props) {
|
|
6
|
+
const [pageDescription, setPageDescription] = React.useState('');
|
|
7
|
+
const [indicators, setIndicators] = React.useState([]);
|
|
8
|
+
|
|
9
|
+
const category = props.data.category;
|
|
10
|
+
|
|
11
|
+
const getIndicatorsData = () => {
|
|
12
|
+
const url =
|
|
13
|
+
'/++api++/en/knowledge/european-climate-data-explorer/' +
|
|
14
|
+
category +
|
|
15
|
+
'/@c3s_indicators_overview';
|
|
16
|
+
|
|
17
|
+
axios
|
|
18
|
+
.get(url)
|
|
19
|
+
.then((response) => {
|
|
20
|
+
setPageDescription(response.data.c3s_indicators_overview.description);
|
|
21
|
+
setIndicators(response.data.c3s_indicators_overview.items);
|
|
22
|
+
})
|
|
23
|
+
.catch((error) => {
|
|
24
|
+
// console.error(error);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
getIndicatorsData();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div className="block c3sindicators-overview-block">
|
|
34
|
+
<div
|
|
35
|
+
className="description"
|
|
36
|
+
dangerouslySetInnerHTML={{
|
|
37
|
+
__html: pageDescription,
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
{indicators ? (
|
|
42
|
+
<ul>
|
|
43
|
+
{indicators.map((item, index) => (
|
|
44
|
+
<li key={index}>
|
|
45
|
+
<UniversalLink href={item.url}>{item.title}</UniversalLink>
|
|
46
|
+
</li>
|
|
47
|
+
))}
|
|
48
|
+
</ul>
|
|
49
|
+
) : (
|
|
50
|
+
<p>Loading...</p>
|
|
51
|
+
)}
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import zoomSVG from '@plone/volto/icons/zoom.svg';
|
|
2
|
+
import C3SIndicatorsOverviewBlockEdit from './C3SIndicatorsOverviewBlockEdit';
|
|
3
|
+
import C3SIndicatorsOverviewBlockView from './C3SIndicatorsOverviewBlockView';
|
|
4
|
+
import { blockAvailableInMission } from '@eeacms/volto-cca-policy/utils';
|
|
5
|
+
|
|
6
|
+
export default function installBlock(config) {
|
|
7
|
+
const blocksConfig = config.blocks.blocksConfig;
|
|
8
|
+
|
|
9
|
+
blocksConfig.c3SIndicatorsOverviewBlock = {
|
|
10
|
+
id: 'c3SIndicatorsOverviewBlock',
|
|
11
|
+
title: 'C3S Indicators Overview',
|
|
12
|
+
icon: zoomSVG,
|
|
13
|
+
group: 'site',
|
|
14
|
+
view: C3SIndicatorsOverviewBlockView,
|
|
15
|
+
edit: C3SIndicatorsOverviewBlockEdit,
|
|
16
|
+
sidebarTab: 1,
|
|
17
|
+
security: {
|
|
18
|
+
addPermission: [],
|
|
19
|
+
view: [],
|
|
20
|
+
},
|
|
21
|
+
variations: [],
|
|
22
|
+
restricted: ({ properties, block }) => {
|
|
23
|
+
return blockAvailableInMission(properties, block);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return config;
|
|
28
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const fields = ['category'];
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'C3S Indicators Overview',
|
|
5
|
+
|
|
6
|
+
fieldsets: [
|
|
7
|
+
{
|
|
8
|
+
id: 'default',
|
|
9
|
+
title: 'Default',
|
|
10
|
+
fields,
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
|
|
14
|
+
properties: {
|
|
15
|
+
category: {
|
|
16
|
+
title: 'Category',
|
|
17
|
+
type: 'string',
|
|
18
|
+
factory: 'Choice',
|
|
19
|
+
choices: [
|
|
20
|
+
['health', 'Health'],
|
|
21
|
+
['agriculture', 'Agriculture'],
|
|
22
|
+
['forestry', 'Forestry'],
|
|
23
|
+
['energy', 'Energy'],
|
|
24
|
+
['tourism', 'Tourism'],
|
|
25
|
+
['water-and-coastal', 'Water and Coastal'],
|
|
26
|
+
],
|
|
27
|
+
default: 'health',
|
|
28
|
+
description: 'Choose indicators category to be used as filter.',
|
|
29
|
+
required: true,
|
|
30
|
+
noValueOption: false,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
required: [],
|
|
35
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SidebarPortal } from '@plone/volto/components';
|
|
3
|
+
import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
|
|
4
|
+
import ReadMoreView from './ReadMoreView';
|
|
5
|
+
import schema from './schema';
|
|
6
|
+
|
|
7
|
+
const ReadMoreEdit = (props) => {
|
|
8
|
+
const { block, data, onChangeBlock, selected, id } = props;
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<ReadMoreView data={data} id={id} mode="edit" />
|
|
13
|
+
|
|
14
|
+
<SidebarPortal selected={selected}>
|
|
15
|
+
<BlockDataForm
|
|
16
|
+
block={block}
|
|
17
|
+
title={schema.title}
|
|
18
|
+
schema={schema}
|
|
19
|
+
onChangeField={(id, value) => {
|
|
20
|
+
onChangeBlock(block, {
|
|
21
|
+
...data,
|
|
22
|
+
[id]: value,
|
|
23
|
+
});
|
|
24
|
+
}}
|
|
25
|
+
onChangeBlock={onChangeBlock}
|
|
26
|
+
formData={data}
|
|
27
|
+
/>
|
|
28
|
+
</SidebarPortal>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
export default ReadMoreEdit;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, Icon } from 'semantic-ui-react';
|
|
3
|
+
import { BodyClass } from '@plone/volto/helpers';
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
|
|
6
|
+
import './style.less';
|
|
7
|
+
|
|
8
|
+
const ReadMoreView = (props) => {
|
|
9
|
+
const { data, mode } = props;
|
|
10
|
+
const isEditMode = mode === 'edit';
|
|
11
|
+
const { label_opened, label_closed, label_position, height } = data;
|
|
12
|
+
|
|
13
|
+
const [isReadMore, setIsReadMore] = React.useState(true);
|
|
14
|
+
const [wrapperHeight, setWrapperHeight] = React.useState(height);
|
|
15
|
+
const [mounted, setMounted] = React.useState(false);
|
|
16
|
+
const readMoreRef = React.createRef();
|
|
17
|
+
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
setMounted(true);
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
if (isEditMode || !mounted) return;
|
|
24
|
+
|
|
25
|
+
const button = readMoreRef.current;
|
|
26
|
+
const wrapper = document.createElement('div');
|
|
27
|
+
wrapper.className = 'panel-wrapper';
|
|
28
|
+
|
|
29
|
+
const nodes = [];
|
|
30
|
+
let prev_elem = button.previousSibling;
|
|
31
|
+
while (prev_elem) {
|
|
32
|
+
nodes.push(prev_elem);
|
|
33
|
+
prev_elem = prev_elem.previousSibling;
|
|
34
|
+
}
|
|
35
|
+
const section = document.getElementsByClassName('panel-wrapper');
|
|
36
|
+
if (section.length > 0) return;
|
|
37
|
+
|
|
38
|
+
Array.from(nodes).forEach((e) => {
|
|
39
|
+
wrapper.appendChild(e);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
button.parentNode.insertBefore(wrapper, button);
|
|
43
|
+
wrapper.append(...Array.from(wrapper.childNodes).reverse());
|
|
44
|
+
}, [mounted, readMoreRef, isEditMode]);
|
|
45
|
+
|
|
46
|
+
React.useEffect(() => {
|
|
47
|
+
if (isEditMode || !mounted) return;
|
|
48
|
+
|
|
49
|
+
const wrapper = document.getElementsByClassName('panel-wrapper')[0];
|
|
50
|
+
|
|
51
|
+
if (wrapper) {
|
|
52
|
+
wrapper.style.height = wrapperHeight;
|
|
53
|
+
}
|
|
54
|
+
}, [mounted, wrapperHeight, isEditMode]);
|
|
55
|
+
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
isReadMore ? setWrapperHeight(height) : setWrapperHeight('auto');
|
|
58
|
+
}, [height, isReadMore]);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
ref={readMoreRef}
|
|
63
|
+
id="read-more-button"
|
|
64
|
+
className={cx('styled-readMoreBlock', {
|
|
65
|
+
left: label_position === 'left',
|
|
66
|
+
right: label_position === 'right',
|
|
67
|
+
})}
|
|
68
|
+
>
|
|
69
|
+
<BodyClass className={`${isReadMore ? 'closed' : 'opened'}`} />
|
|
70
|
+
<Button basic icon primary onClick={() => setIsReadMore(!isReadMore)}>
|
|
71
|
+
{isReadMore ? (
|
|
72
|
+
<>
|
|
73
|
+
<strong>{label_closed || 'Read more'}</strong>
|
|
74
|
+
<Icon className="ri-arrow-down-s-line" />
|
|
75
|
+
</>
|
|
76
|
+
) : (
|
|
77
|
+
<>
|
|
78
|
+
<strong>{label_opened || 'Read less'}</strong>
|
|
79
|
+
<Icon className="ri-arrow-up-s-line" />
|
|
80
|
+
</>
|
|
81
|
+
)}
|
|
82
|
+
</Button>
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
export default ReadMoreView;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import ReadMoreEdit from './ReadMoreEdit';
|
|
2
|
+
import ReadMoreView from './ReadMoreView';
|
|
3
|
+
import iconSVG from '@plone/volto/icons/divide-horizontal.svg';
|
|
4
|
+
|
|
5
|
+
export default function installBlock(config) {
|
|
6
|
+
config.blocks.blocksConfig.readMoreBlock = {
|
|
7
|
+
id: 'readMoreBlock',
|
|
8
|
+
title: 'Read more',
|
|
9
|
+
icon: iconSVG,
|
|
10
|
+
group: 'site',
|
|
11
|
+
edit: ReadMoreEdit,
|
|
12
|
+
view: ReadMoreView,
|
|
13
|
+
mostUsed: false,
|
|
14
|
+
sidebarTab: 1,
|
|
15
|
+
security: {
|
|
16
|
+
addPermission: [],
|
|
17
|
+
view: [],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return config;
|
|
22
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: 'Read more',
|
|
3
|
+
fieldsets: [
|
|
4
|
+
{
|
|
5
|
+
id: 'default',
|
|
6
|
+
title: 'Default',
|
|
7
|
+
fields: ['label_closed', 'label_opened', 'label_position', 'height'],
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
properties: {
|
|
11
|
+
label_closed: {
|
|
12
|
+
title: 'Closed button',
|
|
13
|
+
default: 'Read more',
|
|
14
|
+
},
|
|
15
|
+
label_opened: {
|
|
16
|
+
title: 'Opened button',
|
|
17
|
+
default: 'Read less',
|
|
18
|
+
},
|
|
19
|
+
label_position: {
|
|
20
|
+
title: 'Button position',
|
|
21
|
+
choices: [
|
|
22
|
+
['left', 'Left'],
|
|
23
|
+
['right', 'Right'],
|
|
24
|
+
],
|
|
25
|
+
default: 'right',
|
|
26
|
+
},
|
|
27
|
+
height: {
|
|
28
|
+
title: (
|
|
29
|
+
<a
|
|
30
|
+
rel="noreferrer"
|
|
31
|
+
target="_blank"
|
|
32
|
+
href="https://developer.mozilla.org/en-US/docs/Web/CSS/height"
|
|
33
|
+
>
|
|
34
|
+
CSS height
|
|
35
|
+
</a>
|
|
36
|
+
),
|
|
37
|
+
default: '50vh',
|
|
38
|
+
description: 'Visible section height',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
required: [],
|
|
42
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.styled-readMoreBlock {
|
|
2
|
+
display: flex;
|
|
3
|
+
margin: 1.5em 0;
|
|
4
|
+
|
|
5
|
+
&.right {
|
|
6
|
+
flex-direction: row-reverse;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
button {
|
|
10
|
+
display: flex !important;
|
|
11
|
+
align-items: center !important;
|
|
12
|
+
font-size: 18px !important;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
i.icon {
|
|
16
|
+
font-size: 26px !important;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body.closed {
|
|
21
|
+
.panel-wrapper {
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
-webkit-mask-image: linear-gradient(180deg, #000 70%, transparent);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -11,6 +11,8 @@ import installCountryMapHeatIndex from './CountryMapHeatIndex';
|
|
|
11
11
|
import installCountryMapProfile from './CountryMapProfile';
|
|
12
12
|
import installListing from './Listing';
|
|
13
13
|
import installRAST from './RASTBlock';
|
|
14
|
+
import installC3SIndicatorsOverviewBlock from './C3SIndicatorsOverviewBlock';
|
|
15
|
+
import installReadMore from './ReadMore';
|
|
14
16
|
|
|
15
17
|
export default function installBlocks(config) {
|
|
16
18
|
config.blocks.blocksConfig.title.restricted = false;
|
|
@@ -18,6 +20,8 @@ export default function installBlocks(config) {
|
|
|
18
20
|
|
|
19
21
|
return compose(
|
|
20
22
|
installRAST,
|
|
23
|
+
installReadMore,
|
|
24
|
+
installC3SIndicatorsOverviewBlock,
|
|
21
25
|
installMKHMap,
|
|
22
26
|
installECDEIndicatorsBlock,
|
|
23
27
|
installCaseStudyExplorerBlock,
|
|
@@ -20,6 +20,7 @@ import { usePrevious } from '@eeacms/volto-eea-design-system/helpers';
|
|
|
20
20
|
import { find } from 'lodash';
|
|
21
21
|
import globeIcon from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/global-line.svg';
|
|
22
22
|
import eeaFlag from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/eea.png';
|
|
23
|
+
import { toPublicURL } from '@plone/volto/helpers';
|
|
23
24
|
|
|
24
25
|
import config from '@plone/volto/registry';
|
|
25
26
|
import { compose } from 'recompose';
|
|
@@ -72,7 +73,7 @@ const EEAHeader = ({ pathname, token, items, history, subsite }) => {
|
|
|
72
73
|
return removeTrailingSlash(state.router?.location?.pathname) || '';
|
|
73
74
|
});
|
|
74
75
|
|
|
75
|
-
const isSubsite = subsite?.['@type']
|
|
76
|
+
const isSubsite = ['Folder', 'Subsite'].indexOf(subsite?.['@type']) > -1;
|
|
76
77
|
|
|
77
78
|
const isHomePageInverse = useSelector((state) => {
|
|
78
79
|
const layout = state.content?.data?.layout;
|
|
@@ -115,6 +116,11 @@ const EEAHeader = ({ pathname, token, items, history, subsite }) => {
|
|
|
115
116
|
}
|
|
116
117
|
}, [token, dispatch, pathname, previousToken]);
|
|
117
118
|
|
|
119
|
+
const subsiteLogo = subsite?.subsite_logo
|
|
120
|
+
? subsite.subsite_logo.scales?.preview?.download ||
|
|
121
|
+
toPublicURL(`${subsite['@id']}/@@images/subsite_logo`)
|
|
122
|
+
: null;
|
|
123
|
+
|
|
118
124
|
return (
|
|
119
125
|
<Header menuItems={items}>
|
|
120
126
|
{isHomePageInverse && <BodyClass className="homepage" />}
|
|
@@ -233,12 +239,12 @@ const EEAHeader = ({ pathname, token, items, history, subsite }) => {
|
|
|
233
239
|
inverted={isHomePageInverse ? true : false}
|
|
234
240
|
transparency={isHomePageInverse ? true : false}
|
|
235
241
|
logo={
|
|
236
|
-
<div {
|
|
237
|
-
{
|
|
242
|
+
<div className={isSubsite && 'logo-wrapper'}>
|
|
243
|
+
{subsite?.title ? (
|
|
238
244
|
<>
|
|
239
245
|
{subsite.subsite_logo ? (
|
|
240
246
|
<Logo
|
|
241
|
-
src={
|
|
247
|
+
src={subsiteLogo}
|
|
242
248
|
title={subsite.title}
|
|
243
249
|
alt={subsite.title}
|
|
244
250
|
url={flattenToAppURL(subsite['@id'])}
|
|
@@ -110,7 +110,7 @@ const SelectCountries = (props) => {
|
|
|
110
110
|
key={country.code}
|
|
111
111
|
value={country.code}
|
|
112
112
|
label={country.name}
|
|
113
|
-
checked={countries
|
|
113
|
+
checked={countries?.includes(country.code) || false}
|
|
114
114
|
onChange={handleSelect}
|
|
115
115
|
/>
|
|
116
116
|
))}
|
|
@@ -131,14 +131,6 @@ const GeocharsWidget = (props) => {
|
|
|
131
131
|
);
|
|
132
132
|
const [selectedCity, setSelectedCity] = useState('');
|
|
133
133
|
|
|
134
|
-
const geoElements = JSON.parse(value).geoElements;
|
|
135
|
-
const element = geoElements.element;
|
|
136
|
-
const countries = geoElements.countries;
|
|
137
|
-
const macroRegions = geoElements.macrotrans;
|
|
138
|
-
const bioRegions = geoElements.biotrans;
|
|
139
|
-
const subRegions = geoElements.subnational;
|
|
140
|
-
const city = geoElements.city;
|
|
141
|
-
|
|
142
134
|
const DEFAULT_GEOCHARS = {
|
|
143
135
|
geoElements: {
|
|
144
136
|
element: 'GLOBAL',
|
|
@@ -150,6 +142,21 @@ const GeocharsWidget = (props) => {
|
|
|
150
142
|
},
|
|
151
143
|
};
|
|
152
144
|
|
|
145
|
+
let geoElements;
|
|
146
|
+
|
|
147
|
+
if (value !== null) {
|
|
148
|
+
geoElements = JSON.parse(value).geoElements;
|
|
149
|
+
} else {
|
|
150
|
+
geoElements = DEFAULT_GEOCHARS;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const element = geoElements.element;
|
|
154
|
+
const countries = geoElements.countries;
|
|
155
|
+
const macroRegions = geoElements.macrotrans;
|
|
156
|
+
const bioRegions = geoElements.biotrans;
|
|
157
|
+
const subRegions = geoElements.subnational;
|
|
158
|
+
const city = geoElements.city;
|
|
159
|
+
|
|
153
160
|
const getJSON = () => {
|
|
154
161
|
return JSON.parse(value);
|
|
155
162
|
};
|
|
@@ -56,6 +56,11 @@ const GeolocationWidget = (props) => {
|
|
|
56
56
|
setAddress(event.target.value);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
+
const defaultValue = {
|
|
60
|
+
latitude: 55.6761,
|
|
61
|
+
longitude: 12.5683,
|
|
62
|
+
};
|
|
63
|
+
|
|
59
64
|
const handleSearch = (e) => {
|
|
60
65
|
e.preventDefault();
|
|
61
66
|
|
|
@@ -101,9 +106,11 @@ const GeolocationWidget = (props) => {
|
|
|
101
106
|
</div>
|
|
102
107
|
</div>
|
|
103
108
|
<MapContainer
|
|
104
|
-
key={`${value.latitude}_${
|
|
105
|
-
|
|
106
|
-
|
|
109
|
+
key={`${value?.latitude || defaultValue.latitude}_${
|
|
110
|
+
value?.longitude || defaultValue.longitude
|
|
111
|
+
}`}
|
|
112
|
+
longitude={value?.longitude || defaultValue.longitude}
|
|
113
|
+
latitude={value?.latitude || defaultValue.latitude}
|
|
107
114
|
source={tileWMSSources[0]}
|
|
108
115
|
/>
|
|
109
116
|
<div className="ui form">
|
|
@@ -112,14 +119,14 @@ const GeolocationWidget = (props) => {
|
|
|
112
119
|
<Input
|
|
113
120
|
type="number"
|
|
114
121
|
placeholder="latitude"
|
|
115
|
-
value={value.latitude}
|
|
122
|
+
value={value?.latitude || defaultValue.latitude}
|
|
116
123
|
/>
|
|
117
124
|
</div>
|
|
118
125
|
<div className="field">
|
|
119
126
|
<Input
|
|
120
127
|
type="number"
|
|
121
128
|
placeholder="longitude"
|
|
122
|
-
value={value.longitude}
|
|
129
|
+
value={value?.longitude || defaultValue.longitude}
|
|
123
130
|
/>
|
|
124
131
|
</div>
|
|
125
132
|
</div>
|
|
@@ -69,7 +69,6 @@ const DefaultView = (props) => {
|
|
|
69
69
|
let currentNavigation = config.settings.contextNavigationLocations.find(
|
|
70
70
|
(element) => location.pathname.indexOf(element.rootPath) > -1,
|
|
71
71
|
);
|
|
72
|
-
// console.log('CurrentNavigation', currentNavigation);
|
|
73
72
|
|
|
74
73
|
const gridColumns =
|
|
75
74
|
currentNavigation && currentNavigation?.columns
|
package/src/index.js
CHANGED
|
@@ -14,6 +14,8 @@ import ToolView from './components/theme/Views/ToolView';
|
|
|
14
14
|
import VideoView from './components/theme/Views/VideoView';
|
|
15
15
|
import C3SIndicatorView from './components/theme/Views/C3SIndicatorView';
|
|
16
16
|
|
|
17
|
+
import HealthHorizontalCardItem from './components/Result/HealthHorizontalCardItem';
|
|
18
|
+
|
|
17
19
|
import ccaLogo from '@eeacms/volto-cca-policy/../theme/assets/images/Header/climate-adapt-logo.svg';
|
|
18
20
|
import eeaWhiteLogo from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/logo/eea-logo-white.svg';
|
|
19
21
|
import europeanComissionLogo from '@eeacms/volto-cca-policy/../theme/assets/images/Footer/ec_logo.svg';
|
|
@@ -270,6 +272,11 @@ const applyConfig = (config) => {
|
|
|
270
272
|
},
|
|
271
273
|
];
|
|
272
274
|
|
|
275
|
+
// Custom results
|
|
276
|
+
config.settings.searchlib.resolve.HealthHorizontalCardItem = {
|
|
277
|
+
component: HealthHorizontalCardItem,
|
|
278
|
+
};
|
|
279
|
+
|
|
273
280
|
// Custom widgets
|
|
274
281
|
config.widgets.id.geochars = GeocharsWidget;
|
|
275
282
|
config.widgets.id.geolocation = GeolocationWidget;
|
|
@@ -2,8 +2,8 @@ import { mergeConfig } from '@eeacms/search';
|
|
|
2
2
|
import { build_runtime_mappings } from '@eeacms/volto-globalsearch/utils';
|
|
3
3
|
|
|
4
4
|
import facets from './facets-health';
|
|
5
|
+
import views from './views-health';
|
|
5
6
|
|
|
6
|
-
// import views from './views';
|
|
7
7
|
// import filters from './filters';
|
|
8
8
|
// import vocabs from './vocabulary';
|
|
9
9
|
|
|
@@ -16,6 +16,7 @@ const getClientProxyAddress = () => {
|
|
|
16
16
|
|
|
17
17
|
const ccaConfig = {
|
|
18
18
|
title: 'ClimateAdapt Health',
|
|
19
|
+
...views,
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
export const clusters = {
|
|
@@ -80,6 +81,7 @@ export default function installMainSearch(config) {
|
|
|
80
81
|
});
|
|
81
82
|
|
|
82
83
|
ccaHealthSearch.facets = facets;
|
|
84
|
+
// ccaHealthSearch.views = views;
|
|
83
85
|
|
|
84
86
|
ccaHealthSearch.initialView.tilesLandingPageParams.sections = [
|
|
85
87
|
{
|
|
@@ -104,6 +106,12 @@ export default function installMainSearch(config) {
|
|
|
104
106
|
'Heat',
|
|
105
107
|
],
|
|
106
108
|
},
|
|
109
|
+
{
|
|
110
|
+
id: 'observatoryPartner',
|
|
111
|
+
title: 'Observatory partner',
|
|
112
|
+
facetField: 'cca_partner_contributors.keyword',
|
|
113
|
+
sortOn: 'alpha',
|
|
114
|
+
},
|
|
107
115
|
];
|
|
108
116
|
|
|
109
117
|
if (typeof window !== 'undefined') {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
resultViews: [
|
|
3
|
+
{
|
|
4
|
+
id: 'healthHorizontalCardItem',
|
|
5
|
+
title: 'Health catalogue items',
|
|
6
|
+
icon: 'bars',
|
|
7
|
+
render: null,
|
|
8
|
+
isDefault: true,
|
|
9
|
+
factories: {
|
|
10
|
+
view: 'HorizontalCard.Group',
|
|
11
|
+
item: 'HealthHorizontalCardItem',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
};
|