@eeacms/volto-clms-theme 1.1.184 → 1.1.186

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,15 +4,22 @@ 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.186](https://github.com/eea/volto-clms-theme/compare/1.1.185...1.1.186) - 19 September 2024
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Refs #277384 - Keep file url for admins, use @@download/file for anonymous. [GhitaB - [`a550b19`](https://github.com/eea/volto-clms-theme/commit/a550b19ad1f03409830d44003b6e9d98a9c0eab2)]
12
+ - Refs #277384 - Add isFileDownload customization for File in UniversalLink, to solve @@download/file case. [GhitaB - [`ed61153`](https://github.com/eea/volto-clms-theme/commit/ed6115360c80d12bae399f6fb4ec7eb08c2319eb)]
13
+ - Refs #277384 - Add isFileDownload customization for File in UniversalLink, to solve @@download/file case. [GhitaB - [`65c339a`](https://github.com/eea/volto-clms-theme/commit/65c339a198c89eb31a27224a2dc1c00d276d0964)]
14
+ - Add override [Tiberiu Ichim - [`0874ed6`](https://github.com/eea/volto-clms-theme/commit/0874ed6f47505e7d8c18ea0bff300c8ff9800538)]
15
+ ### [1.1.185](https://github.com/eea/volto-clms-theme/compare/1.1.184...1.1.185) - 4 September 2024
16
+
7
17
  ### [1.1.184](https://github.com/eea/volto-clms-theme/compare/1.1.183...1.1.184) - 3 September 2024
8
18
 
9
19
  #### :house: Internal changes
10
20
 
11
21
  - style: Automated code fix [eea-jenkins - [`8302cad`](https://github.com/eea/volto-clms-theme/commit/8302cad711d1ce5ff6998004cbb6824ea133b008)]
12
22
 
13
- #### :hammer_and_wrench: Others
14
-
15
- - Set root node and depth for contextnavigation [Tiberiu Ichim - [`b7e4ed7`](https://github.com/eea/volto-clms-theme/commit/b7e4ed7c55e00c70f084d92ad340e4fd943156af)]
16
23
  ### [1.1.183](https://github.com/eea/volto-clms-theme/compare/1.1.182...1.1.183) - 2 September 2024
17
24
 
18
25
  #### :house: Internal changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.184",
3
+ "version": "1.1.186",
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",
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { UniversalLink } from '@plone/volto/components';
3
+ import '@plone/volto-slate/editor/plugins/AdvancedLink/styles.less';
4
+
5
+ export const LinkElement = ({ attributes, children, element, mode }) => {
6
+ // TODO: handle title on internal links
7
+ let url = element.url;
8
+ const { link } = element.data || {};
9
+
10
+ const internal_link = link?.internal?.internal_link?.[0]?.['@id'];
11
+ const isDownload = link?.internal?.internal_link?.[0]?.['download'];
12
+ const external_link = link?.external?.external_link;
13
+ const email = link?.email;
14
+
15
+ const href = email
16
+ ? `mailto:${email.email_address}${
17
+ email.email_subject ? `?subject=${email.email_subject}` : ''
18
+ }`
19
+ : external_link || internal_link || url;
20
+
21
+ const { title } = element?.data || {};
22
+
23
+ return mode === 'view' ? (
24
+ <>
25
+ <UniversalLink
26
+ href={href || '#'}
27
+ openLinkInNewTab={link?.external?.target === '_blank'}
28
+ title={title}
29
+ download={isDownload}
30
+ >
31
+ {children}
32
+ </UniversalLink>
33
+ </>
34
+ ) : (
35
+ <span {...attributes} className="slate-editor-link">
36
+ {children}
37
+ </span>
38
+ );
39
+ };
@@ -100,10 +100,12 @@ export const TimeseriesPicker = (props) => {
100
100
  showMonthDropdown
101
101
  showYearDropdown
102
102
  >
103
- {(startValue || endValue) && (
103
+ {(item?.TemporalFilter?.StartDate ||
104
+ item?.TemporalFilter?.EndDate) && (
104
105
  <span>
105
- {cclDateFormat(startValue)} -{' '}
106
- {endValue && cclDateFormat(endValue)}
106
+ {cclDateFormat(item?.TemporalFilter?.StartDate)} -{' '}
107
+ {item?.TemporalFilter?.EndDate &&
108
+ cclDateFormat(item?.TemporalFilter?.EndDate)}
107
109
  </span>
108
110
  )}
109
111
  <br />
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { UniversalLink } from '@plone/volto/components';
3
+ import '@plone/volto-slate/editor/plugins/AdvancedLink/styles.less';
4
+
5
+ export const LinkElement = ({ attributes, children, element, mode }) => {
6
+ // TODO: handle title on internal links
7
+ let url = element.url;
8
+ const { link } = element.data || {};
9
+
10
+ const internal_link = link?.internal?.internal_link?.[0]?.['@id'];
11
+ const isDownload = link?.internal?.internal_link?.[0]?.['download'];
12
+ const external_link = link?.external?.external_link;
13
+ const email = link?.email;
14
+
15
+ const href = email
16
+ ? `mailto:${email.email_address}${
17
+ email.email_subject ? `?subject=${email.email_subject}` : ''
18
+ }`
19
+ : external_link || internal_link || url;
20
+
21
+ const { title } = element?.data || {};
22
+
23
+ return mode === 'view' ? (
24
+ <>
25
+ <UniversalLink
26
+ href={href || '#'}
27
+ openLinkInNewTab={link?.external?.target === '_blank'}
28
+ title={title}
29
+ isFileDownload={isDownload}
30
+ >
31
+ {children}
32
+ </UniversalLink>
33
+ </>
34
+ ) : (
35
+ <span {...attributes} className="slate-editor-link">
36
+ {children}
37
+ </span>
38
+ );
39
+ };
@@ -21,6 +21,7 @@ const UniversalLink = ({
21
21
  item = null,
22
22
  openLinkInNewTab,
23
23
  download = false,
24
+ isFileDownload = false,
24
25
  children,
25
26
  className = null,
26
27
  title = null,
@@ -29,6 +30,11 @@ const UniversalLink = ({
29
30
  const token = useSelector((state) => state.userSession?.token);
30
31
 
31
32
  let url = href;
33
+
34
+ if (!token && isFileDownload) {
35
+ url = `${url}/@@download/file`;
36
+ }
37
+
32
38
  if (!href && item) {
33
39
  if (!item['@id']) {
34
40
  // eslint-disable-next-line no-console