@eeacms/volto-cca-policy 0.1.91 → 0.1.93
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/.eslintrc.js +61 -0
- package/CHANGELOG.md +67 -9
- package/jest-addon.config.js +18 -4
- package/jest.setup.js +65 -0
- package/package.json +1 -1
- package/src/components/MigrationButtons.jsx +48 -35
- package/src/components/index.js +1 -0
- package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsEdit.jsx +4 -1
- package/src/components/manage/Blocks/Listing/OrganisationCardsListingView.jsx +20 -18
- package/src/components/manage/TransparentOverlay.jsx +11 -0
- package/src/components/theme/Header.jsx +0 -2
- package/src/components/theme/PortalMessage/PortalMessage.jsx +19 -0
- package/src/components/theme/Views/AdaptationOptionView.jsx +40 -60
- package/src/components/theme/Views/C3SIndicatorView.jsx +9 -6
- package/src/components/theme/Views/CaseStudyView.jsx +16 -14
- package/src/components/theme/Views/CcaEventView.jsx +8 -5
- package/src/components/theme/Views/DatabaseItemView.jsx +160 -0
- package/src/components/theme/Views/{InformationPortalView.test.jsx → DatabaseItemView.test.jsx} +12 -4
- package/src/components/theme/Views/EventView.jsx +5 -1
- package/src/components/theme/Views/NewsItemView.jsx +5 -1
- package/src/components/theme/Views/ProjectView.jsx +10 -32
- package/src/components/theme/Views/VideoView.jsx +10 -42
- package/src/components/theme/Views/VideoView.test.jsx +1 -1
- package/src/helpers/Constants.jsx +12 -0
- package/src/helpers/ContentMetadata.jsx +132 -67
- package/src/helpers/ShareInfo.jsx +16 -8
- package/src/helpers/Utils.jsx +112 -27
- package/src/helpers/index.js +3 -0
- package/src/index.js +60 -145
- package/theme/globals/site.overrides +10 -0
- package/theme/globals/views.less +23 -23
- package/src/components/theme/Views/GuidanceView.jsx +0 -112
- package/src/components/theme/Views/GuidanceView.test.jsx +0 -50
- package/src/components/theme/Views/IndicatorView.jsx +0 -123
- package/src/components/theme/Views/IndicatorView.test.jsx +0 -50
- package/src/components/theme/Views/InformationPortalView.jsx +0 -78
- package/src/components/theme/Views/OrganisationView.jsx +0 -112
- package/src/components/theme/Views/OrganisationView.test.jsx +0 -50
- package/src/components/theme/Views/PublicationReportView.jsx +0 -71
- package/src/components/theme/Views/PublicationReportView.test.jsx +0 -50
- package/src/components/theme/Views/ToolView.jsx +0 -59
- package/src/components/theme/Views/ToolView.test.jsx +0 -50
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const projectRootPath = fs.realpathSync(__dirname + '/../../../');
|
|
4
|
+
|
|
5
|
+
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
6
|
+
let configFile;
|
|
7
|
+
if (fs.existsSync(`${projectRootPath}/tsconfig.json`))
|
|
8
|
+
configFile = `${projectRootPath}/tsconfig.json`;
|
|
9
|
+
else if (fs.existsSync(`${projectRootPath}/jsconfig.json`))
|
|
10
|
+
configFile = `${projectRootPath}/jsconfig.json`;
|
|
11
|
+
|
|
12
|
+
if (configFile) {
|
|
13
|
+
const jsConfig = require(configFile).compilerOptions;
|
|
14
|
+
const pathsConfig = jsConfig.paths;
|
|
15
|
+
if (pathsConfig['@plone/volto'])
|
|
16
|
+
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
|
|
20
|
+
const reg = new AddonConfigurationRegistry(projectRootPath);
|
|
21
|
+
|
|
22
|
+
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
23
|
+
const addonAliases = Object.keys(reg.packages).map((o) => [
|
|
24
|
+
o,
|
|
25
|
+
reg.packages[o].modulePath,
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const addonExtenders = reg.getEslintExtenders().map((m) => require(m));
|
|
29
|
+
|
|
30
|
+
const defaultConfig = {
|
|
31
|
+
extends: `${voltoPath}/.eslintrc`,
|
|
32
|
+
settings: {
|
|
33
|
+
'import/resolver': {
|
|
34
|
+
alias: {
|
|
35
|
+
map: [
|
|
36
|
+
['@plone/volto', '@plone/volto/src'],
|
|
37
|
+
['@plone/volto-slate', '@plone/volto/packages/volto-slate/src'],
|
|
38
|
+
['@root/routes', '@plone/volto/src'],
|
|
39
|
+
...addonAliases,
|
|
40
|
+
['@package', `${__dirname}/src`],
|
|
41
|
+
// ['@root', `${__dirname}/src`],
|
|
42
|
+
['~', `${__dirname}/src`],
|
|
43
|
+
],
|
|
44
|
+
extensions: ['.js', '.jsx', '.json'],
|
|
45
|
+
},
|
|
46
|
+
'babel-plugin-root-import': {
|
|
47
|
+
rootPathSuffix: 'src',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
rules: {
|
|
52
|
+
'react/jsx-no-target-blank': 'off',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const config = addonExtenders.reduce(
|
|
57
|
+
(acc, extender) => extender.modify(acc),
|
|
58
|
+
defaultConfig,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
module.exports = config;
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,73 @@ 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.93](https://github.com/eea/volto-cca-policy/compare/0.1.92...0.1.93) - 8 March 2024
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: add AnchorLink to smooth scroll to sections [kreafox - [`997d732`](https://github.com/eea/volto-cca-policy/commit/997d732e8cbb679e5944db5197174109fc7df315)]
|
|
12
|
+
|
|
13
|
+
#### :bug: Bug Fixes
|
|
14
|
+
|
|
15
|
+
- fix(views): show info only on observatory [kreafox - [`fbc7558`](https://github.com/eea/volto-cca-policy/commit/fbc7558b062c89af891d75c41735b334a1775594)]
|
|
16
|
+
- fix(views): fix case when we use thumbnail instead of logo [kreafox - [`0222507`](https://github.com/eea/volto-cca-policy/commit/02225070d6dea7211e4ecd5d8608ef6749590789)]
|
|
17
|
+
- fix:unable to resolve path to module @eeacms/search [ana-oprea - [`0abeaf3`](https://github.com/eea/volto-cca-policy/commit/0abeaf36b3123e3f9c738e1593681e39b78ca4c1)]
|
|
18
|
+
- fix(views): share info button link [kreafox - [`af797f0`](https://github.com/eea/volto-cca-policy/commit/af797f07571c95f94aef62ae680d72019493431d)]
|
|
19
|
+
- fix(views): fix metadata for db items [kreafox - [`cc81806`](https://github.com/eea/volto-cca-policy/commit/cc818068ed389a53ca517d95e81fad58a88bbebd)]
|
|
20
|
+
|
|
21
|
+
#### :nail_care: Enhancements
|
|
22
|
+
|
|
23
|
+
- change(views): update section layout on Adaptation Option [kreafox - [`3ee4fb7`](https://github.com/eea/volto-cca-policy/commit/3ee4fb7a378435555726cbb9f04c3914995d1643)]
|
|
24
|
+
- change(views): add IPCC metadata [kreafox - [`a66ad07`](https://github.com/eea/volto-cca-policy/commit/a66ad07be594c8dc1dbec1f5f7b0ef17c0116042)]
|
|
25
|
+
|
|
26
|
+
#### :house: Internal changes
|
|
27
|
+
|
|
28
|
+
- style(views): fix icon position in DocumentList [kreafox - [`7cc9fa8`](https://github.com/eea/volto-cca-policy/commit/7cc9fa8cf2b3bda26eafd17316ab4e8449e0c500)]
|
|
29
|
+
|
|
30
|
+
#### :hammer_and_wrench: Others
|
|
31
|
+
|
|
32
|
+
- Add transparent overlay for collection stats, to make it easier to select the block [Tiberiu Ichim - [`6c8507a`](https://github.com/eea/volto-cca-policy/commit/6c8507a928ffd53d8c6b5384ff492839bfc42c77)]
|
|
33
|
+
- Add another migration button [Tiberiu Ichim - [`5759f2c`](https://github.com/eea/volto-cca-policy/commit/5759f2cd5c4cca7937f74d3f398157ec120524b9)]
|
|
34
|
+
- update path [Teodor - [`0ddd49f`](https://github.com/eea/volto-cca-policy/commit/0ddd49f12cb3b33fba1fda0819b2967bd6948029)]
|
|
35
|
+
- cleanup code [kreafox - [`b096c4c`](https://github.com/eea/volto-cca-policy/commit/b096c4c71ab7c9d04acb2908c6a5e023af41801c)]
|
|
36
|
+
- update rule [Teodor - [`d6f0bba`](https://github.com/eea/volto-cca-policy/commit/d6f0bbabda5279b56a0cf3dcd395cea7852ed915)]
|
|
37
|
+
- test: update snapshots [kreafox - [`afde48c`](https://github.com/eea/volto-cca-policy/commit/afde48c32b461ec06592fc0adb195a4995170998)]
|
|
38
|
+
- test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`0ab94c8`](https://github.com/eea/volto-cca-policy/commit/0ab94c8a8ff7c457b02ad2b177b79f2b18936e50)]
|
|
39
|
+
- remove eslintrc [Teodor - [`4020b91`](https://github.com/eea/volto-cca-policy/commit/4020b918d28efa18073fb87b011ab2702addf518)]
|
|
40
|
+
- eslintrc removed from gitignore [Teodor - [`f427a9c`](https://github.com/eea/volto-cca-policy/commit/f427a9c8baa29d20d41fd901dda039f251e6fdba)]
|
|
41
|
+
- revert razzle extend config [Teodor - [`b849609`](https://github.com/eea/volto-cca-policy/commit/b84960945009e9821c21a423f8d5f8eec3b21f80)]
|
|
42
|
+
- update eslint rule [Teodor - [`dc1b2c2`](https://github.com/eea/volto-cca-policy/commit/dc1b2c22caa3b0d2359d08093a12a33ee2c65a06)]
|
|
43
|
+
- add eslint rules [Teodor - [`8ab2af3`](https://github.com/eea/volto-cca-policy/commit/8ab2af3336f3c6b4416db1c79df1b9a44383f310)]
|
|
44
|
+
- Fix navigation children [Tiberiu Ichim - [`4ef429d`](https://github.com/eea/volto-cca-policy/commit/4ef429d1b3c4ac359f27741d54f44092e81d4d4d)]
|
|
45
|
+
- Add translate button [Tiberiu Ichim - [`6d4751e`](https://github.com/eea/volto-cca-policy/commit/6d4751e0750373c1e9dd657dc9346c5590ef38d0)]
|
|
46
|
+
- Simplify code [Tiberiu Ichim - [`900e867`](https://github.com/eea/volto-cca-policy/commit/900e867db1d45a3a2f042eb9763c306528346509)]
|
|
47
|
+
### [0.1.92](https://github.com/eea/volto-cca-policy/compare/0.1.91...0.1.92) - 6 March 2024
|
|
48
|
+
|
|
49
|
+
#### :rocket: New Features
|
|
50
|
+
|
|
51
|
+
- feat: add portal message for archived content [kreafox - [`e430c84`](https://github.com/eea/volto-cca-policy/commit/e430c849011fbf5c09a52a2785898d850c8904ab)]
|
|
52
|
+
|
|
53
|
+
#### :bug: Bug Fixes
|
|
54
|
+
|
|
55
|
+
- fix(views): remove RenderBlocks from CCA Event [kreafox - [`b3037d5`](https://github.com/eea/volto-cca-policy/commit/b3037d5f69616ad5542f63f00f8f88749c08d77e)]
|
|
56
|
+
- fix(views): fix condition [kreafox - [`bdf40c9`](https://github.com/eea/volto-cca-policy/commit/bdf40c9ae6c2b8fd9094f6fcb50cf4a5d60e09d7)]
|
|
57
|
+
- fix(tests): more cleanup on db items view [kreafox - [`ea7dbeb`](https://github.com/eea/volto-cca-policy/commit/ea7dbeb1b44295450f8953f6e96ca8a6a1e6cf0a)]
|
|
58
|
+
- fix(test): duplicated code issue [kreafox - [`80027ee`](https://github.com/eea/volto-cca-policy/commit/80027eebc1739bd90976a24b4e1b760d35d7f82a)]
|
|
59
|
+
- fix(views): logo on db items view [kreafox - [`15b7cad`](https://github.com/eea/volto-cca-policy/commit/15b7cadff03dd5532c11209308d58f655131d1ab)]
|
|
60
|
+
- fix(views): add missing fields [kreafox - [`1d50f3d`](https://github.com/eea/volto-cca-policy/commit/1d50f3d5f9497c2591b53ef3b57dd49079ee4224)]
|
|
61
|
+
|
|
62
|
+
#### :nail_care: Enhancements
|
|
63
|
+
|
|
64
|
+
- change(views): use DatabaseItemView for Organisation item [kreafox - [`30d0e18`](https://github.com/eea/volto-cca-policy/commit/30d0e18894b6a70ba7b95c8154659b8785128831)]
|
|
65
|
+
- change(views): Elements -> Adaptation elements [kreafox - [`5575a68`](https://github.com/eea/volto-cca-policy/commit/5575a684253ec32f799d58c613698cd0e3725950)]
|
|
66
|
+
|
|
67
|
+
#### :hammer_and_wrench: Others
|
|
68
|
+
|
|
69
|
+
- test: update snapshot [kreafox - [`a8bf420`](https://github.com/eea/volto-cca-policy/commit/a8bf420e9bb62a315ab0eec3c2c37f63312234d4)]
|
|
70
|
+
- Change label for search in observatory [Tiberiu Ichim - [`1d9848f`](https://github.com/eea/volto-cca-policy/commit/1d9848f31d89d9ad969609d4b1f1860b814ad001)]
|
|
71
|
+
- test: WIP on reduce duplicated code by adding a common view for DB items [kreafox - [`92e33e8`](https://github.com/eea/volto-cca-policy/commit/92e33e866c709ab132e78214e2422c8dec914d22)]
|
|
72
|
+
- test: more cleanup [kreafox - [`5b3aa8e`](https://github.com/eea/volto-cca-policy/commit/5b3aa8e4735eb0b02e8142bbebd4b2ae15b89bbd)]
|
|
73
|
+
- tests: update snapshots [kreafox - [`3acbec8`](https://github.com/eea/volto-cca-policy/commit/3acbec8db2f069e2ea62051a43bde563e095d277)]
|
|
7
74
|
### [0.1.91](https://github.com/eea/volto-cca-policy/compare/0.1.90...0.1.91) - 5 March 2024
|
|
8
75
|
|
|
9
76
|
#### :bug: Bug Fixes
|
|
@@ -13,7 +80,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
13
80
|
#### :hammer_and_wrench: Others
|
|
14
81
|
|
|
15
82
|
- Add test file [Tiberiu Ichim - [`282e32c`](https://github.com/eea/volto-cca-policy/commit/282e32cde07122150379df996b19d37eed3e0260)]
|
|
16
|
-
- Add override for UniversalLink, see #266263 [Tiberiu Ichim - [`63242f5`](https://github.com/eea/volto-cca-policy/commit/63242f5fc4b0e54d1170b8f8ee31dba46e997eee)]
|
|
17
83
|
### [0.1.90](https://github.com/eea/volto-cca-policy/compare/0.1.89...0.1.90) - 5 March 2024
|
|
18
84
|
|
|
19
85
|
#### :hammer_and_wrench: Others
|
|
@@ -578,13 +644,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
578
644
|
- Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
|
|
579
645
|
- Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
|
|
580
646
|
- Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
|
|
581
|
-
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
|
|
582
|
-
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
|
|
583
647
|
### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
|
|
584
648
|
|
|
585
649
|
#### :house: Internal changes
|
|
586
650
|
|
|
587
|
-
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
|
|
588
651
|
- chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
|
|
589
652
|
|
|
590
653
|
#### :hammer_and_wrench: Others
|
|
@@ -601,9 +664,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
601
664
|
- Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
|
|
602
665
|
- Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
|
|
603
666
|
- Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
|
|
604
|
-
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
|
|
605
|
-
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
|
|
606
|
-
- test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
|
|
607
667
|
- Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
|
|
608
668
|
- 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)]
|
|
609
669
|
- Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
|
|
@@ -820,7 +880,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
820
880
|
|
|
821
881
|
#### :house: Internal changes
|
|
822
882
|
|
|
823
|
-
- chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
|
|
824
883
|
|
|
825
884
|
#### :hammer_and_wrench: Others
|
|
826
885
|
|
|
@@ -1301,7 +1360,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
1301
1360
|
#### :hammer_and_wrench: Others
|
|
1302
1361
|
|
|
1303
1362
|
- Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
|
|
1304
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
|
|
1305
1363
|
### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
|
|
1306
1364
|
|
|
1307
1365
|
#### :hammer_and_wrench: Others
|
package/jest-addon.config.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require('dotenv').config({ path: __dirname + '/.env' })
|
|
2
|
+
|
|
1
3
|
module.exports = {
|
|
2
4
|
testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
3
5
|
collectCoverageFrom: [
|
|
@@ -9,16 +11,23 @@ module.exports = {
|
|
|
9
11
|
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
10
12
|
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
|
11
13
|
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
12
|
-
'@package/(.*)$': '<rootDir>/src/$1',
|
|
13
|
-
'@root/(.*)$': '<rootDir>/src/$1',
|
|
14
|
+
'@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
15
|
+
'@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
14
16
|
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
|
|
17
|
+
'@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
|
|
18
|
+
'@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
|
|
15
19
|
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
|
|
16
|
-
'@plone/volto-slate':
|
|
20
|
+
'@plone/volto-slate$':
|
|
17
21
|
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
|
|
22
|
+
'@plone/volto-slate/(.*)$':
|
|
23
|
+
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
|
|
18
24
|
'~/(.*)$': '<rootDir>/src/$1',
|
|
19
25
|
'load-volto-addons':
|
|
20
26
|
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
|
21
27
|
},
|
|
28
|
+
transformIgnorePatterns: [
|
|
29
|
+
'/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
|
|
30
|
+
],
|
|
22
31
|
transform: {
|
|
23
32
|
'^.+\\.js(x)?$': 'babel-jest',
|
|
24
33
|
'^.+\\.(png)$': 'jest-file',
|
|
@@ -33,4 +42,9 @@ module.exports = {
|
|
|
33
42
|
statements: 5,
|
|
34
43
|
},
|
|
35
44
|
},
|
|
36
|
-
|
|
45
|
+
...(process.env.JEST_USE_SETUP === 'ON' && {
|
|
46
|
+
setupFilesAfterEnv: [
|
|
47
|
+
'<rootDir>/node_modules/@eeacms/volto-cca-policy/jest.setup.js',
|
|
48
|
+
],
|
|
49
|
+
}),
|
|
50
|
+
}
|
package/jest.setup.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import configureStore from 'redux-mock-store';
|
|
3
|
+
import thunk from 'redux-thunk';
|
|
4
|
+
import { blocksConfig } from '@plone/volto/config/Blocks';
|
|
5
|
+
import installSlate from '@plone/volto-slate/index';
|
|
6
|
+
|
|
7
|
+
var mockSemanticComponents = jest.requireActual('semantic-ui-react');
|
|
8
|
+
var mockComponents = jest.requireActual('@plone/volto/components');
|
|
9
|
+
var config = jest.requireActual('@plone/volto/registry').default;
|
|
10
|
+
|
|
11
|
+
config.blocks.blocksConfig = {
|
|
12
|
+
...blocksConfig,
|
|
13
|
+
...config.blocks.blocksConfig,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
jest.doMock('semantic-ui-react', () => ({
|
|
17
|
+
__esModule: true,
|
|
18
|
+
...mockSemanticComponents,
|
|
19
|
+
Popup: ({ content, trigger }) => {
|
|
20
|
+
return (
|
|
21
|
+
<div className="popup">
|
|
22
|
+
<div className="trigger">{trigger}</div>
|
|
23
|
+
<div className="content">{content}</div>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
jest.doMock('@plone/volto/components', () => {
|
|
30
|
+
return {
|
|
31
|
+
__esModule: true,
|
|
32
|
+
...mockComponents,
|
|
33
|
+
SidebarPortal: ({ children }) => <div id="sidebar">{children}</div>,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
jest.doMock('@plone/volto/registry', () =>
|
|
38
|
+
[installSlate].reduce((acc, apply) => apply(acc), config),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const mockStore = configureStore([thunk]);
|
|
42
|
+
|
|
43
|
+
global.fetch = jest.fn(() =>
|
|
44
|
+
Promise.resolve({
|
|
45
|
+
json: () => Promise.resolve({}),
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
global.store = mockStore({
|
|
50
|
+
intl: {
|
|
51
|
+
locale: 'en',
|
|
52
|
+
messages: {},
|
|
53
|
+
formatMessage: jest.fn(),
|
|
54
|
+
},
|
|
55
|
+
content: {
|
|
56
|
+
create: {},
|
|
57
|
+
subrequests: [],
|
|
58
|
+
},
|
|
59
|
+
connected_data_parameters: {},
|
|
60
|
+
screen: {
|
|
61
|
+
page: {
|
|
62
|
+
width: 768,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
package/package.json
CHANGED
|
@@ -1,54 +1,67 @@
|
|
|
1
1
|
import { Plug } from '@plone/volto/components/manage/Pluggable';
|
|
2
2
|
import { getBaseUrl } from '@plone/volto/helpers';
|
|
3
3
|
|
|
4
|
+
const button = (id, title, label, destination) => (
|
|
5
|
+
<button
|
|
6
|
+
className={`circle-right-btn `}
|
|
7
|
+
id={id}
|
|
8
|
+
onClick={() => window.open(destination, '_blank')}
|
|
9
|
+
title={title}
|
|
10
|
+
>
|
|
11
|
+
{label}
|
|
12
|
+
</button>
|
|
13
|
+
);
|
|
14
|
+
|
|
4
15
|
function MigrationButtons(props) {
|
|
5
16
|
const { content, token, pathname } = props;
|
|
6
17
|
const contentId = content?.['@id'] || '';
|
|
7
18
|
const show = !!token && contentId && contentId.indexOf('europa.eu') === -1;
|
|
8
19
|
const base = getBaseUrl(pathname);
|
|
20
|
+
const buttons = [
|
|
21
|
+
button(
|
|
22
|
+
'migration',
|
|
23
|
+
'Migrate context',
|
|
24
|
+
'M',
|
|
25
|
+
`http://localhost:8080/cca/${base}/@@volto_migrate`,
|
|
26
|
+
),
|
|
27
|
+
button(
|
|
28
|
+
'view',
|
|
29
|
+
'View original',
|
|
30
|
+
'V',
|
|
31
|
+
`https://climate-adapt.eea.europa.eu${base}`,
|
|
32
|
+
),
|
|
33
|
+
button(
|
|
34
|
+
'debug',
|
|
35
|
+
'Debug',
|
|
36
|
+
'PDB',
|
|
37
|
+
`http://localhost:8080/cca/${base}/@@gopdb`,
|
|
38
|
+
),
|
|
39
|
+
button(
|
|
40
|
+
'translate',
|
|
41
|
+
'Translate',
|
|
42
|
+
'T',
|
|
43
|
+
`http://localhost:8080/cca/${base}/@@volto-html`,
|
|
44
|
+
),
|
|
45
|
+
button(
|
|
46
|
+
'preview',
|
|
47
|
+
'Preview Translation',
|
|
48
|
+
'P',
|
|
49
|
+
`http://localhost:8080/cca/${base}/@@volto-html?half=1`,
|
|
50
|
+
),
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
if (!show) return null;
|
|
9
54
|
|
|
10
|
-
return
|
|
55
|
+
return (
|
|
11
56
|
<Plug
|
|
12
57
|
pluggable="main.toolbar.top"
|
|
13
58
|
id="cca-migration-helpers"
|
|
14
59
|
order={0}
|
|
15
60
|
dependencies={[contentId]}
|
|
16
61
|
>
|
|
17
|
-
|
|
18
|
-
className={`circle-right-btn `}
|
|
19
|
-
id="toolbar-migration"
|
|
20
|
-
onClick={() =>
|
|
21
|
-
window.open(
|
|
22
|
-
`http://localhost:8080/cca/${base}/@@volto_migrate`,
|
|
23
|
-
'_blank',
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
title="Migrate context"
|
|
27
|
-
>
|
|
28
|
-
M
|
|
29
|
-
</button>
|
|
30
|
-
|
|
31
|
-
<button
|
|
32
|
-
className={`circle-right-btn `}
|
|
33
|
-
id="toolbar-view"
|
|
34
|
-
onClick={() =>
|
|
35
|
-
window.open(`https://climate-adapt.eea.europa.eu${base}`, '_blank')
|
|
36
|
-
}
|
|
37
|
-
title="View original"
|
|
38
|
-
>
|
|
39
|
-
V
|
|
40
|
-
</button>
|
|
41
|
-
|
|
42
|
-
<button
|
|
43
|
-
className={`circle-right-btn`}
|
|
44
|
-
id="toolbar-migration"
|
|
45
|
-
onClick={() => window.open(`http://localhost:8080/cca/${base}/@@gopdb`)}
|
|
46
|
-
title="Migrate context"
|
|
47
|
-
>
|
|
48
|
-
PDB
|
|
49
|
-
</button>
|
|
62
|
+
{buttons}
|
|
50
63
|
</Plug>
|
|
51
|
-
)
|
|
64
|
+
);
|
|
52
65
|
}
|
|
53
66
|
|
|
54
67
|
export default MigrationButtons;
|
package/src/components/index.js
CHANGED
|
@@ -3,12 +3,15 @@ import { SidebarPortal } from '@plone/volto/components';
|
|
|
3
3
|
import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
|
|
4
4
|
import Schema from './schema';
|
|
5
5
|
import View from './CollectionStatsView';
|
|
6
|
+
import TransparentOverlay from '../../TransparentOverlay';
|
|
6
7
|
|
|
7
8
|
const Edit = (props) => {
|
|
8
9
|
const schema = Schema();
|
|
9
10
|
return (
|
|
10
11
|
<>
|
|
11
|
-
<
|
|
12
|
+
<TransparentOverlay>
|
|
13
|
+
<View {...props} mode="edit" />
|
|
14
|
+
</TransparentOverlay>
|
|
12
15
|
|
|
13
16
|
<SidebarPortal selected={props.selected}>
|
|
14
17
|
<InlineForm
|
|
@@ -15,30 +15,32 @@ const OrganisationCardsListingView = ({ items, isEditMode, token }) => {
|
|
|
15
15
|
'european-commission': 'European Commission',
|
|
16
16
|
'european-environment-agency-eea': 'European Environment Agency',
|
|
17
17
|
'european-food-safety-authority': 'European Food Safety Authority',
|
|
18
|
-
'lancet-countdown': 'Lancet Countdown',
|
|
18
|
+
'lancet-countdown': 'Lancet Countdown in Europe',
|
|
19
19
|
'who-regional-office-for-europe-who-europe':
|
|
20
20
|
'WHO Regional Office for Europe',
|
|
21
21
|
'world-health-organization': 'World Health Organization',
|
|
22
|
+
'association-schools-public-health-in-european-region-aspher':
|
|
23
|
+
'The Association of Schools of Public Health in the European Region',
|
|
22
24
|
};
|
|
23
25
|
const org = mapContributorValues[item['@id'].split('/').pop()] || '';
|
|
24
|
-
const query =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
26
|
+
const query =
|
|
27
|
+
'size=n_10_n' +
|
|
28
|
+
'&filters[0][field]=cca_partner_contributors.keyword' +
|
|
29
|
+
'&filters[0][values][0]=' +
|
|
30
|
+
org +
|
|
31
|
+
'&filters[0][type]=any' +
|
|
32
|
+
'&filters[1][field]=issued.date' +
|
|
33
|
+
'&filters[1][values][0]=Last 5 years' +
|
|
34
|
+
'&filters[1][type]=any' +
|
|
35
|
+
'&filters[2][field]=language' +
|
|
36
|
+
'&filters[2][values][0]=en' +
|
|
37
|
+
'&filters[2][type]=any' +
|
|
38
|
+
'&sort-field=issued.date' +
|
|
39
|
+
'&sort-direction=desc';
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
return `/en/observatory/advanced-search?${query
|
|
42
|
+
.replaceAll('[', '%5B')
|
|
43
|
+
.replaceAll(']', '%5D')}`;
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
return (
|
|
@@ -141,7 +141,6 @@ const EEAHeader = (props) => {
|
|
|
141
141
|
<a
|
|
142
142
|
href="https://europa.eu/european-union/contact/institutions-bodies_en"
|
|
143
143
|
target="_blank"
|
|
144
|
-
rel="noreferrer"
|
|
145
144
|
onKeyDown={(evt) => evt.stopPropagation()}
|
|
146
145
|
>
|
|
147
146
|
See all EU institutions and bodies
|
|
@@ -164,7 +163,6 @@ const EEAHeader = (props) => {
|
|
|
164
163
|
href={item.href}
|
|
165
164
|
className="site"
|
|
166
165
|
target="_blank"
|
|
167
|
-
rel="noreferrer"
|
|
168
166
|
onKeyDown={(evt) => evt.stopPropagation()}
|
|
169
167
|
>
|
|
170
168
|
{item.title}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Message, Icon } from 'semantic-ui-react';
|
|
2
|
+
|
|
3
|
+
const PortalMessage = (props) => {
|
|
4
|
+
const { content } = props;
|
|
5
|
+
const { review_state } = content;
|
|
6
|
+
const isArchivedContent = review_state === 'archived';
|
|
7
|
+
|
|
8
|
+
return isArchivedContent ? (
|
|
9
|
+
<Message info icon>
|
|
10
|
+
<Icon name="info" />
|
|
11
|
+
<Message.Content>
|
|
12
|
+
This object has been archived because its content is outdated. You can
|
|
13
|
+
still access it as legacy.
|
|
14
|
+
</Message.Content>
|
|
15
|
+
</Message>
|
|
16
|
+
) : null;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default PortalMessage;
|