@eeacms/volto-cca-policy 0.1.96 → 0.1.97
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 +29 -0
- package/package.json +2 -2
- package/src/components/MigrationButtons.jsx +20 -3
- package/src/components/index.js +1 -0
- package/src/components/manage/Blocks/Listing/IndicatorCardsListingView.jsx +4 -2
- package/src/components/manage/Blocks/Listing/OrganisationCardsListingView.jsx +9 -4
- package/src/components/theme/Header/LanguageSwitch.jsx +106 -0
- package/src/{helpers/ShareInfo.jsx → components/theme/ShareInfoButton/ShareInfoButton.jsx} +2 -2
- package/src/components/theme/Views/AdaptationOptionView.jsx +2 -2
- package/src/components/theme/Views/CaseStudyView.jsx +2 -2
- package/src/components/theme/Views/DatabaseItemView.jsx +23 -7
- package/src/components/theme/Views/ProjectView.jsx +2 -2
- package/src/components/theme/Views/VideoView.jsx +2 -2
- package/src/components/theme/Widgets/GeocharsWidget.jsx +1 -1
- package/src/components/theme/Widgets/utils.js +43 -0
- package/src/customizations/volto/components/manage/Multilingual/README.md +5 -0
- package/src/customizations/volto/components/manage/Multilingual/TranslationObject.jsx +157 -0
- package/src/customizations/volto/components/theme/Header/Header.jsx +1 -1
- package/src/express-middleware.js +1 -0
- package/src/helpers/Constants.jsx +0 -37
- package/src/helpers/ContentMetadata.jsx +2 -2
- package/src/helpers/Utils.jsx +0 -4
- package/src/helpers/index.js +8 -38
- package/theme/extras/header.overrides +17 -0
- package/src/components/manage/Blocks/Listing/common.js +0 -3
- package/src/components/theme/LanguageSwitch.jsx +0 -75
- /package/src/components/theme/{Header.jsx → Header/Header.jsx} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,27 @@ 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.97](https://github.com/eea/volto-cca-policy/compare/0.1.96...0.1.97) - 19 March 2024
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: disable language from dropdown if there is no translation available [kreafox - [`016fda3`](https://github.com/eea/volto-cca-policy/commit/016fda3e3896c14a514544dd61c42dc0598c0d40)]
|
|
12
|
+
|
|
13
|
+
#### :bug: Bug Fixes
|
|
14
|
+
|
|
15
|
+
- fix: change language on observatory metadata item [kreafox - [`8c70250`](https://github.com/eea/volto-cca-policy/commit/8c70250944fa7619bdc6082a2c7afb0cbe9fb9fd)]
|
|
16
|
+
|
|
17
|
+
#### :house: Internal changes
|
|
18
|
+
|
|
19
|
+
- style: Automated code fix [eea-jenkins - [`0d2cc5b`](https://github.com/eea/volto-cca-policy/commit/0d2cc5ba821fb00bc8653597698718f9b459128f)]
|
|
20
|
+
- chore: cleanup, remove unused code [kreafox - [`58e9b0f`](https://github.com/eea/volto-cca-policy/commit/58e9b0f00dda8858be02c7afeef6652acb3f55ec)]
|
|
21
|
+
- chore: code cleanup + refactor [kreafox - [`ec71f50`](https://github.com/eea/volto-cca-policy/commit/ec71f50b0da87b28bf36b0ba1d2fee4ad4a55b88)]
|
|
22
|
+
|
|
23
|
+
#### :hammer_and_wrench: Others
|
|
24
|
+
|
|
25
|
+
- Add sync translation button [Tiberiu Ichim - [`d1870df`](https://github.com/eea/volto-cca-policy/commit/d1870df49a3c6e0a450904370eaba0e9fa1d9a46)]
|
|
26
|
+
- Add customization that solves adding translations from the web [Tiberiu Ichim - [`af9a8e1`](https://github.com/eea/volto-cca-policy/commit/af9a8e174622e940bb6d8091e7c7bc3befbab05e)]
|
|
27
|
+
- i18n for database item [kreafox - [`6188d2d`](https://github.com/eea/volto-cca-policy/commit/6188d2d4bc50801790d9bb4fad83aebb31e525ff)]
|
|
7
28
|
### [0.1.96](https://github.com/eea/volto-cca-policy/compare/0.1.95...0.1.96) - 19 March 2024
|
|
8
29
|
|
|
9
30
|
#### :rocket: New Features
|
|
@@ -709,10 +730,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
709
730
|
- Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
|
|
710
731
|
- Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
|
|
711
732
|
- Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
|
|
733
|
+
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
|
|
734
|
+
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
|
|
712
735
|
### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
|
|
713
736
|
|
|
714
737
|
#### :house: Internal changes
|
|
715
738
|
|
|
739
|
+
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
|
|
716
740
|
- chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
|
|
717
741
|
|
|
718
742
|
#### :hammer_and_wrench: Others
|
|
@@ -729,6 +753,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
729
753
|
- Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
|
|
730
754
|
- Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
|
|
731
755
|
- Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
|
|
756
|
+
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
|
|
757
|
+
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
|
|
758
|
+
- test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
|
|
732
759
|
- Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
|
|
733
760
|
- Refs #256681 - Fix error in CCA Event view menu. ([React Intl] An id must be provided to format a message.) [GhitaB - [`517eeb8`](https://github.com/eea/volto-cca-policy/commit/517eeb817264a47bbfd6b9b7d22aaf22d44ed224)]
|
|
734
761
|
- Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
|
|
@@ -945,6 +972,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
945
972
|
|
|
946
973
|
#### :house: Internal changes
|
|
947
974
|
|
|
975
|
+
- chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
|
|
948
976
|
|
|
949
977
|
#### :hammer_and_wrench: Others
|
|
950
978
|
|
|
@@ -1425,6 +1453,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
1425
1453
|
#### :hammer_and_wrench: Others
|
|
1426
1454
|
|
|
1427
1455
|
- Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
|
|
1456
|
+
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
|
|
1428
1457
|
### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
|
|
1429
1458
|
|
|
1430
1459
|
#### :hammer_and_wrench: Others
|
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.97",
|
|
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",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"@eeacms/volto-widget-dataprovenance": "*",
|
|
42
42
|
"@eeacms/volto-widget-geolocation": "*",
|
|
43
43
|
"@eeacms/volto-widget-temporal-coverage": "*",
|
|
44
|
+
"d3-array": "^2.12.1",
|
|
44
45
|
"jotai": "^1.6.0",
|
|
45
46
|
"query-string": "7.1.0",
|
|
46
|
-
"d3-array": "^2.12.1",
|
|
47
47
|
"react-visibility-sensor": "5.1.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plug } from '@plone/volto/components/manage/Pluggable';
|
|
2
|
-
import { getBaseUrl } from '@plone/volto/helpers';
|
|
2
|
+
import { getBaseUrl, toPublicURL } from '@plone/volto/helpers';
|
|
3
3
|
|
|
4
4
|
const button = (id, title, label, destination) => (
|
|
5
5
|
<button
|
|
@@ -15,9 +15,9 @@ const button = (id, title, label, destination) => (
|
|
|
15
15
|
function MigrationButtons(props) {
|
|
16
16
|
const { content, token, pathname } = props;
|
|
17
17
|
const contentId = content?.['@id'] || '';
|
|
18
|
-
const show = !!token && contentId
|
|
18
|
+
const show = !!token && contentId;
|
|
19
19
|
const base = getBaseUrl(pathname);
|
|
20
|
-
|
|
20
|
+
let buttons = [
|
|
21
21
|
button(
|
|
22
22
|
'migration',
|
|
23
23
|
'Migrate context',
|
|
@@ -48,8 +48,25 @@ function MigrationButtons(props) {
|
|
|
48
48
|
'P',
|
|
49
49
|
`http://localhost:8080/cca/${base}/@@volto-html?half=1`,
|
|
50
50
|
),
|
|
51
|
+
button(
|
|
52
|
+
'sync-translations',
|
|
53
|
+
'Sync Translations',
|
|
54
|
+
'RT',
|
|
55
|
+
toPublicURL(`${base}/@@translate-this-async`),
|
|
56
|
+
),
|
|
51
57
|
];
|
|
52
58
|
|
|
59
|
+
if (contentId.indexOf('europa.eu') > -1) {
|
|
60
|
+
buttons = [
|
|
61
|
+
button(
|
|
62
|
+
'sync-translations',
|
|
63
|
+
'Sync Translations',
|
|
64
|
+
'T',
|
|
65
|
+
`/${base}/@@translate-this-async`,
|
|
66
|
+
),
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
|
|
53
70
|
if (!show) return null;
|
|
54
71
|
|
|
55
72
|
return (
|
package/src/components/index.js
CHANGED
|
@@ -2,3 +2,4 @@ export ImageGallery from './theme/ImageGallery/ImageGallery';
|
|
|
2
2
|
export BannerTitle from './theme/BannerTitle/BannerTitle';
|
|
3
3
|
export PortalMessage from './theme/PortalMessage/PortalMessage';
|
|
4
4
|
export TranslationDisclaimer from './theme/TranslationDisclaimer/TranslationDisclaimer';
|
|
5
|
+
export ShareInfoButton from './theme/ShareInfoButton/ShareInfoButton';
|
|
@@ -5,7 +5,7 @@ import { compose } from 'redux';
|
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import { ConditionalLink } from '@plone/volto/components';
|
|
7
7
|
import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers';
|
|
8
|
-
import {
|
|
8
|
+
import { makeObservatoryMetadataURL } from '@eeacms/volto-cca-policy/helpers';
|
|
9
9
|
import './styles.less';
|
|
10
10
|
|
|
11
11
|
const fixedTitles = {
|
|
@@ -28,7 +28,9 @@ const IndicatorCardsListingView = ({ items, isEditMode, token }) => {
|
|
|
28
28
|
<div className="wrapper">
|
|
29
29
|
<div className="slot-top">
|
|
30
30
|
<ConditionalLink
|
|
31
|
-
to={flattenToAppURL(
|
|
31
|
+
to={flattenToAppURL(
|
|
32
|
+
getBaseUrl(makeObservatoryMetadataURL(item['@id'])),
|
|
33
|
+
)}
|
|
32
34
|
condition={!isEditMode}
|
|
33
35
|
>
|
|
34
36
|
<div className="listing-body">
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
makeContributionsSearchQuery,
|
|
5
|
+
makeObservatoryMetadataURL,
|
|
6
|
+
} from '@eeacms/volto-cca-policy/helpers';
|
|
5
7
|
import { UniversalLink } from '@plone/volto/components';
|
|
6
8
|
|
|
7
9
|
import './styles.less';
|
|
@@ -23,7 +25,10 @@ const OrganisationCardsListingView = ({ items }) => {
|
|
|
23
25
|
<div className="ui fluid card u-card" key={item['@id']}>
|
|
24
26
|
<div className="content">
|
|
25
27
|
<div className="header">
|
|
26
|
-
<UniversalLink
|
|
28
|
+
<UniversalLink
|
|
29
|
+
className="image"
|
|
30
|
+
href={makeObservatoryMetadataURL(item['@id'])}
|
|
31
|
+
>
|
|
27
32
|
<div className="img-container">
|
|
28
33
|
<img
|
|
29
34
|
src={item['@id'] + '/@@images/logo/preview'}
|
|
@@ -34,7 +39,7 @@ const OrganisationCardsListingView = ({ items }) => {
|
|
|
34
39
|
</UniversalLink>
|
|
35
40
|
<UniversalLink
|
|
36
41
|
className="header-link org-name"
|
|
37
|
-
href={
|
|
42
|
+
href={makeObservatoryMetadataURL(item['@id'])}
|
|
38
43
|
>
|
|
39
44
|
{item.title}
|
|
40
45
|
</UniversalLink>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { find } from 'lodash';
|
|
3
|
+
import { useAtom } from 'jotai';
|
|
4
|
+
import { useSelector } from 'react-redux';
|
|
5
|
+
import { Dropdown, Image } from 'semantic-ui-react';
|
|
6
|
+
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
7
|
+
import config from '@plone/volto/registry';
|
|
8
|
+
import { useLocation } from 'react-router-dom';
|
|
9
|
+
import { Header } from '@eeacms/volto-eea-design-system/ui';
|
|
10
|
+
import {
|
|
11
|
+
isObservatoryMetadataURL,
|
|
12
|
+
makeObservatoryMetadataURL,
|
|
13
|
+
} from '@eeacms/volto-cca-policy/helpers';
|
|
14
|
+
import cx from 'classnames';
|
|
15
|
+
|
|
16
|
+
import { selectedLanguageAtom } from '../../../state';
|
|
17
|
+
import globeIcon from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/global-line.svg';
|
|
18
|
+
|
|
19
|
+
export default function LanguageSwitch({ history }) {
|
|
20
|
+
const { eea } = config.settings;
|
|
21
|
+
const location = useLocation();
|
|
22
|
+
const isObservatoryItem = isObservatoryMetadataURL(location.pathname);
|
|
23
|
+
const translations = useSelector(
|
|
24
|
+
(state) => state.content.data?.['@components']?.translations?.items,
|
|
25
|
+
);
|
|
26
|
+
const [, setSelectedLanguage] = useAtom(selectedLanguageAtom);
|
|
27
|
+
const width = useSelector((state) => state.screen?.width);
|
|
28
|
+
|
|
29
|
+
const currentLang = useSelector((state) => state.intl.locale);
|
|
30
|
+
const [language, setLanguage] = React.useState(
|
|
31
|
+
currentLang || eea.defaultLanguage,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const handlePageRedirect = (item) => {
|
|
35
|
+
const searchParams = new URLSearchParams();
|
|
36
|
+
const translation = find(translations, {
|
|
37
|
+
language: item.code,
|
|
38
|
+
});
|
|
39
|
+
const url = translation
|
|
40
|
+
? flattenToAppURL(translation['@id'])
|
|
41
|
+
: `/${item.code}`;
|
|
42
|
+
const to = isObservatoryItem ? makeObservatoryMetadataURL(url) : url;
|
|
43
|
+
|
|
44
|
+
setLanguage(item.code);
|
|
45
|
+
setSelectedLanguage(item.code);
|
|
46
|
+
searchParams.set('set_language', item.code);
|
|
47
|
+
|
|
48
|
+
history.push({
|
|
49
|
+
pathname: to,
|
|
50
|
+
search: searchParams.toString(),
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Header.TopDropdownMenu
|
|
56
|
+
id="language-switcher"
|
|
57
|
+
className="item"
|
|
58
|
+
hasLanguageDropdown={
|
|
59
|
+
config.settings.supportedLanguages.length > 1 &&
|
|
60
|
+
config.settings.hasLanguageDropdown
|
|
61
|
+
}
|
|
62
|
+
text={`${language.toUpperCase()}`}
|
|
63
|
+
mobileText={`${language.toUpperCase()}`}
|
|
64
|
+
icon={<Image src={globeIcon} alt="language dropdown globe icon"></Image>}
|
|
65
|
+
viewportWidth={width}
|
|
66
|
+
>
|
|
67
|
+
<ul
|
|
68
|
+
className="wrapper language-list"
|
|
69
|
+
role="listbox"
|
|
70
|
+
aria-label="language switcher"
|
|
71
|
+
>
|
|
72
|
+
{eea.languages.map((item, index) => {
|
|
73
|
+
const translated = (translations || []).some(
|
|
74
|
+
(obj) => obj.language === item.code,
|
|
75
|
+
);
|
|
76
|
+
const active = item.code === currentLang;
|
|
77
|
+
const disabled = !translated && !active;
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<Dropdown.Item
|
|
81
|
+
className={cx({
|
|
82
|
+
disabled: disabled,
|
|
83
|
+
active: active,
|
|
84
|
+
})}
|
|
85
|
+
as="li"
|
|
86
|
+
key={index}
|
|
87
|
+
text={
|
|
88
|
+
<span>
|
|
89
|
+
{item.name}
|
|
90
|
+
<span className="country-code">
|
|
91
|
+
{item.code.toUpperCase()}
|
|
92
|
+
</span>
|
|
93
|
+
</span>
|
|
94
|
+
}
|
|
95
|
+
onClick={(e) =>
|
|
96
|
+
disabled || active
|
|
97
|
+
? e.preventDefault()
|
|
98
|
+
: handlePageRedirect(item)
|
|
99
|
+
}
|
|
100
|
+
></Dropdown.Item>
|
|
101
|
+
);
|
|
102
|
+
})}
|
|
103
|
+
</ul>
|
|
104
|
+
</Header.TopDropdownMenu>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
@@ -3,7 +3,7 @@ import { useSelector } from 'react-redux';
|
|
|
3
3
|
import { Button, Icon } from 'semantic-ui-react';
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const ShareInfoButton = (props) => {
|
|
7
7
|
const currentLang = useSelector((state) => state.intl.locale);
|
|
8
8
|
|
|
9
9
|
return (
|
|
@@ -23,4 +23,4 @@ const ShareInfo = (props) => {
|
|
|
23
23
|
);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
export default
|
|
26
|
+
export default ShareInfoButton;
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
ContentMetadata,
|
|
5
5
|
ReferenceInfo,
|
|
6
6
|
PublishedModifiedInfo,
|
|
7
|
-
ShareInfo,
|
|
8
7
|
BannerTitle,
|
|
9
8
|
ItemLogo,
|
|
10
9
|
} from '@eeacms/volto-cca-policy/helpers';
|
|
11
10
|
import { Segment, Divider, Grid, ListItem, List } from 'semantic-ui-react';
|
|
12
11
|
import { UniversalLink } from '@plone/volto/components';
|
|
13
12
|
import {
|
|
13
|
+
ShareInfoButton,
|
|
14
14
|
PortalMessage,
|
|
15
15
|
TranslationDisclaimer,
|
|
16
16
|
} from '@eeacms/volto-cca-policy/components';
|
|
@@ -230,7 +230,7 @@ function AdaptationOptionView(props) {
|
|
|
230
230
|
<ReferenceInfo content={content} />
|
|
231
231
|
|
|
232
232
|
<PublishedModifiedInfo {...props} />
|
|
233
|
-
<
|
|
233
|
+
<ShareInfoButton {...props} />
|
|
234
234
|
</Grid.Column>
|
|
235
235
|
|
|
236
236
|
<Grid.Column
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
LinksList,
|
|
6
6
|
PublishedModifiedInfo,
|
|
7
7
|
DocumentsList,
|
|
8
|
-
ShareInfo,
|
|
9
8
|
BannerTitle,
|
|
10
9
|
} from '@eeacms/volto-cca-policy/helpers';
|
|
11
10
|
import { Divider, Grid, Icon, Image, ListItem, List } from 'semantic-ui-react';
|
|
12
11
|
import {
|
|
12
|
+
ShareInfoButton,
|
|
13
13
|
ImageGallery,
|
|
14
14
|
PortalMessage,
|
|
15
15
|
TranslationDisclaimer,
|
|
@@ -399,7 +399,7 @@ function CaseStudyView(props) {
|
|
|
399
399
|
</span>
|
|
400
400
|
)
|
|
401
401
|
</p>
|
|
402
|
-
<
|
|
402
|
+
<ShareInfoButton {...props} />
|
|
403
403
|
</Grid.Column>
|
|
404
404
|
<Grid.Column
|
|
405
405
|
mobile={12}
|
|
@@ -13,24 +13,25 @@ import {
|
|
|
13
13
|
ContentMetadata,
|
|
14
14
|
PublishedModifiedInfo,
|
|
15
15
|
ItemLogo,
|
|
16
|
-
ShareInfo,
|
|
17
16
|
ContentRelatedItems,
|
|
18
17
|
DocumentsList,
|
|
19
18
|
BannerTitle,
|
|
20
19
|
} from '@eeacms/volto-cca-policy/helpers';
|
|
21
20
|
import {
|
|
21
|
+
ShareInfoButton,
|
|
22
22
|
PortalMessage,
|
|
23
23
|
TranslationDisclaimer,
|
|
24
24
|
} from '@eeacms/volto-cca-policy/components';
|
|
25
|
-
import {
|
|
25
|
+
import { isObservatoryMetadataURL } from '@eeacms/volto-cca-policy/helpers';
|
|
26
26
|
import { Divider, Grid } from 'semantic-ui-react';
|
|
27
27
|
import { useLocation } from 'react-router-dom';
|
|
28
|
+
import { FormattedMessage } from 'react-intl';
|
|
28
29
|
|
|
29
30
|
const DatabaseItemView = (props) => {
|
|
30
31
|
const { content } = props;
|
|
31
32
|
const type = content['@type'];
|
|
32
33
|
const location = useLocation();
|
|
33
|
-
const isObservatoryItem =
|
|
34
|
+
const isObservatoryItem = isObservatoryMetadataURL(location.pathname);
|
|
34
35
|
const {
|
|
35
36
|
title,
|
|
36
37
|
acronym,
|
|
@@ -105,7 +106,12 @@ const DatabaseItemView = (props) => {
|
|
|
105
106
|
<>
|
|
106
107
|
{organisational_key_activities && (
|
|
107
108
|
<>
|
|
108
|
-
<h3>
|
|
109
|
+
<h3>
|
|
110
|
+
<FormattedMessage
|
|
111
|
+
id="Key activities within climate change and health"
|
|
112
|
+
defaultMessage=" Key activities within climate change and health"
|
|
113
|
+
/>
|
|
114
|
+
</h3>
|
|
109
115
|
<HTMLField value={organisational_key_activities} />
|
|
110
116
|
</>
|
|
111
117
|
)}
|
|
@@ -132,14 +138,24 @@ const DatabaseItemView = (props) => {
|
|
|
132
138
|
<>
|
|
133
139
|
{organisational_websites && (
|
|
134
140
|
<>
|
|
135
|
-
<h5>
|
|
141
|
+
<h5>
|
|
142
|
+
<FormattedMessage
|
|
143
|
+
id="Links to further information"
|
|
144
|
+
defaultMessage="Links to further information"
|
|
145
|
+
/>
|
|
146
|
+
</h5>
|
|
136
147
|
<HTMLField value={organisational_websites} />
|
|
137
148
|
</>
|
|
138
149
|
)}
|
|
139
150
|
|
|
140
151
|
{organisational_contact_information && (
|
|
141
152
|
<>
|
|
142
|
-
<h5>
|
|
153
|
+
<h5>
|
|
154
|
+
<FormattedMessage
|
|
155
|
+
id="Contact information for the Observatory"
|
|
156
|
+
defaultMessage="Contact information for the Observatory"
|
|
157
|
+
/>
|
|
158
|
+
</h5>
|
|
143
159
|
<HTMLField value={organisational_contact_information} />
|
|
144
160
|
</>
|
|
145
161
|
)}
|
|
@@ -148,7 +164,7 @@ const DatabaseItemView = (props) => {
|
|
|
148
164
|
|
|
149
165
|
<ContentRelatedItems {...props} />
|
|
150
166
|
<PublishedModifiedInfo {...props} />
|
|
151
|
-
<
|
|
167
|
+
<ShareInfoButton {...props} />
|
|
152
168
|
</Grid.Column>
|
|
153
169
|
|
|
154
170
|
<Grid.Column
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
HTMLField,
|
|
4
4
|
ContentMetadata,
|
|
5
5
|
PublishedModifiedInfo,
|
|
6
|
-
ShareInfo,
|
|
7
6
|
ItemLogo,
|
|
8
7
|
ReferenceInfo,
|
|
9
8
|
} from '@eeacms/volto-cca-policy/helpers';
|
|
10
9
|
import { Divider, Grid } from 'semantic-ui-react';
|
|
11
10
|
import {
|
|
11
|
+
ShareInfoButton,
|
|
12
12
|
PortalMessage,
|
|
13
13
|
TranslationDisclaimer,
|
|
14
14
|
} from '@eeacms/volto-cca-policy/components';
|
|
@@ -93,7 +93,7 @@ function ProjectView(props) {
|
|
|
93
93
|
<Divider />
|
|
94
94
|
<ReferenceInfo content={content} />
|
|
95
95
|
<PublishedModifiedInfo {...props} />
|
|
96
|
-
<
|
|
96
|
+
<ShareInfoButton {...props} />
|
|
97
97
|
</Grid.Column>
|
|
98
98
|
<Grid.Column
|
|
99
99
|
mobile={12}
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
ReferenceInfo,
|
|
5
5
|
ContentMetadata,
|
|
6
6
|
ExternalLink,
|
|
7
|
-
ShareInfo,
|
|
8
7
|
BannerTitle,
|
|
9
8
|
} from '@eeacms/volto-cca-policy/helpers';
|
|
10
9
|
import { Divider, Image, Grid } from 'semantic-ui-react';
|
|
11
10
|
import {
|
|
11
|
+
ShareInfoButton,
|
|
12
12
|
PortalMessage,
|
|
13
13
|
TranslationDisclaimer,
|
|
14
14
|
} from '@eeacms/volto-cca-policy/components';
|
|
@@ -90,7 +90,7 @@ function VideoView(props) {
|
|
|
90
90
|
)}
|
|
91
91
|
|
|
92
92
|
<ReferenceInfo content={content} />
|
|
93
|
-
<
|
|
93
|
+
<ShareInfoButton {...props} />
|
|
94
94
|
</Grid.Column>
|
|
95
95
|
<Grid.Column
|
|
96
96
|
mobile={12}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
WIDGET_MACRO_TRANS_REGIONS,
|
|
7
7
|
WIDGET_BIOGEOGRAPHICAL_REGIONS,
|
|
8
8
|
WIDGET_SUBNATIONAL_REGIONS_OPTIONS,
|
|
9
|
-
} from '
|
|
9
|
+
} from './utils';
|
|
10
10
|
|
|
11
11
|
import { injectIntl } from 'react-intl';
|
|
12
12
|
import { FormFieldWrapper } from '@plone/volto/components';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ACE_COUNTRIES,
|
|
3
|
+
BIOREGIONS,
|
|
4
|
+
SUBNATIONAL_REGIONS,
|
|
5
|
+
EU_COUNTRIES,
|
|
6
|
+
} from '@eeacms/volto-cca-policy/helpers';
|
|
7
|
+
|
|
8
|
+
export const WIDGET_COUNTRIES = Object.entries(ACE_COUNTRIES)
|
|
9
|
+
.map(([code, name]) => ({
|
|
10
|
+
code,
|
|
11
|
+
name,
|
|
12
|
+
label: 'chk_countries_' + code,
|
|
13
|
+
}))
|
|
14
|
+
.filter((country) => EU_COUNTRIES.includes(country.code))
|
|
15
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
16
|
+
|
|
17
|
+
export const WIDGET_MACRO_TRANS_REGIONS = Object.entries(BIOREGIONS)
|
|
18
|
+
.map(([key, value]) => ({
|
|
19
|
+
key,
|
|
20
|
+
value: key,
|
|
21
|
+
text: value,
|
|
22
|
+
}))
|
|
23
|
+
.filter((macro) => macro.key.startsWith('TRANS_MACRO_'))
|
|
24
|
+
.sort((a, b) => a.text.localeCompare(b.name));
|
|
25
|
+
|
|
26
|
+
export const WIDGET_BIOGEOGRAPHICAL_REGIONS = Object.entries(BIOREGIONS)
|
|
27
|
+
.map(([key, value]) => ({
|
|
28
|
+
key,
|
|
29
|
+
value: key,
|
|
30
|
+
text: value,
|
|
31
|
+
}))
|
|
32
|
+
.filter((macro) => macro.key.startsWith('TRANS_BIO_'))
|
|
33
|
+
.sort((a, b) => a.text.localeCompare(b.name));
|
|
34
|
+
|
|
35
|
+
export const WIDGET_SUBNATIONAL_REGIONS_OPTIONS = Object.entries(
|
|
36
|
+
SUBNATIONAL_REGIONS,
|
|
37
|
+
)
|
|
38
|
+
.map(([key, value]) => ({
|
|
39
|
+
key,
|
|
40
|
+
value: key,
|
|
41
|
+
text: value,
|
|
42
|
+
}))
|
|
43
|
+
.sort((a, b) => a.text.localeCompare(b.name));
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add container.
|
|
3
|
+
* @module components/manage/Add/Add
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { useEffect, useState } from 'react';
|
|
7
|
+
import { map } from 'lodash';
|
|
8
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
9
|
+
import { Form as UiForm, Menu, Segment } from 'semantic-ui-react';
|
|
10
|
+
import { Provider } from 'react-intl-redux';
|
|
11
|
+
import { Form, Field } from '@plone/volto/components';
|
|
12
|
+
import config from '@plone/volto/registry';
|
|
13
|
+
import configureStore from '@plone/volto/store';
|
|
14
|
+
import {
|
|
15
|
+
Api,
|
|
16
|
+
flattenToAppURL,
|
|
17
|
+
langmap,
|
|
18
|
+
toGettextLang,
|
|
19
|
+
toReactIntlLang,
|
|
20
|
+
} from '@plone/volto/helpers';
|
|
21
|
+
import { createBrowserHistory } from 'history';
|
|
22
|
+
const messages = defineMessages({
|
|
23
|
+
document: {
|
|
24
|
+
id: 'Document',
|
|
25
|
+
defaultMessage: 'Document',
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* TranslationObject class.
|
|
31
|
+
* @class TranslationObject
|
|
32
|
+
* @extends Component
|
|
33
|
+
*/
|
|
34
|
+
const TranslationObject = ({
|
|
35
|
+
translationObject,
|
|
36
|
+
schema,
|
|
37
|
+
pathname,
|
|
38
|
+
visual,
|
|
39
|
+
isFormSelected,
|
|
40
|
+
onSelectForm,
|
|
41
|
+
}) => {
|
|
42
|
+
const intl = useIntl();
|
|
43
|
+
|
|
44
|
+
const [locales, setLocales] = useState({});
|
|
45
|
+
const [loadingLocale, setLoadingLocale] = useState(false);
|
|
46
|
+
const [activeMenu, setActiveMenu] = useState('language');
|
|
47
|
+
const handleMenuClick = (e, { name }) => {
|
|
48
|
+
setActiveMenu(name);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (
|
|
53
|
+
!loadingLocale &&
|
|
54
|
+
Object.keys(locales).length < config.settings.supportedLanguages.length
|
|
55
|
+
) {
|
|
56
|
+
setLoadingLocale(true);
|
|
57
|
+
let lang =
|
|
58
|
+
config.settings.supportedLanguages[Object.keys(locales).length];
|
|
59
|
+
const langFileName = toGettextLang(lang);
|
|
60
|
+
import('@root/../locales/' + langFileName + '.json').then((locale) => {
|
|
61
|
+
setLocales({ ...locales, [toReactIntlLang(lang)]: locale.default });
|
|
62
|
+
setLoadingLocale(false);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}, [loadingLocale, locales]);
|
|
66
|
+
|
|
67
|
+
const api = new Api();
|
|
68
|
+
const history = createBrowserHistory();
|
|
69
|
+
const store = configureStore(
|
|
70
|
+
{
|
|
71
|
+
...window.__data,
|
|
72
|
+
intl: {
|
|
73
|
+
defaultLocale: config.settings.defaultLanguage,
|
|
74
|
+
locale: translationObject.language.token,
|
|
75
|
+
messages: locales[translationObject.language.token],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
history,
|
|
79
|
+
api,
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const lang = translationObject.language.token || translationObject.language;
|
|
83
|
+
|
|
84
|
+
return translationObject && Object.keys(locales).length > 0 ? (
|
|
85
|
+
<Provider store={store}>
|
|
86
|
+
<>
|
|
87
|
+
<Menu pointing secondary attached tabular>
|
|
88
|
+
<Menu.Item
|
|
89
|
+
name="language"
|
|
90
|
+
active={activeMenu === 'language'}
|
|
91
|
+
onClick={handleMenuClick}
|
|
92
|
+
>
|
|
93
|
+
{langmap[lang].nativeName}
|
|
94
|
+
</Menu.Item>
|
|
95
|
+
{visual && (
|
|
96
|
+
<Menu.Item
|
|
97
|
+
name="properties"
|
|
98
|
+
active={activeMenu === 'properties'}
|
|
99
|
+
onClick={handleMenuClick}
|
|
100
|
+
>
|
|
101
|
+
{intl.formatMessage(messages.document)}
|
|
102
|
+
</Menu.Item>
|
|
103
|
+
)}
|
|
104
|
+
</Menu>
|
|
105
|
+
{activeMenu === 'language' && (
|
|
106
|
+
<Form
|
|
107
|
+
key="translation-object-form"
|
|
108
|
+
schema={schema}
|
|
109
|
+
formData={translationObject}
|
|
110
|
+
type={translationObject['@type']}
|
|
111
|
+
onSubmit={() => {
|
|
112
|
+
/*do nothing*/
|
|
113
|
+
}}
|
|
114
|
+
hideActions
|
|
115
|
+
pathname={flattenToAppURL(translationObject['@id'])}
|
|
116
|
+
visual={visual}
|
|
117
|
+
title={langmap[lang].nativeName}
|
|
118
|
+
loading={false}
|
|
119
|
+
isFormSelected={isFormSelected}
|
|
120
|
+
onSelectForm={onSelectForm}
|
|
121
|
+
editable={false}
|
|
122
|
+
onChange={() => {}}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
125
|
+
{activeMenu === 'properties' && (
|
|
126
|
+
<UiForm method="post" onSubmit={() => {}}>
|
|
127
|
+
<fieldset className="invisible">
|
|
128
|
+
{schema &&
|
|
129
|
+
map(schema.fieldsets, (item) => [
|
|
130
|
+
<Segment secondary attached key={item.title}>
|
|
131
|
+
{item.title}
|
|
132
|
+
</Segment>,
|
|
133
|
+
<Segment attached key={`fieldset-contents-${item.title}`}>
|
|
134
|
+
{map(item.fields, (field, index) => (
|
|
135
|
+
<Field
|
|
136
|
+
{...schema.properties[field]}
|
|
137
|
+
isDisabled={true}
|
|
138
|
+
id={field}
|
|
139
|
+
formData={translationObject}
|
|
140
|
+
focus={false}
|
|
141
|
+
value={translationObject[field]}
|
|
142
|
+
required={schema.required.indexOf(field) !== -1}
|
|
143
|
+
key={field}
|
|
144
|
+
onChange={() => {}}
|
|
145
|
+
/>
|
|
146
|
+
))}
|
|
147
|
+
</Segment>,
|
|
148
|
+
])}
|
|
149
|
+
</fieldset>
|
|
150
|
+
</UiForm>
|
|
151
|
+
)}
|
|
152
|
+
</>
|
|
153
|
+
</Provider>
|
|
154
|
+
) : null;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export default TranslationObject;
|
|
@@ -531,40 +531,3 @@ export const EU_COUNTRIES = [
|
|
|
531
531
|
'SI',
|
|
532
532
|
'SK',
|
|
533
533
|
];
|
|
534
|
-
|
|
535
|
-
export const WIDGET_COUNTRIES = Object.entries(ACE_COUNTRIES)
|
|
536
|
-
.map(([code, name]) => ({
|
|
537
|
-
code,
|
|
538
|
-
name,
|
|
539
|
-
label: 'chk_countries_' + code,
|
|
540
|
-
}))
|
|
541
|
-
.filter((country) => EU_COUNTRIES.includes(country.code))
|
|
542
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
543
|
-
|
|
544
|
-
export const WIDGET_MACRO_TRANS_REGIONS = Object.entries(BIOREGIONS)
|
|
545
|
-
.map(([key, value]) => ({
|
|
546
|
-
key,
|
|
547
|
-
value: key,
|
|
548
|
-
text: value,
|
|
549
|
-
}))
|
|
550
|
-
.filter((macro) => macro.key.startsWith('TRANS_MACRO_'))
|
|
551
|
-
.sort((a, b) => a.text.localeCompare(b.name));
|
|
552
|
-
|
|
553
|
-
export const WIDGET_BIOGEOGRAPHICAL_REGIONS = Object.entries(BIOREGIONS)
|
|
554
|
-
.map(([key, value]) => ({
|
|
555
|
-
key,
|
|
556
|
-
value: key,
|
|
557
|
-
text: value,
|
|
558
|
-
}))
|
|
559
|
-
.filter((macro) => macro.key.startsWith('TRANS_BIO_'))
|
|
560
|
-
.sort((a, b) => a.text.localeCompare(b.name));
|
|
561
|
-
|
|
562
|
-
export const WIDGET_SUBNATIONAL_REGIONS_OPTIONS = Object.entries(
|
|
563
|
-
SUBNATIONAL_REGIONS,
|
|
564
|
-
)
|
|
565
|
-
.map(([key, value]) => ({
|
|
566
|
-
key,
|
|
567
|
-
value: key,
|
|
568
|
-
text: value,
|
|
569
|
-
}))
|
|
570
|
-
.sort((a, b) => a.text.localeCompare(b.name));
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@eeacms/volto-cca-policy/helpers/Constants';
|
|
12
12
|
import { Fragment } from 'react';
|
|
13
13
|
import { Popup, Segment } from 'semantic-ui-react';
|
|
14
|
-
import {
|
|
14
|
+
import { isObservatoryMetadataURL } from '@eeacms/volto-cca-policy/helpers';
|
|
15
15
|
import { useLocation } from 'react-router-dom';
|
|
16
16
|
import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
|
|
17
17
|
|
|
@@ -350,7 +350,7 @@ function ContentMetadata(props) {
|
|
|
350
350
|
} = content;
|
|
351
351
|
const type = content['@type'];
|
|
352
352
|
const location = useLocation();
|
|
353
|
-
const isObservatoryItem =
|
|
353
|
+
const isObservatoryItem = isObservatoryMetadataURL(location.pathname);
|
|
354
354
|
const hasGeoChars = geochars !== null || spatial_layer.length > 0;
|
|
355
355
|
|
|
356
356
|
const intl = useIntl();
|
package/src/helpers/Utils.jsx
CHANGED
package/src/helpers/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import superagent from 'superagent';
|
|
2
1
|
import config from '@plone/volto/registry';
|
|
3
|
-
import { addHeadersFactory } from '@plone/volto/helpers/Proxy/Proxy';
|
|
4
2
|
import { isArray } from 'lodash';
|
|
5
3
|
import { serializeNodes } from '@plone/volto-slate/editor/render';
|
|
6
4
|
import { OBSERVATORY_PARTNERS } from './Constants';
|
|
@@ -17,51 +15,15 @@ export {
|
|
|
17
15
|
ItemLogo,
|
|
18
16
|
} from './Utils';
|
|
19
17
|
export { default as ContentMetadata } from './ContentMetadata';
|
|
20
|
-
export { default as ShareInfo } from './ShareInfo';
|
|
21
18
|
export {
|
|
22
19
|
ACE_COUNTRIES,
|
|
23
20
|
BIOREGIONS,
|
|
24
21
|
OTHER_REGIONS,
|
|
25
22
|
SUBNATIONAL_REGIONS,
|
|
26
23
|
EU_COUNTRIES,
|
|
27
|
-
WIDGET_COUNTRIES,
|
|
28
|
-
WIDGET_MACRO_TRANS_REGIONS,
|
|
29
|
-
WIDGET_BIOGEOGRAPHICAL_REGIONS,
|
|
30
|
-
WIDGET_SUBNATIONAL_REGIONS_OPTIONS,
|
|
31
24
|
} from './Constants';
|
|
32
25
|
export clientOnly from './clientOnly';
|
|
33
26
|
|
|
34
|
-
/**
|
|
35
|
-
* Get a resource image/file with authenticated (if token exist) API headers
|
|
36
|
-
* @function getBackendResourceWithAuth
|
|
37
|
-
* @param {Object} req Request object
|
|
38
|
-
* @return {string} The response with the image
|
|
39
|
-
*/
|
|
40
|
-
export const getBackendResourceWithAuth = (req) =>
|
|
41
|
-
new Promise((resolve, reject) => {
|
|
42
|
-
const { settings } = config;
|
|
43
|
-
|
|
44
|
-
let apiPath = '';
|
|
45
|
-
if (settings.internalApiPath && __SERVER__) {
|
|
46
|
-
apiPath = settings.internalApiPath;
|
|
47
|
-
} else if (__DEVELOPMENT__ && settings.devProxyToApiPath) {
|
|
48
|
-
apiPath = settings.devProxyToApiPath;
|
|
49
|
-
} else {
|
|
50
|
-
apiPath = settings.apiPath;
|
|
51
|
-
}
|
|
52
|
-
const backendURL = `${apiPath}${req.path}`;
|
|
53
|
-
const request = superagent
|
|
54
|
-
.get(backendURL)
|
|
55
|
-
.maxResponseSize(settings.maxResponseSize)
|
|
56
|
-
.responseType('blob');
|
|
57
|
-
const authToken = req.universalCookies.get('auth_token');
|
|
58
|
-
if (authToken) {
|
|
59
|
-
request.set('Authorization', `Bearer ${authToken}`);
|
|
60
|
-
}
|
|
61
|
-
request.use(addHeadersFactory(req));
|
|
62
|
-
request.then(resolve).catch(reject);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
27
|
export const createSlateParagraph = (text) => {
|
|
66
28
|
return isArray(text) ? text : config.settings.slate.defaultValue();
|
|
67
29
|
};
|
|
@@ -91,3 +53,11 @@ export const makeContributionsSearchQuery = (props) => {
|
|
|
91
53
|
|
|
92
54
|
return url;
|
|
93
55
|
};
|
|
56
|
+
|
|
57
|
+
export const isObservatoryMetadataURL = (url) => {
|
|
58
|
+
return url.indexOf('/observatory/++aq++metadata') > -1;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const makeObservatoryMetadataURL = (url) => {
|
|
62
|
+
return url.replace('/metadata/', '/observatory/++aq++metadata/');
|
|
63
|
+
};
|
|
@@ -17,3 +17,20 @@
|
|
|
17
17
|
opacity: 0.6;
|
|
18
18
|
pointer-events: none;
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
.language-list {
|
|
22
|
+
li.item.disabled {
|
|
23
|
+
color: #a1a1a1 !important;
|
|
24
|
+
|
|
25
|
+
&:hover {
|
|
26
|
+
background: none !important;
|
|
27
|
+
cursor: auto !important;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
li.item.active {
|
|
32
|
+
background: @dropdownMenuItemBackgroundColorHover !important;
|
|
33
|
+
color: @dropdownMenuItemColorHover !important;
|
|
34
|
+
cursor: auto !important;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Header } from '@eeacms/volto-eea-design-system/ui';
|
|
3
|
-
import { find } from 'lodash';
|
|
4
|
-
import globeIcon from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/global-line.svg';
|
|
5
|
-
import { useSelector } from 'react-redux';
|
|
6
|
-
import config from '@plone/volto/registry';
|
|
7
|
-
import { Dropdown, Image } from 'semantic-ui-react';
|
|
8
|
-
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
9
|
-
import { useAtom } from 'jotai';
|
|
10
|
-
import { selectedLanguageAtom } from './../../state';
|
|
11
|
-
|
|
12
|
-
// dispatch(changeLanguage(redirectToLanguage, locale.default));
|
|
13
|
-
export default function LanguageSwitch({ history }) {
|
|
14
|
-
const { eea } = config.settings;
|
|
15
|
-
const translations = useSelector(
|
|
16
|
-
(state) => state.content.data?.['@components']?.translations?.items,
|
|
17
|
-
);
|
|
18
|
-
const [, setSelectedLanguage] = useAtom(selectedLanguageAtom);
|
|
19
|
-
const width = useSelector((state) => state.screen?.width);
|
|
20
|
-
|
|
21
|
-
const currentLang = useSelector((state) => state.intl.locale);
|
|
22
|
-
const [language, setLanguage] = React.useState(
|
|
23
|
-
currentLang || eea.defaultLanguage,
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<Header.TopDropdownMenu
|
|
28
|
-
id="language-switcher"
|
|
29
|
-
className="item"
|
|
30
|
-
hasLanguageDropdown={
|
|
31
|
-
config.settings.supportedLanguages.length > 1 &&
|
|
32
|
-
config.settings.hasLanguageDropdown
|
|
33
|
-
}
|
|
34
|
-
text={`${language.toUpperCase()}`}
|
|
35
|
-
mobileText={`${language.toUpperCase()}`}
|
|
36
|
-
icon={<Image src={globeIcon} alt="language dropdown globe icon"></Image>}
|
|
37
|
-
viewportWidth={width}
|
|
38
|
-
>
|
|
39
|
-
<ul
|
|
40
|
-
className="wrapper language-list"
|
|
41
|
-
role="listbox"
|
|
42
|
-
aria-label="language switcher"
|
|
43
|
-
>
|
|
44
|
-
{eea.languages.map((item, index) => (
|
|
45
|
-
<Dropdown.Item
|
|
46
|
-
as="li"
|
|
47
|
-
key={index}
|
|
48
|
-
text={
|
|
49
|
-
<span>
|
|
50
|
-
{item.name}
|
|
51
|
-
<span className="country-code">{item.code.toUpperCase()}</span>
|
|
52
|
-
</span>
|
|
53
|
-
}
|
|
54
|
-
onClick={() => {
|
|
55
|
-
const translation = find(translations, {
|
|
56
|
-
language: item.code,
|
|
57
|
-
});
|
|
58
|
-
const to = translation
|
|
59
|
-
? flattenToAppURL(translation['@id'])
|
|
60
|
-
: `/${item.code}`;
|
|
61
|
-
setLanguage(item.code);
|
|
62
|
-
setSelectedLanguage(item.code);
|
|
63
|
-
const searchParams = new URLSearchParams();
|
|
64
|
-
searchParams.set('set_language', item.code);
|
|
65
|
-
history.push({
|
|
66
|
-
pathname: to,
|
|
67
|
-
search: searchParams.toString(),
|
|
68
|
-
});
|
|
69
|
-
}}
|
|
70
|
-
></Dropdown.Item>
|
|
71
|
-
))}
|
|
72
|
-
</ul>
|
|
73
|
-
</Header.TopDropdownMenu>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
File without changes
|