@eeacms/volto-cca-policy 0.2.19 → 0.2.21

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 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.2.21](https://github.com/eea/volto-cca-policy/compare/0.2.20...0.2.21) - 9 May 2024
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat(block): add ContentLinks block [kreafox - [`4e7aaab`](https://github.com/eea/volto-cca-policy/commit/4e7aaab744ebc72dd98936a333a6df3e3315e945)]
12
+
13
+ #### :nail_care: Enhancements
14
+
15
+ - change: remove no needed info button [kreafox - [`6771435`](https://github.com/eea/volto-cca-policy/commit/677143541d515514a3b9541cce625319ab30425a)]
16
+ - change: blocks icon [kreafox - [`100bab4`](https://github.com/eea/volto-cca-policy/commit/100bab435aa72b20d2fade206dfeb7b53dec76ab)]
17
+ - change: share info button icon [kreafox - [`8ef908e`](https://github.com/eea/volto-cca-policy/commit/8ef908e3c26f2b80405c8cf480b73017e221d003)]
18
+
19
+ ### [0.2.20](https://github.com/eea/volto-cca-policy/compare/0.2.19...0.2.20) - 8 May 2024
20
+
21
+ #### :bug: Bug Fixes
22
+
23
+ - fix(block): undefined error [kreafox - [`8fac298`](https://github.com/eea/volto-cca-policy/commit/8fac2983375a3bdc38a0aa0b9ccff0df3a4a5dda)]
24
+
25
+ #### :hammer_and_wrench: Others
26
+
27
+ - Refs #269158 - observatory section [Tripon Eugen - [`69fb8eb`](https://github.com/eea/volto-cca-policy/commit/69fb8ebf617ac291c217cdc8ad5d51543b7e351f)]
7
28
  ### [0.2.19](https://github.com/eea/volto-cca-policy/compare/0.2.18...0.2.19) - 7 May 2024
8
29
 
9
30
  #### :bug: Bug Fixes
@@ -11,9 +32,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
11
32
  - fix: use DefaultView in layoutViews [kreafox - [`a87f13f`](https://github.com/eea/volto-cca-policy/commit/a87f13fc22374b40b3fbf2d0faff30059b65a610)]
12
33
  - fix: update tests [kreafox - [`9f71324`](https://github.com/eea/volto-cca-policy/commit/9f7132455a988c09fed5a064a1c3e7f63856e27f)]
13
34
 
14
- #### :hammer_and_wrench: Others
15
-
16
- - Don't show content of redirection block [Tiberiu Ichim - [`65a1537`](https://github.com/eea/volto-cca-policy/commit/65a153714e4fe360c67f89575d1397d697a14711)]
17
35
  ### [0.2.18](https://github.com/eea/volto-cca-policy/compare/0.2.17...0.2.18) - 7 May 2024
18
36
 
19
37
  #### :nail_care: Enhancements
@@ -1114,13 +1132,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1114
1132
  - Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
1115
1133
  - Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
1116
1134
  - Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
1117
- - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
1118
- - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
1119
1135
  ### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
1120
1136
 
1121
1137
  #### :house: Internal changes
1122
1138
 
1123
- - chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
1124
1139
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
1125
1140
 
1126
1141
  #### :hammer_and_wrench: Others
@@ -1137,9 +1152,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1137
1152
  - Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
1138
1153
  - Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
1139
1154
  - Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
1140
- - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
1141
- - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
1142
- - test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
1143
1155
  - Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
1144
1156
  - 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)]
1145
1157
  - Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
@@ -1356,7 +1368,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1356
1368
 
1357
1369
  #### :house: Internal changes
1358
1370
 
1359
- - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
1360
1371
 
1361
1372
  #### :hammer_and_wrench: Others
1362
1373
 
@@ -1837,7 +1848,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1837
1848
  #### :hammer_and_wrench: Others
1838
1849
 
1839
1850
  - Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
1840
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
1841
1851
  ### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
1842
1852
 
1843
1853
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.2.19",
3
+ "version": "0.2.21",
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",
@@ -4,7 +4,7 @@ import CollectionStatsView, {
4
4
  RemixIcon,
5
5
  } from './CollectionStatsView';
6
6
 
7
- import worldSVG from '@plone/volto/icons/world.svg';
7
+ import dotsSVG from '@plone/volto/icons/dots.svg';
8
8
  import airPollutionSvg from '@eeacms/volto-cca-policy/icons/air_pollution_and_aero-allergens.svg';
9
9
  import heatSvg from '@eeacms/volto-cca-policy/icons/heat.svg';
10
10
  import climateSensitiveSvg from '@eeacms/volto-cca-policy/icons/climate-sensitive_diseases.svg';
@@ -57,7 +57,7 @@ export default function installCollectionStatsBlock(config) {
57
57
  config.blocks.blocksConfig.collectionStats = {
58
58
  id: 'collectionStats',
59
59
  title: 'Collection Statistics',
60
- icon: worldSVG,
60
+ icon: dotsSVG,
61
61
  group: 'site',
62
62
  edit: CollectionStatsEdit,
63
63
  view: CollectionStatsView,
@@ -0,0 +1,45 @@
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 schema from './schema';
7
+ import ContentLinksView from './ContentLinksView';
8
+
9
+ export default function ContentLinksEdit(props) {
10
+ const { block, data, onChangeBlock, selected, id } = props;
11
+
12
+ const { items = [] } = data;
13
+ const [refresh, forceRefresh] = React.useState(0);
14
+
15
+ React.useEffect(() => {
16
+ items.forEach((item, index) => {
17
+ if (item.source?.length && !item.item_title) {
18
+ item.item_title = item.source[0].title;
19
+ item.link = item.source['@id'];
20
+ forceRefresh(refresh + 1);
21
+ }
22
+ });
23
+ }, [items, refresh]);
24
+
25
+ return (
26
+ <div>
27
+ <ContentLinksView data={data} id={id} mode="edit" />
28
+ <SidebarPortal selected={selected}>
29
+ <BlockDataForm
30
+ block={block}
31
+ title={schema.title}
32
+ schema={schema}
33
+ onChangeField={(id, value) => {
34
+ onChangeBlock(block, {
35
+ ...data,
36
+ [id]: value,
37
+ });
38
+ }}
39
+ onChangeBlock={onChangeBlock}
40
+ formData={data}
41
+ />
42
+ </SidebarPortal>
43
+ </div>
44
+ );
45
+ }
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { List } from 'semantic-ui-react';
3
+ import { Link } from 'react-router-dom';
4
+ import { useLocation } from 'react-router-dom';
5
+ import { flattenToAppURL } from '@plone/volto/helpers';
6
+ import cx from 'classnames';
7
+
8
+ import './style.less';
9
+
10
+ const ContentLinksView = (props) => {
11
+ const location = useLocation();
12
+ const { data, mode = 'view' } = props;
13
+ const { title, items = [], variation } = data;
14
+ const isEdit = mode === 'edit';
15
+
16
+ return items && items.length > 0 ? (
17
+ <div className={`block content-links ${variation}-view`}>
18
+ {title && <h4>{title}</h4>}
19
+
20
+ <List className="content-items">
21
+ {items.map((item, index) => {
22
+ const link = item?.source?.[0]?.['@id'];
23
+ const active = location.pathname === link;
24
+ return (
25
+ <List.Item
26
+ key={index}
27
+ className={cx({
28
+ active: active,
29
+ })}
30
+ >
31
+ <Link to={flattenToAppURL(link)}>{item.item_title}</Link>
32
+ </List.Item>
33
+ );
34
+ })}
35
+ </List>
36
+ </div>
37
+ ) : (
38
+ <>{isEdit && <div>No items</div>}</>
39
+ );
40
+ };
41
+
42
+ export default ContentLinksView;
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import { MemoryRouter } from 'react-router-dom';
3
+ import configureStore from 'redux-mock-store';
4
+ import renderer from 'react-test-renderer';
5
+
6
+ import '@testing-library/jest-dom/extend-expect';
7
+ import { Provider } from 'react-intl-redux';
8
+ import ContentLinksView from './ContentLinksView';
9
+
10
+ const mockStore = configureStore();
11
+
12
+ jest.mock('semantic-ui-react', () => ({
13
+ ...jest.requireActual('semantic-ui-react'),
14
+ Icon: () => <div>Icon</div>,
15
+ }));
16
+
17
+ jest.mock('react-router-dom', () => ({
18
+ ...jest.requireActual('react-router-dom'),
19
+ Link: () => <div>Link</div>,
20
+ }));
21
+
22
+ describe('ContentLinksView', () => {
23
+ it('should render the component', () => {
24
+ const data = {
25
+ '@type': 'contentLinks',
26
+ items: [
27
+ {
28
+ item_title: 'Item 1',
29
+ source: [
30
+ {
31
+ '@id': '/item-1',
32
+ title: 'Item 1',
33
+ },
34
+ ],
35
+ },
36
+ {
37
+ '@id': '7e2af23d-3905-404c-895f-0d31ea5878ef',
38
+ item_title: 'Item 2',
39
+ source: [
40
+ {
41
+ '@id': '/item-2',
42
+ title: 'Item 2',
43
+ },
44
+ ],
45
+ },
46
+ ],
47
+ show_share_btn: false,
48
+ title: 'Navigation',
49
+ variation: 'default',
50
+ };
51
+
52
+ const store = mockStore({
53
+ userSession: { token: '1234' },
54
+ intl: {
55
+ locale: 'en',
56
+ messages: {},
57
+ },
58
+ });
59
+
60
+ const component = renderer.create(
61
+ <Provider store={store}>
62
+ <MemoryRouter>
63
+ <ContentLinksView data={data} />
64
+ </MemoryRouter>
65
+ </Provider>,
66
+ );
67
+ const json = component.toJSON();
68
+ expect(json).toMatchSnapshot();
69
+ });
70
+ });
@@ -0,0 +1,35 @@
1
+ import listSVG from '@plone/volto/icons/list-bullet.svg';
2
+ import ContentLinksEdit from './ContentLinksEdit';
3
+ import ContentLinksView from './ContentLinksView';
4
+
5
+ export default function installBlock(config) {
6
+ config.blocks.blocksConfig.contentLinks = {
7
+ id: 'contentLinks',
8
+ title: 'Content links',
9
+ icon: listSVG,
10
+ group: 'site',
11
+ view: ContentLinksView,
12
+ edit: ContentLinksEdit,
13
+ sidebarTab: 1,
14
+ security: {
15
+ addPermission: [],
16
+ view: [],
17
+ },
18
+ variations: [
19
+ {
20
+ id: 'default',
21
+ title: 'Simple list (default)',
22
+ isDefault: true,
23
+ },
24
+ {
25
+ id: 'navigationList',
26
+ title: 'Navigation list',
27
+ isDefault: false,
28
+ fullobjects: true,
29
+ },
30
+ ],
31
+ restricted: false,
32
+ };
33
+
34
+ return config;
35
+ }
@@ -0,0 +1,47 @@
1
+ const Item = () => ({
2
+ title: 'Item',
3
+ fieldsets: [
4
+ {
5
+ id: 'default',
6
+ title: 'Default',
7
+ fields: ['source', 'item_title'],
8
+ },
9
+ ],
10
+ properties: {
11
+ source: {
12
+ widget: 'object_browser',
13
+ mode: 'link',
14
+ title: 'Source',
15
+ description: 'Choose an existing content as source',
16
+ },
17
+ item_title: {
18
+ type: 'string',
19
+ title: 'Title',
20
+ },
21
+ },
22
+
23
+ required: ['title'],
24
+ });
25
+
26
+ export default {
27
+ title: 'Content links',
28
+ fieldsets: [
29
+ {
30
+ id: 'default',
31
+ title: 'Default',
32
+ fields: ['title', 'items'],
33
+ },
34
+ ],
35
+ properties: {
36
+ items: {
37
+ widget: 'object_list',
38
+ title: 'Items',
39
+ description: 'Add a list of items',
40
+ schema: Item(),
41
+ },
42
+ title: {
43
+ title: 'Block title',
44
+ },
45
+ },
46
+ required: [],
47
+ };
@@ -0,0 +1,33 @@
1
+ @type: 'extra';
2
+ @element: 'custom';
3
+
4
+ @import (multiple, reference, optional) '../../theme.config';
5
+
6
+ .content-items {
7
+ margin-bottom: 1em;
8
+
9
+ .item:hover,
10
+ .item.active {
11
+ color: @primaryColor;
12
+ }
13
+
14
+ a,
15
+ a:visited {
16
+ color: inherit;
17
+ }
18
+ }
19
+
20
+ .navigationList-view {
21
+ .item {
22
+ padding: 0.75rem 0 0.75rem 0.75rem !important;
23
+
24
+ &:hover {
25
+ color: @primaryColor;
26
+ }
27
+
28
+ &.active {
29
+ background: @primaryColor;
30
+ color: @white;
31
+ }
32
+ }
33
+ }
@@ -1,4 +1,4 @@
1
- import zoomSVG from '@plone/volto/icons/zoom.svg';
1
+ import contentSVG from '@plone/volto/icons/content.svg';
2
2
  import RASTEdit from './RASTEdit';
3
3
  import RASTView from './RASTView';
4
4
  import { blockAvailableInMission } from '@eeacms/volto-cca-policy/utils';
@@ -9,7 +9,7 @@ export default function installBlock(config) {
9
9
  blocksConfig.rastBlock = {
10
10
  id: 'rastBlock',
11
11
  title: 'RAST',
12
- icon: zoomSVG,
12
+ icon: contentSVG,
13
13
  group: 'site',
14
14
  view: RASTView,
15
15
  edit: RASTEdit,
@@ -1,4 +1,4 @@
1
- import zoomSVG from '@plone/volto/icons/zoom.svg';
1
+ import redoSVG from '@plone/volto/icons/redo.svg';
2
2
  import RedirectBlockEdit from './RedirectBlockEdit';
3
3
  import RedirectBlockView from './RedirectBlockView';
4
4
  // import { blockAvailableInMission } from '@eeacms/volto-cca-policy/utils';
@@ -7,7 +7,7 @@ export default function installBlock(config) {
7
7
  config.blocks.blocksConfig.redirectBlock = {
8
8
  id: 'redirectBlock',
9
9
  title: 'Redirection Block',
10
- icon: zoomSVG,
10
+ icon: redoSVG,
11
11
  group: 'site',
12
12
  view: RedirectBlockView,
13
13
  edit: RedirectBlockEdit,
@@ -19,7 +19,7 @@ const RelevantAceContentView = (props) => {
19
19
  const results = _v_results || [];
20
20
  const isEdit = mode === 'edit' ? true : false;
21
21
  const hasAnyFilter = [element_type, sector, search_type, special_tags].some(
22
- (list) => list.length > 0,
22
+ (list) => list?.length > 0,
23
23
  );
24
24
 
25
25
  return (
@@ -20,6 +20,7 @@ import installReadMore from './ReadMore';
20
20
  import installCollectionStats from './CollectionStatistics';
21
21
  import installTabsBlock from './TabsBlock';
22
22
  import installRedirectBlock from './RedirectBlock';
23
+ import installContentLinks from './ContentLinks';
23
24
 
24
25
  export default function installBlocks(config) {
25
26
  config.blocks.blocksConfig.title.restricted = false;
@@ -49,5 +50,6 @@ export default function installBlocks(config) {
49
50
  installTabsBlock,
50
51
  installListing,
51
52
  installRedirectBlock,
53
+ installContentLinks,
52
54
  )(config);
53
55
  }
@@ -15,7 +15,7 @@ const ShareInfoButton = (props) => {
15
15
  id="Share your information"
16
16
  defaultMessage="Share your information"
17
17
  />
18
- <Icon name="right arrow" />
18
+ <Icon name="ri-share-line" />
19
19
  </Button>
20
20
  </Link>
21
21
  </div>
package/src/index.js CHANGED
@@ -313,12 +313,6 @@ const applyConfig = (config) => {
313
313
  bottomLevel: 2,
314
314
  rootPath: 'countries-regions/transnational-regions/carpathian-mountains',
315
315
  },
316
- {
317
- title: 'Share your info',
318
- topLevel: 2,
319
- bottomLevel: 2,
320
- rootPath: 'help/share-your-info',
321
- },
322
316
  ];
323
317
 
324
318
  config.settings.astNavigations = [
@@ -1,6 +1,7 @@
1
1
  import { mergeConfig } from '@eeacms/search';
2
2
  import { build_runtime_mappings } from '@eeacms/volto-globalsearch/utils';
3
3
  import { getClientProxyAddress } from './../utils';
4
+ import vocabs from './../vocabulary';
4
5
 
5
6
  import facets from './facets-health';
6
7
  import views from './views-health';
@@ -75,11 +76,7 @@ export default function installMainSearch(config) {
75
76
  elastic_index: '_es/globalsearch',
76
77
  index_name: 'data_searchui',
77
78
  host: process.env.RAZZLE_ES_PROXY_ADDR || 'http://localhost:3000',
78
- vocab: {
79
- cluster_name: {
80
- cca: 'Climate-ADAPT',
81
- },
82
- },
79
+ ...vocabs,
83
80
  runtime_mappings: build_runtime_mappings(clusters),
84
81
  };
85
82