@eeacms/volto-clms-theme 1.1.222 → 1.1.224

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.
Binary file
package/CHANGELOG.md CHANGED
@@ -4,6 +4,23 @@ 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.1.224](https://github.com/eea/volto-clms-theme/compare/1.1.223...1.1.224) - 23 March 2025
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: add a message about the range of the time series datasets in the Download tab of the dataset -refs #283619 [ana-oprea - [`abddead`](https://github.com/eea/volto-clms-theme/commit/abddeadc7b5c276c46341aa0fa5712648f483fcb)]
12
+
13
+ ### [1.1.223](https://github.com/eea/volto-clms-theme/compare/1.1.222...1.1.223) - 19 March 2025
14
+
15
+ #### :bug: Bug Fixes
16
+
17
+ - fix: cards link, add custom button block and change product links component url widget [ana-oprea - [`ed05876`](https://github.com/eea/volto-clms-theme/commit/ed05876fb1f917fa7dee45f88017f6c5db3d9107)]
18
+
19
+ #### :house: Internal changes
20
+
21
+ - chore: change widgets [ana-oprea - [`270b678`](https://github.com/eea/volto-clms-theme/commit/270b67851a60da8382ba612cab90cfd931be3d8f)]
22
+ - chore: delete comment [ana-oprea - [`ecdfb91`](https://github.com/eea/volto-clms-theme/commit/ecdfb91106050dce7d7cc7ff8d17f1b13abbce94)]
23
+
7
24
  ### [1.1.222](https://github.com/eea/volto-clms-theme/compare/1.1.221...1.1.222) - 18 March 2025
8
25
 
9
26
  #### :bug: Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.222",
3
+ "version": "1.1.224",
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",
@@ -12,17 +12,20 @@ const ProductLink = (props) => {
12
12
  } = props;
13
13
 
14
14
  const [hasLink, setHasLink] = useState(false);
15
- const href = card.url?.[0]?.['@id'] || card.url;
15
+ const href = card.url?.[0]?.['@id'] || card.url?.external?.external_link;
16
16
 
17
17
  useEffect(() => {
18
18
  if (isEditMode) {
19
19
  setHasLink(false);
20
20
  } else {
21
- if (card.url) {
22
- if (card.url && card.url.length > 0) {
21
+ if (card.url?.external?.external_link) {
22
+ if (
23
+ card.url?.external?.external_link &&
24
+ card.url?.external?.external_link.length > 0
25
+ ) {
23
26
  setHasLink(true);
24
27
  }
25
- if (card.url.length === 0) {
28
+ if (card.url?.external?.external_link.length === 0) {
26
29
  setHasLink(false);
27
30
  }
28
31
  }
@@ -1,3 +1,24 @@
1
+ import externalSVG from '@plone/volto/icons/link.svg';
2
+
3
+ export const ExternalLinkSchema = {
4
+ title: 'External link',
5
+ fieldsets: [
6
+ {
7
+ id: 'external',
8
+ title: 'External',
9
+ fields: ['external_link'],
10
+ },
11
+ ],
12
+ properties: {
13
+ external_link: {
14
+ title: 'External URL',
15
+ description:
16
+ 'URL can be relative within this site or absolute if it starts with http:// or https://',
17
+ },
18
+ },
19
+ required: [],
20
+ };
21
+
1
22
  export const CardContainerSchema = () => ({
2
23
  title: 'Card container',
3
24
  fieldsets: [
@@ -36,9 +57,14 @@ export const CardBlockSchema = () => {
36
57
  },
37
58
  url: {
38
59
  title: 'URL',
39
- widget: 'object_browser',
40
- mode: 'link',
41
- allowExternals: true,
60
+ widget: 'object_by_type',
61
+ schemas: [
62
+ {
63
+ id: 'external',
64
+ icon: externalSVG,
65
+ schema: ExternalLinkSchema,
66
+ },
67
+ ],
42
68
  },
43
69
  },
44
70
  required: [],
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
3
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
4
+ import { InlineForm } from '@plone/volto/components';
5
+ import { cclButtonSchema } from './Schema';
6
+
7
+ const FamilyCardButtonEdit = (props) => {
8
+ const { block, data, onChangeBlock, selected } = props;
9
+
10
+ return (
11
+ <>
12
+ <div className="ccl-block-editor-header">
13
+ <legend
14
+ onClick={() => {
15
+ props.setSidebarTab(1);
16
+ }}
17
+ aria-hidden="true"
18
+ >
19
+ {data.style || 'Default'} button {data.disabled && 'disabled'}
20
+ </legend>
21
+ </div>
22
+
23
+ <CclButton
24
+ url="#"
25
+ disabled={data.disabled}
26
+ download={data.download}
27
+ mode={data.style}
28
+ >
29
+ {data.title || 'Text example...'}
30
+ </CclButton>
31
+
32
+ <SidebarPortal selected={selected}>
33
+ <InlineForm
34
+ schema={cclButtonSchema(
35
+ Array.isArray(data?.href) && data?.href.length
36
+ ? ['download', 'target']
37
+ : [],
38
+ )}
39
+ title="Button component block"
40
+ onChangeField={(id, value) => {
41
+ onChangeBlock(block, {
42
+ ...data,
43
+ [id]: value,
44
+ });
45
+ }}
46
+ formData={data}
47
+ />
48
+ </SidebarPortal>
49
+ </>
50
+ );
51
+ };
52
+
53
+ export default FamilyCardButtonEdit;
@@ -0,0 +1,46 @@
1
+ import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
2
+ import React from 'react';
3
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
4
+
5
+ const FamilyCardButtonView = (props) => {
6
+ const { data } = props;
7
+ const flattern_url = flattenToAppURL(data?.href?.external?.external_link);
8
+ function buttonURL(bData, bFlattern_url) {
9
+ return bData.download && bData?.href?.[0]?.['@type'] === 'File'
10
+ ? bFlattern_url + '/@@download/file'
11
+ : bFlattern_url;
12
+ }
13
+ return {
14
+ ...(data.style === 'left menu' ? (
15
+ <div className="left-menu-detail">
16
+ <CclButton
17
+ url={buttonURL(data, flattern_url)}
18
+ disabled={data?.disabled}
19
+ download={data?.download || data?.href?.[0]?.['@type'] === 'File'}
20
+ target={
21
+ data.target ||
22
+ (data.download && data.href[0]['@type'] === 'File' && '_blank')
23
+ }
24
+ mode={data.style}
25
+ >
26
+ {data.title || 'Text example...'}
27
+ </CclButton>
28
+ </div>
29
+ ) : (
30
+ <CclButton
31
+ url={buttonURL(data, flattern_url)}
32
+ disabled={data?.disabled}
33
+ download={data?.download || data?.href?.[0]?.['@type'] === 'File'}
34
+ target={
35
+ data.target ||
36
+ (data.download && data.href[0]['@type'] === 'File' && '_blank')
37
+ }
38
+ mode={data.style}
39
+ >
40
+ {data.title || 'Text example...'}
41
+ </CclButton>
42
+ )),
43
+ };
44
+ };
45
+
46
+ export default FamilyCardButtonView;
@@ -0,0 +1,85 @@
1
+ import externalSVG from '@plone/volto/icons/link.svg';
2
+
3
+ export const ExternalLinkSchema = {
4
+ title: 'External link',
5
+ fieldsets: [
6
+ {
7
+ id: 'external',
8
+ title: 'External',
9
+ fields: ['external_link'],
10
+ },
11
+ ],
12
+ properties: {
13
+ external_link: {
14
+ title: 'External URL',
15
+ description:
16
+ 'URL can be relative within this site or absolute if it starts with http:// or https://',
17
+ },
18
+ },
19
+ required: [],
20
+ };
21
+
22
+ export const cclButtonSchema = (extras) => ({
23
+ title: 'Button default',
24
+ fieldsets: [
25
+ {
26
+ id: 'default',
27
+ title: 'Default',
28
+ fields: ['title', 'href', ...extras],
29
+ },
30
+ {
31
+ id: 'style',
32
+ title: 'Style',
33
+ fields: ['style', 'disabled'],
34
+ },
35
+ ],
36
+ properties: {
37
+ title: {
38
+ title: 'Title',
39
+ description: 'Add button text',
40
+ type: 'string',
41
+ },
42
+ href: {
43
+ title: 'URL',
44
+ description: 'Select site content or paste external url',
45
+ widget: 'object_by_type',
46
+ schemas: [
47
+ {
48
+ id: 'external',
49
+ icon: externalSVG,
50
+ schema: ExternalLinkSchema,
51
+ },
52
+ ],
53
+ },
54
+ style: {
55
+ title: 'Button style',
56
+ choices: [
57
+ ['default', 'Default'],
58
+ ['filled', 'Filled'],
59
+ ['left menu', 'Left Menu block'],
60
+ ],
61
+ default: 'default',
62
+ },
63
+ disabled: {
64
+ title: 'Disabled',
65
+ type: 'boolean',
66
+ default: false,
67
+ },
68
+ download: {
69
+ title: 'Download',
70
+ type: 'boolean',
71
+ description: 'Add download attribute',
72
+ default: false,
73
+ },
74
+ target: {
75
+ title: 'Target',
76
+ description: 'Select target type',
77
+ choices: [
78
+ ['_self', 'Default'],
79
+ ['_blank', 'Blank'],
80
+ ],
81
+ default: '_self',
82
+ },
83
+ },
84
+ required: ['title', 'style'],
85
+ });
@@ -44,6 +44,8 @@ import { ARCGIS_BLOCK } from '@eeacms/volto-arcgis-block/constants';
44
44
  import BlockSettingsSchema from '@plone/volto/components/manage/Blocks/Block/Schema';
45
45
  import CclButtonBlockEdit from '@eeacms/volto-clms-theme/components/Blocks/CclButtonBlock/CclButtonBlockEdit';
46
46
  import CclButtonBlockView from '@eeacms/volto-clms-theme/components/Blocks/CclButtonBlock/CclButtonBlockView';
47
+ import FamilyCardButtonView from '@eeacms/volto-clms-theme/components/Blocks/FamilyCardButtonBlock/FamilyCardButtonView';
48
+ import FamilyCardButtonEdit from '@eeacms/volto-clms-theme/components/Blocks/FamilyCardButtonBlock/FamilyCardButtonEdit';
47
49
  import CclCardContainerBlockEdit from '@eeacms/volto-clms-theme/components/Blocks/CclCardContainerBlock/CclCardContainerBlockEdit';
48
50
  import CclCardContainerBlockView from '@eeacms/volto-clms-theme/components/Blocks/CclCardContainerBlock/CclCardContainerBlockView';
49
51
  import CclContextNavigationBlockEdit from '@eeacms/volto-clms-theme/components/Blocks/CclContextNavigationBlock/CclContextNavigationBlockEdit';
@@ -347,6 +349,22 @@ const customBlocks = (config) => ({
347
349
  view: [], // Future proof (not implemented yet) view user role(s)
348
350
  },
349
351
  },
352
+ familyCardButtonComponent: {
353
+ id: 'familyCardButtonComponent', // The name (id) of the block
354
+ title: 'Family Card Button', // The display name of the block
355
+ icon: linkSVG, // The icon used in the block chooser
356
+ group: 'ccl_blocks', // The group (blocks can be grouped, displayed in the chooser)
357
+ view: FamilyCardButtonView, // The view mode component
358
+ edit: FamilyCardButtonEdit, // The edit mode component
359
+ restricted: false, // If the block is restricted, it won't show in the chooser
360
+ mostUsed: false, // A meta group `most used`, appearing at the top of the chooser
361
+ blockHasOwnFocusManagement: false, // Set this to true if the block manages its own focus
362
+ sidebarTab: 1, // The sidebar tab you want to be selected when selecting the block
363
+ security: {
364
+ addPermission: [], // Future proof (not implemented yet) add user permission role(s)
365
+ view: [], // Future proof (not implemented yet) view user role(s)
366
+ },
367
+ },
350
368
  useCaseList: {
351
369
  id: 'useCaseList', // The name (id) of the block
352
370
  title: 'UseCase List', // The display name of the block
@@ -10,7 +10,9 @@ import {
10
10
  sanitizedHTML,
11
11
  } from '@eeacms/volto-clms-theme/components/CclUtils';
12
12
 
13
- const DownloadDataSetContent = (data, token) => {
13
+ import InfoDownloadDataSet from './InfoDownloadDataSet';
14
+
15
+ const DownloadDataSetContent = (data, token, fontAwesomeSolid) => {
14
16
  const user = useSelector((state) => state?.users?.user);
15
17
  const locale = useSelector((state) => state?.intl?.locale);
16
18
  let download_other_ways_access_dataset = sanitizedHTML(
@@ -26,7 +28,16 @@ const DownloadDataSetContent = (data, token) => {
26
28
  return (
27
29
  <div>
28
30
  {data?.downloadable_full_dataset && (
29
- <div className="dataset-download-area">
31
+ <div
32
+ className={
33
+ data.download_limit_temporal_extent &&
34
+ user?.['@id'] &&
35
+ (data.mapviewer_istimeseries ||
36
+ data.download_show_auxiliary_calendar)
37
+ ? ''
38
+ : 'dataset-download-area'
39
+ }
40
+ >
30
41
  {data.mapviewer_istimeseries ||
31
42
  data.download_show_auxiliary_calendar ? (
32
43
  <>
@@ -49,11 +60,18 @@ const DownloadDataSetContent = (data, token) => {
49
60
  {user?.['@id'] ? (
50
61
  data.mapviewer_istimeseries ||
51
62
  data.download_show_auxiliary_calendar ? (
52
- <CclButton
53
- url={'/' + locale + '/map-viewer?dataset=' + data?.UID}
54
- >
55
- Go to download by area and time
56
- </CclButton>
63
+ <>
64
+ <CclButton
65
+ url={'/' + locale + '/map-viewer?dataset=' + data?.UID}
66
+ >
67
+ Go to download by area and time
68
+ </CclButton>
69
+ {data.download_limit_temporal_extent && (
70
+ <InfoDownloadDataSet
71
+ temporalLimitExtent={data.download_limit_temporal_extent}
72
+ />
73
+ )}
74
+ </>
57
75
  ) : (
58
76
  <CclButton
59
77
  url={'/' + locale + '/map-viewer?dataset=' + data?.UID}
@@ -98,7 +116,7 @@ const DownloadDataSetContent = (data, token) => {
98
116
 
99
117
  {download_other_ways_access_dataset !== '' && (
100
118
  <div className="dataset-access-container">
101
- <h2>You can also access this dataset</h2>
119
+ <h2>Access data on external site(s)</h2>
102
120
  <StringToHTML
103
121
  string={data?.download_other_ways_access_dataset?.data || ''}
104
122
  />
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+
3
+ import { FontAwesomeIcon } from '@eeacms/volto-clms-utils/components';
4
+ import { withFontAwesomeLibs } from '@eeacms/volto-clms-utils/helpers';
5
+
6
+ function InfoDownloadDataSet({ temporalLimitExtent, fontAwesomeSolid }) {
7
+ return (
8
+ <div className="info-download-dataset-container">
9
+ <span className="info-download-icon" direction="up">
10
+ <FontAwesomeIcon icon={fontAwesomeSolid.faInfoCircle} />
11
+ </span>
12
+ <div className="info-download-dataset-description">
13
+ For this product the maximum download period is{' '}
14
+ <span className="info-download-days">{temporalLimitExtent} days.</span>
15
+ </div>
16
+ </div>
17
+ );
18
+ }
19
+
20
+ export default withFontAwesomeLibs(InfoDownloadDataSet);
@@ -425,7 +425,9 @@ function CclCard(props) {
425
425
  )}
426
426
  </div>
427
427
  <div className="card-text">
428
- <div className="card-title">{card?.title}</div>
428
+ <div className="card-title">
429
+ <CardLink url={url}>{card?.title}</CardLink>
430
+ </div>
429
431
  <div className="card-description">{card?.description}</div>
430
432
  {children}
431
433
  </div>
@@ -26,4 +26,5 @@
26
26
  @import 'order-documents-widget';
27
27
  @import 'column-product-card';
28
28
  @import 'product-tab-toggle';
29
- @import 'clms-table';
29
+ @import 'clms-table';
30
+ @import 'dataset-info-section';
@@ -0,0 +1,22 @@
1
+ .info-download-dataset-container {
2
+ background-color: #f5f5f5;
3
+ padding: 0.5rem;
4
+ width: fit-content;
5
+ color: #262626;
6
+ margin-top: 1rem;
7
+ margin-bottom: 1rem;
8
+ border-radius: 5px;
9
+
10
+ .info-download-icon {
11
+ color: #262626;
12
+ margin-right: 0.5rem;
13
+ }
14
+
15
+ .info-download-dataset-description {
16
+ display: inline-block;
17
+
18
+ .info-download-days {
19
+ font-weight: bold;
20
+ }
21
+ }
22
+ }