@eeacms/volto-cca-policy 0.2.20 → 0.2.22

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,24 @@ 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.22](https://github.com/eea/volto-cca-policy/compare/0.2.21...0.2.22) - 9 May 2024
8
+
9
+ #### :nail_care: Enhancements
10
+
11
+ - change(views): add link to download event calendar [kreafox - [`fa6f364`](https://github.com/eea/volto-cca-policy/commit/fa6f36420dc432eb5f7b6bf6195d7614a264fb21)]
12
+
13
+ ### [0.2.21](https://github.com/eea/volto-cca-policy/compare/0.2.20...0.2.21) - 9 May 2024
14
+
15
+ #### :rocket: New Features
16
+
17
+ - feat(block): add ContentLinks block [kreafox - [`4e7aaab`](https://github.com/eea/volto-cca-policy/commit/4e7aaab744ebc72dd98936a333a6df3e3315e945)]
18
+
19
+ #### :nail_care: Enhancements
20
+
21
+ - change: remove no needed info button [kreafox - [`6771435`](https://github.com/eea/volto-cca-policy/commit/677143541d515514a3b9541cce625319ab30425a)]
22
+ - change: blocks icon [kreafox - [`100bab4`](https://github.com/eea/volto-cca-policy/commit/100bab435aa72b20d2fade206dfeb7b53dec76ab)]
23
+ - change: share info button icon [kreafox - [`8ef908e`](https://github.com/eea/volto-cca-policy/commit/8ef908e3c26f2b80405c8cf480b73017e221d003)]
24
+
7
25
  ### [0.2.20](https://github.com/eea/volto-cca-policy/compare/0.2.19...0.2.20) - 8 May 2024
8
26
 
9
27
  #### :bug: Bug Fixes
@@ -1120,10 +1138,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1120
1138
  - Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
1121
1139
  - Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
1122
1140
  - Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
1141
+ - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
1142
+ - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
1123
1143
  ### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
1124
1144
 
1125
1145
  #### :house: Internal changes
1126
1146
 
1147
+ - chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
1127
1148
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
1128
1149
 
1129
1150
  #### :hammer_and_wrench: Others
@@ -1140,6 +1161,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1140
1161
  - Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
1141
1162
  - Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
1142
1163
  - Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
1164
+ - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
1165
+ - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
1166
+ - test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
1143
1167
  - Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
1144
1168
  - 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
1169
  - Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
@@ -1356,6 +1380,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1356
1380
 
1357
1381
  #### :house: Internal changes
1358
1382
 
1383
+ - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
1359
1384
 
1360
1385
  #### :hammer_and_wrench: Others
1361
1386
 
@@ -1836,6 +1861,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1836
1861
  #### :hammer_and_wrench: Others
1837
1862
 
1838
1863
  - Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
1864
+ - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
1839
1865
  ### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
1840
1866
 
1841
1867
  #### :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.20",
3
+ "version": "0.2.22",
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,
@@ -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>
@@ -4,12 +4,21 @@ import {
4
4
  PortalMessage,
5
5
  } from '@eeacms/volto-cca-policy/components';
6
6
  import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
7
- import { Grid, Container, Segment } from 'semantic-ui-react';
8
- import { FormattedMessage } from 'react-intl';
7
+ import { Grid, Container, Segment, Button, Icon } from 'semantic-ui-react';
8
+ import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
9
9
  import { SubjectTags, EventDetails } from '@eeacms/volto-cca-policy/helpers';
10
+ import { expandToBackendURL } from '@plone/volto/helpers';
11
+
12
+ const messages = defineMessages({
13
+ downloadEvent: {
14
+ id: 'Download this event in iCal format',
15
+ defaultMessage: 'Download this event in iCal format',
16
+ },
17
+ });
10
18
 
11
19
  function CcaEventView(props) {
12
20
  const { content } = props;
21
+ const intl = useIntl();
13
22
 
14
23
  return (
15
24
  <div className="cca-event-view">
@@ -41,6 +50,26 @@ function CcaEventView(props) {
41
50
  </p>
42
51
  </>
43
52
  )}
53
+
54
+ <div className="download-event">
55
+ <a
56
+ className="ics-download"
57
+ target="_blank"
58
+ rel="noreferrer"
59
+ href={`${expandToBackendURL(content['@id'])}/ics_view`}
60
+ >
61
+ <Button
62
+ className="icon inverted primary labeled"
63
+ title={intl.formatMessage(messages.downloadEvent)}
64
+ >
65
+ <Icon name="calendar alternate outline" />
66
+ <FormattedMessage
67
+ id="Download Event"
68
+ defaultMessage="Download Event"
69
+ />
70
+ </Button>
71
+ </a>
72
+ </div>
44
73
  </Segment>
45
74
  </Grid.Column>
46
75
  </Grid.Row>
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 = [