@eeacms/volto-clms-theme 1.0.138 → 1.0.140

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,30 @@ 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
+ ### [1.0.140](https://github.com/eea/volto-clms-theme/compare/1.0.139...1.0.140) - 7 November 2022
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: use UniversalLink to render the final link, and include the download url of the file [Mikel Larreategi - [`8a490db`](https://github.com/eea/volto-clms-theme/commit/8a490db836f72e1330aa2e22db5e8222fd7dbc53)]
12
+
13
+ #### :house: Internal changes
14
+
15
+ - chore: use UniversalLink [Mikel Larreategi - [`f304971`](https://github.com/eea/volto-clms-theme/commit/f304971e4d555dd16498ceccc5ff43586d81626b)]
16
+
17
+ #### :hammer_and_wrench: Others
18
+
19
+ - new sorting for geographical classification facet [Mikel Larreategi - [`4faaa55`](https://github.com/eea/volto-clms-theme/commit/4faaa55ac2bc2bd8b783d929b30faffa025bae38)]
20
+ ### [1.0.139](https://github.com/eea/volto-clms-theme/compare/1.0.138...1.0.139) - 4 November 2022
21
+
22
+ #### :bug: Bug Fixes
23
+
24
+ - fix: check parent when children is checked [ionlizarazu - [`9f82598`](https://github.com/eea/volto-clms-theme/commit/9f825985c8e0705c4a568629a6c535d4ecd369d8)]
25
+ - fix: small bugfixes [ionlizarazu - [`7db1b27`](https://github.com/eea/volto-clms-theme/commit/7db1b2782ac824ed97d0e820f02153edfcf58f0e)]
26
+
27
+ #### :hammer_and_wrench: Others
28
+
29
+ - taxonomyWidget checkbox behavior [ionlizarazu - [`91575e5`](https://github.com/eea/volto-clms-theme/commit/91575e581ad07ef19a1d012d6bc9862e5080725d)]
30
+ - add Interval hook to dispatch the query every 60 seconds [ionlizarazu - [`39fb6da`](https://github.com/eea/volto-clms-theme/commit/39fb6da38af389b48df04d57196f445c8317f097)]
7
31
  ### [1.0.138](https://github.com/eea/volto-clms-theme/compare/1.0.137...1.0.138) - 27 October 2022
8
32
 
9
33
  #### :bug: Bug Fixes
@@ -460,7 +484,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
460
484
  #### :hammer_and_wrench: Others
461
485
 
462
486
  - related products and datasets added to news and meeting views and login-plone route created [Unai - [`5704a1a`](https://github.com/eea/volto-clms-theme/commit/5704a1a766148746162b60efaf232ea90dc20cf4)]
463
- - Revert "[JENKINS] Use eeacms/plone-backend and Volto alpha version- Refs #151967" [Mikel Larreategi - [`46eb694`](https://github.com/eea/volto-clms-theme/commit/46eb69415280a3c982405299135027ae4221426a)]
464
487
  - sort items according to the lowercased label and put those with special meaning at the end [Mikel Larreategi - [`6410abe`](https://github.com/eea/volto-clms-theme/commit/6410abe096f60dcad54dced2026c9df9b7946d68)]
465
488
  - lint fix [Unai - [`1264a7a`](https://github.com/eea/volto-clms-theme/commit/1264a7adfe8d679fea1bd821ad087add20f4271d)]
466
489
  - footer newsletter subscription change, global search maxLength change from 8000 to 200 and /login design change [Unai - [`a09d24a`](https://github.com/eea/volto-clms-theme/commit/a09d24adbb6fa053fb2a2cc0071506b906593b42)]
@@ -611,7 +634,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
611
634
  - search block new features [ionlizarazu - [`8e814cb`](https://github.com/eea/volto-clms-theme/commit/8e814cbd359782540c21fe37b37ef146d331f0d6)]
612
635
  - language selector cookie management [ionlizarazu - [`1385ac9`](https://github.com/eea/volto-clms-theme/commit/1385ac95795702206d3623ba6e780faa43a89e0a)]
613
636
  - toolbar cookie management [ionlizarazu - [`5c23200`](https://github.com/eea/volto-clms-theme/commit/5c23200790b20e1d4f1bc966463c37bf4c808f47)]
614
- - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`0316a0d`](https://github.com/eea/volto-clms-theme/commit/0316a0d8b6fb0fa14af13002415f3c95d9f8ede3)]
615
637
  ### [1.0.84](https://github.com/eea/volto-clms-theme/compare/1.0.83...1.0.84) - 18 March 2022
616
638
 
617
639
  #### :hammer_and_wrench: Others
@@ -1516,13 +1538,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1516
1538
  #### :hammer_and_wrench: Others
1517
1539
 
1518
1540
  - replace @collective/volto-dropdownmenu with volto-dropdownmenu [ionlizarazu - [`07f004f`](https://github.com/eea/volto-clms-theme/commit/07f004fe0219e403fb51bc045c83d34f3b981f76)]
1519
- - yarn.lock [ionlizarazu - [`fe1ca04`](https://github.com/eea/volto-clms-theme/commit/fe1ca04889d29fe7b653db4c69af2751b84b8a1a)]
1520
1541
  - add NODE_ENV parameter [ionlizarazu - [`101f27c`](https://github.com/eea/volto-clms-theme/commit/101f27c25b8fbd192e1b11865e95cf5ffee08c1b)]
1521
1542
  - upgrade volto-dropdownmenu version [ionlizarazu - [`2081855`](https://github.com/eea/volto-clms-theme/commit/2081855301f4c708776e0dbab39db143cee00dbc)]
1522
1543
  - HomeSearch block missing url behaviour [ionlizarazu - [`d20a378`](https://github.com/eea/volto-clms-theme/commit/d20a378ce3f254b8343692348f314bf281974542)]
1523
1544
  - babel configuration [ionlizarazu - [`203ea2d`](https://github.com/eea/volto-clms-theme/commit/203ea2de07f99ca3403e4ca220ca74d7ce69b61d)]
1524
1545
  - prettier [ionlizarazu - [`e79e26b`](https://github.com/eea/volto-clms-theme/commit/e79e26bf2fa40ba7b4eb53a24dabd87928221c28)]
1525
- - add yarn lock [ionlizarazu - [`e1ab28b`](https://github.com/eea/volto-clms-theme/commit/e1ab28b060d5a74431c368b0de82a68dabce1eab)]
1526
1546
  - Jenkinsfile cypress test [ionlizarazu - [`b385d65`](https://github.com/eea/volto-clms-theme/commit/b385d65986f717c60f8c434a08fc11b829d08eb4)]
1527
1547
  - cypress [ionlizarazu - [`a243cf0`](https://github.com/eea/volto-clms-theme/commit/a243cf0182fa3dd113c16ff495c71e310252d83b)]
1528
1548
  - some fixes [ionlizarazu - [`046279b`](https://github.com/eea/volto-clms-theme/commit/046279b9d05bea8a64eca03eed493e02621534c9)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.138",
3
+ "version": "1.0.140",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -5,6 +5,7 @@ import { flattenToAppURL } from '@plone/volto/helpers';
5
5
 
6
6
  import { isInternalURL } from '@plone/volto/helpers/Url/Url';
7
7
  import { useSelector } from 'react-redux';
8
+ import { UniversalLink } from '@plone/volto/components';
8
9
 
9
10
  import CclCard from '@eeacms/volto-clms-theme/components/CclCard/CclCard';
10
11
 
@@ -27,7 +28,7 @@ const CclListingCards = (props) => {
27
28
  </ConditionalLink>
28
29
  );
29
30
  } else if (href) {
30
- link = <a href={href}>{linkTitle || href}</a>;
31
+ link = <UniversalLink href={href}>{linkTitle || href}</UniversalLink>;
31
32
  }
32
33
  let containerClass = '';
33
34
  if (['news', 'event'].includes(variation)) {
@@ -53,10 +53,10 @@ const DoubleRangeFacet = (props) => {
53
53
 
54
54
  const startingValues = convertToRange(choices);
55
55
 
56
- const onChangeRange = (rValue, onChangeR, sValue) => {
56
+ const onChangeRange = (nValue, onChangeR, sValue) => {
57
57
  const fixedValue = {
58
- min: rValue.min < sValue.min ? sValue.min : rValue.min,
59
- max: rValue.max > sValue.max ? sValue.max : rValue.max,
58
+ min: nValue.min < sValue.min ? sValue.min : nValue.min,
59
+ max: nValue.max > sValue.max ? sValue.max : nValue.max,
60
60
  };
61
61
  onChangeR(
62
62
  facet.field.value,
@@ -83,7 +83,7 @@ const DoubleRangeFacet = (props) => {
83
83
  <InputRange
84
84
  minValue={startingValues.min}
85
85
  maxValue={startingValues.max}
86
- step={facet.step ?? 1}
86
+ step={facet.step ? parseInt(facet.step) : 1}
87
87
  value={
88
88
  facetValue.length > 0
89
89
  ? convertToRange(facetValue)
@@ -52,6 +52,13 @@ const rewriteOptions = (name, choices) => {
52
52
  'Document',
53
53
  ];
54
54
 
55
+ const dataset_geographical_classification = [
56
+ 'EEA',
57
+ 'Northern hemisphere',
58
+ 'Southern hemisphere',
59
+ 'Global',
60
+ ];
61
+
55
62
  if (name === 'portal_type') {
56
63
  result = choices
57
64
  .filter((opt) => portal_types.includes(opt.value))
@@ -114,6 +121,16 @@ const rewriteOptions = (name, choices) => {
114
121
  return 0;
115
122
  });
116
123
  }
124
+
125
+ if (name === 'dataset_geographical_classification') {
126
+ result = choices.sort((a, b) => {
127
+ return (
128
+ dataset_geographical_classification.indexOf(a.value) -
129
+ dataset_geographical_classification.indexOf(b.value)
130
+ );
131
+ });
132
+ }
133
+
117
134
  return result;
118
135
  };
119
136
 
@@ -1,25 +1,45 @@
1
- /**
2
- * CLMSDownloadsView.
3
- * @module components/CLMSDownloadsView/CLMSDownloadsView
4
- */
1
+ import React, { useEffect, useState } from 'react';
2
+ import { defineMessages, useIntl } from 'react-intl';
3
+ import { useDispatch, useSelector } from 'react-redux';
5
4
 
6
5
  import { Forbidden, Unauthorized } from '@plone/volto/components';
7
- import React, { useEffect } from 'react';
8
- import { defineMessages, useIntl } from 'react-intl';
6
+ import { Helmet } from '@plone/volto/helpers';
7
+ import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
8
+ import { Segment } from 'semantic-ui-react';
9
+
9
10
  import {
10
11
  getDatasetsByUid,
11
12
  getExtraBreadcrumbItems,
12
13
  getDownloadtool,
13
14
  } from '../../actions';
14
- import { useDispatch, useSelector } from 'react-redux';
15
-
16
15
  import CLMSDownloadTask from './CLMSDownloadTasks';
17
- import { Helmet } from '@plone/volto/helpers';
18
- import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
16
+
17
+ /**
18
+ * CLMSDownloadsView.
19
+ * @module components/CLMSDownloadsView/CLMSDownloadsView
20
+ */
21
+
22
+ const useInterval = (f, delay) => {
23
+ const [timer, setTimer] = useState(undefined);
24
+ const start = () => {
25
+ if (timer) return;
26
+ setTimer(setInterval(f, delay));
27
+ };
28
+ const stop = () => {
29
+ if (!timer) return;
30
+ setTimer(clearInterval(timer));
31
+ };
32
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33
+ useEffect(() => stop, []);
34
+ return start;
35
+ };
19
36
 
20
37
  const CLMSDownloadsView = (props) => {
21
38
  const dispatch = useDispatch();
22
39
  const downloadtool = useSelector((state) => state.downloadtool);
40
+ const datasetsByUid = useSelector((state) => state.datasetsByUid);
41
+ /* DISPATCH THE getDownloadtool ACTION EVERY 60 SECONDS */
42
+ const start = useInterval((_) => dispatch(getDownloadtool()), 60000);
23
43
  const { isLoggedIn } = useCartState();
24
44
 
25
45
  const { formatMessage } = useIntl();
@@ -109,7 +129,9 @@ const CLMSDownloadsView = (props) => {
109
129
  useEffect(() => {
110
130
  if (downloadtool.delete_download_in_progress) {
111
131
  dispatch(getDownloadtool());
132
+ start();
112
133
  }
134
+ // eslint-disable-next-line react-hooks/exhaustive-deps
113
135
  }, [dispatch, downloadtool.delete_download_in_progress]);
114
136
 
115
137
  return (
@@ -137,7 +159,12 @@ const CLMSDownloadsView = (props) => {
137
159
  {formatMessage(messages.CartDownloads)}
138
160
  </h1>
139
161
  <div className="ccl-container">
140
- <CLMSDownloadTask />
162
+ <Segment
163
+ basic
164
+ loading={downloadtool.loading || datasetsByUid.loading}
165
+ >
166
+ <CLMSDownloadTask />
167
+ </Segment>
141
168
  </div>
142
169
  </>
143
170
  )}
@@ -13,6 +13,7 @@ import { Icon as VoltoIcon } from '@plone/volto/components';
13
13
 
14
14
  import PlaceHolder from '@eeacms/volto-clms-theme/../theme/clms/img/ccl-thumbnail-placeholder.jpg';
15
15
  import { cclDateFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
16
+ import { UniversalLink } from '@plone/volto/components';
16
17
 
17
18
  const CardImage = ({ card, size = 'preview', isCustomCard }) => {
18
19
  return card?.image_field ? (
@@ -142,7 +143,12 @@ function CclCard(props) {
142
143
  </div>
143
144
  <div className="card-text">
144
145
  <div className="card-file-title">
145
- <CardLink url={url}>{card?.title}</CardLink>
146
+ <UniversalLink
147
+ openLinkInNewTab={true}
148
+ href={url + '/@@download/file'}
149
+ >
150
+ {card?.title}
151
+ </UniversalLink>
146
152
  </div>
147
153
  {showDates && (
148
154
  <div className="card-file-date">
@@ -170,12 +170,27 @@ const CheckboxListParent = ({ option, key, onChange, value, id }) => {
170
170
  onChange={(event, { checked }) => {
171
171
  checked
172
172
  ? onChange(id, [
173
- ...value,
173
+ ...value.filter(
174
+ (v) =>
175
+ option.childrens.filter(
176
+ (ch) => ch.value === v.token,
177
+ ).length === 0,
178
+ ),
174
179
  { title: option.original, token: option.value },
180
+ ...option.childrens.map((ch) => {
181
+ return { title: ch.original, token: ch.value };
182
+ }),
175
183
  ])
176
184
  : onChange(
177
185
  id,
178
- value.filter((item) => item.token !== option.value),
186
+ value
187
+ .filter((item) => item.token !== option.value)
188
+ .filter(
189
+ (v) =>
190
+ option.childrens.filter(
191
+ (ch) => ch.value === v.token,
192
+ ).length === 0,
193
+ ),
179
194
  );
180
195
  }}
181
196
  label={
@@ -218,6 +233,11 @@ const CheckboxListParent = ({ option, key, onChange, value, id }) => {
218
233
  ? onChange(id, [
219
234
  ...value,
220
235
  { title: child.original, token: child.value },
236
+ value.filter((v) => v.token === option.value)
237
+ .length === 0 && {
238
+ title: option.original,
239
+ token: option.value,
240
+ },
221
241
  ])
222
242
  : onChange(
223
243
  id,