@eeacms/volto-clms-theme 1.0.86 → 1.0.89

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,8 +4,32 @@ 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.89](https://github.com/eea/volto-clms-theme/compare/1.0.88...1.0.89)
8
+
9
+ - date formats [`e93f97d`](https://github.com/eea/volto-clms-theme/commit/e93f97dfef7c40a8e5639bac07224989df1f5b11)
10
+ - fix texts [`6ed7d77`](https://github.com/eea/volto-clms-theme/commit/6ed7d77257ff65cf0bb0a076766b3a0b8e572edf)
11
+ - profile tab texts [`d619d74`](https://github.com/eea/volto-clms-theme/commit/d619d74929ab99fba5a86444d04d43fcebded70e)
12
+ - HomeProductBlock [`3d006ef`](https://github.com/eea/volto-clms-theme/commit/3d006ef334ed25de782d073e3e7c5d68e4b2a430)
13
+ - add onclick call to homeproductBlock cards [`fcacfc2`](https://github.com/eea/volto-clms-theme/commit/fcacfc2a7ba6cf31f83e9d390e11eaede1a54a53)
14
+
15
+ #### [1.0.88](https://github.com/eea/volto-clms-theme/compare/1.0.87...1.0.88)
16
+
17
+ > 24 March 2022
18
+
19
+ - cart element format [`#245`](https://github.com/eea/volto-clms-theme/pull/245)
20
+ - fix type changing format [`adf5424`](https://github.com/eea/volto-clms-theme/commit/adf542474f4e62a21bbbb009243438e2a53d2662)
21
+
22
+ #### [1.0.87](https://github.com/eea/volto-clms-theme/compare/1.0.86...1.0.87)
23
+
24
+ > 23 March 2022
25
+
26
+ - images condition for lightGallery rendering [`#244`](https://github.com/eea/volto-clms-theme/pull/244)
27
+
7
28
  #### [1.0.86](https://github.com/eea/volto-clms-theme/compare/1.0.85...1.0.86)
8
29
 
30
+ > 23 March 2022
31
+
32
+ - Develop [`#243`](https://github.com/eea/volto-clms-theme/pull/243)
9
33
  - News item view and blocks [`#242`](https://github.com/eea/volto-clms-theme/pull/242)
10
34
  - NewsItem with blocks [`5320bd3`](https://github.com/eea/volto-clms-theme/commit/5320bd3073f7528d511d49b41755a5ebea05ba20)
11
35
  - if a news item has blocks render them [`5795bd4`](https://github.com/eea/volto-clms-theme/commit/5795bd47a8215a575142bfe5a42713f2ed2b540b)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.86",
3
+ "version": "1.0.89",
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",
@@ -10,11 +10,19 @@ const CclHomeProductsBlockView = (props) => {
10
10
  {products?.map((product, index) => (
11
11
  <div
12
12
  key={index}
13
+ role="button"
13
14
  className={
14
15
  product.productIcon === 'iconless'
15
16
  ? 'home-product home-product-main'
16
17
  : 'home-product'
17
18
  }
19
+ tabIndex={0}
20
+ onClick={() => {
21
+ window.location.href = product?.linkSelector || props.path;
22
+ }}
23
+ onKeyDown={() => {
24
+ window.location.href = product?.linkSelector || props.path;
25
+ }}
18
26
  id={product.productIcon === 'iconless' ? '' : product.productIcon}
19
27
  >
20
28
  {product.productIcon === 'iconless' ? (
@@ -53,8 +53,7 @@ export const ProductSchema = () => ({
53
53
  },
54
54
  linkSelector: {
55
55
  title: 'Product link selector',
56
- widget: 'object_browser',
57
- mode: 'link',
56
+ type: 'string',
58
57
  },
59
58
  },
60
59
  required: [],
@@ -7,6 +7,7 @@ import { SidebarPortal } from '@plone/volto/components';
7
7
  import { UseCaseListSchema } from './UseCaseListSchema';
8
8
  import { getProductGroups } from './utils';
9
9
  import { searchContent } from '@plone/volto/actions';
10
+ import { cclDateTimeFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
10
11
 
11
12
  const messages = defineMessages({
12
13
  xUseCases: {
@@ -91,9 +92,7 @@ const CclUseCaseListEdit = (props) => {
91
92
  <span>
92
93
  {useCase.topics.map((topic) => topic.title)}
93
94
  </span>
94
- <span>
95
- {new Date(useCase?.effective).toLocaleDateString()}
96
- </span>
95
+ <span>{cclDateTimeFormat(useCase?.effective)}</span>
97
96
  <span>{useCase.responsibleOrganization}</span>
98
97
  </div>
99
98
  </div>
@@ -137,7 +137,7 @@ const RightModalFacets = (props) => {
137
137
  trigger={
138
138
  <div className="filters-element">
139
139
  <div className="filters-title">
140
- <Icon className="ui" name={filterSVG} size={20} />
140
+ <Icon className="ui" name={filterSVG} size={'20'} />
141
141
  <span className="filters-title-bold">
142
142
  {data.facetsTitle}
143
143
  </span>
@@ -79,6 +79,19 @@ const CLMSCartContent = (props) => {
79
79
  }
80
80
  }, [nutsnames]);
81
81
 
82
+ // useEffect(() => {
83
+ // const type_options = [];
84
+ // if (requestedItem.dataset_download_information?.items.length > 0) {
85
+ // requestedItem.dataset_download_information.items.forEach((item) => {
86
+ // type_options.push({
87
+ // id: item['@id'],
88
+ // name: item.name,
89
+ // full_format: item.full_format,
90
+ // });
91
+ // });
92
+ // }
93
+ // }, [requestedItem]);
94
+
82
95
  function concatRequestedCartItem() {
83
96
  localSessionCart.forEach((localItem) => {
84
97
  const requestedItem = datasets
@@ -239,6 +252,13 @@ const CLMSCartContent = (props) => {
239
252
  (obj) => obj.unique_id === item.unique_id,
240
253
  );
241
254
  cartItems[objIndex].type = data.value;
255
+ const dataset = datasets
256
+ ? datasets.find((req) => req.UID === item.dataset_uid)
257
+ : false;
258
+ const format_item = dataset.dataset_download_information.items.find(
259
+ (item) => item['@id'] === data.value,
260
+ );
261
+ cartItems[objIndex].format = format_item.full_format;
242
262
  setCartItems([...cartItems]);
243
263
  }}
244
264
  />
@@ -66,16 +66,17 @@ export const getCartObjectFromMapviewer = (
66
66
  const type_options = [];
67
67
  if (dataset_data.dataset_download_information?.items.length > 0) {
68
68
  dataset_data.dataset_download_information.items.forEach((item) => {
69
- type_options.push({ id: item['@id'], name: item.name });
69
+ type_options.push({
70
+ id: item['@id'],
71
+ name: item.name,
72
+ full_format: item.full_format,
73
+ });
70
74
  });
71
75
  }
72
76
  return {
73
77
  name: dataset_data.title || '-',
74
78
  area: area || '-',
75
- format:
76
- dataset_data.dataset_full_format?.token ||
77
- dataset_data.dataset_full_format ||
78
- '-',
79
+ format: type_options.length > 0 ? type_options[0].full_format : null,
79
80
  resolution: dataset_data.resolution || '-',
80
81
  size: dataset_data.size || '-',
81
82
  source: 'Map viewer',
@@ -16,6 +16,7 @@ import errorSVG from '@plone/volto/icons/error.svg';
16
16
  import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
17
17
  import packSVG from '@plone/volto/icons/pack.svg';
18
18
  import removeSVG from '@plone/volto/icons/delete.svg';
19
+ import { cclDateTimeFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
19
20
 
20
21
  const prettyBytes = require('pretty-bytes');
21
22
 
@@ -127,13 +128,7 @@ const FileCard = (props) => {
127
128
  <Segment basic className="file-datetimes">
128
129
  {item?.RegistrationDateTime && (
129
130
  <>
130
- Start date:
131
- {new Date(item?.RegistrationDateTime).toLocaleString(
132
- 'en-GB',
133
- {
134
- timeZone: 'UTC',
135
- },
136
- )}
131
+ Start date: {cclDateTimeFormat(item?.RegistrationDateTime)}
137
132
  <span
138
133
  className="info-icon"
139
134
  tooltip="Dates and times are in UTC"
@@ -146,13 +141,7 @@ const FileCard = (props) => {
146
141
  )}
147
142
  {item?.FinalizationDateTime && (
148
143
  <>
149
- End date:{' '}
150
- {new Date(item?.FinalizationDateTime).toLocaleString(
151
- 'en-GB',
152
- {
153
- timeZone: 'UTC',
154
- },
155
- )}
144
+ End date: {cclDateTimeFormat(item?.FinalizationDateTime)}
156
145
  <span
157
146
  className="info-icon"
158
147
  tooltip="Dates and times are in UTC"
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { defineMessages, injectIntl } from 'react-intl';
3
3
  import { Header, Segment } from 'semantic-ui-react';
4
4
  import { StringToHTML } from '@eeacms/volto-clms-theme/components/CclUtils';
5
+ import { cclDateTimeFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
5
6
 
6
7
  export const CLMSMeetingEmailView = (props) => {
7
8
  const { content, intl } = props;
@@ -63,7 +64,7 @@ export const CLMSMeetingEmailView = (props) => {
63
64
  <Header as="h2">{intl.formatMessage(messages.subject)}</Header>
64
65
  <p>{content.subject}</p>
65
66
  <Header as="h2">{intl.formatMessage(messages.modified)}</Header>
66
- <p>{new Date(content.modified).toLocaleDateString()}</p>
67
+ <p>{cclDateTimeFormat(content.modified)}</p>
67
68
  <Header as="h2">{intl.formatMessage(messages.type)}</Header>
68
69
  <p>{content.email_type}</p>
69
70
  <Header as="h2">{intl.formatMessage(messages.body)}</Header>
@@ -5,6 +5,7 @@ import { useDispatch, useSelector } from 'react-redux';
5
5
 
6
6
  import { Pagination } from '@plone/volto/components';
7
7
  import { searchContent } from '@plone/volto/actions';
8
+ import { cclDateTimeFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
8
9
 
9
10
  export const CLMSMeetingEmailsView = (props) => {
10
11
  const { content, intl } = props;
@@ -142,7 +143,7 @@ export const CLMSMeetingEmailsView = (props) => {
142
143
  </td>
143
144
  <td>{email.cc}</td>
144
145
  <td>{email.subject}</td>
145
- <td>{new Date(email.modified).toLocaleDateString()}</td>
146
+ <td>{cclDateTimeFormat(email.modified)}</td>
146
147
  <td>{email.email_type}</td>
147
148
  </tr>
148
149
  ))
@@ -4,8 +4,9 @@ import LightGallery from 'lightgallery/react';
4
4
  import lgZoom from 'lightgallery/plugins/zoom';
5
5
  import 'lightgallery/css/lightgallery.css';
6
6
  import 'lightgallery/css/lg-zoom.css';
7
- import { Image } from 'semantic-ui-react';
8
7
  import './styles.less';
8
+
9
+ import { Image } from 'semantic-ui-react';
9
10
  import { flattenToAppURL } from '@plone/volto/helpers';
10
11
  import { useDispatch, useSelector } from 'react-redux';
11
12
  import { searchContent } from '@plone/volto/actions';
@@ -23,7 +24,6 @@ export const LightGalleryListing = () => {
23
24
  {
24
25
  'path.depth': 1,
25
26
  portal_type: 'Image',
26
- fullobjects: true,
27
27
  },
28
28
  'images',
29
29
  ),
@@ -32,27 +32,32 @@ export const LightGalleryListing = () => {
32
32
  dispatch(searchContent([]));
33
33
  };
34
34
  }, [dispatch]);
35
-
36
35
  return (
37
36
  <>
38
37
  <div>
39
- <LightGallery plugins={[lgZoom]} mode="lg-fade">
40
- {images?.map((item, index) => (
41
- <a
42
- key={index}
43
- className="gallery-item"
44
- href={flattenToAppURL(item?.image?.download)}
45
- data-sub-html={item.description}
46
- data-src={flattenToAppURL(item?.image?.scales?.huge?.download)}
47
- >
48
- <Image
49
- src={flattenToAppURL(item?.image?.scales?.large?.download)}
50
- className="img-responsive"
51
- alt={item.description}
52
- />
53
- </a>
54
- ))}
55
- </LightGallery>
38
+ {images?.length > 0 && (
39
+ <LightGallery plugins={[lgZoom]} mode="lg-fade">
40
+ {images?.map((item, index) => (
41
+ <a
42
+ key={index}
43
+ className="gallery-item"
44
+ href={flattenToAppURL(
45
+ `${item['@id']}/@@images/${item?.image_field}/huge`,
46
+ )}
47
+ data-sub-html={item?.description}
48
+ data-src={flattenToAppURL(
49
+ `${item['@id']}/@@images/${item?.image_field}/huge`,
50
+ )}
51
+ >
52
+ <Image
53
+ src={`${item['@id']}/@@images/${item?.image_field}/large`}
54
+ className="img-responsive"
55
+ alt={item?.description}
56
+ />
57
+ </a>
58
+ ))}
59
+ </LightGallery>
60
+ )}
56
61
  </div>
57
62
  </>
58
63
  );
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { StringToHTML } from '@eeacms/volto-clms-theme/components/CclUtils';
3
3
  import { hasBlocksData } from '@plone/volto/helpers';
4
4
  import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
5
-
5
+ import { cclDateTimeFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
6
6
  const CLMSNewsItemView = (props) => {
7
7
  const { content } = props;
8
8
  return (
@@ -14,7 +14,7 @@ const CLMSNewsItemView = (props) => {
14
14
  <h1 className="page-title">{content.title}</h1>
15
15
  <div className="news-detail">
16
16
  <div className="news-detail-date">
17
- {new Date(content?.effective).toLocaleDateString()}
17
+ {cclDateTimeFormat(content?.effective)}
18
18
  </div>
19
19
  {content?.image && (
20
20
  <figure className="news-detail-image">
@@ -24,11 +24,11 @@ import {
24
24
  const messages = defineMessages({
25
25
  ApiTokens: {
26
26
  id: 'ApiTokens',
27
- defaultMessage: 'API Tokens',
27
+ defaultMessage: 'API tokens',
28
28
  },
29
29
  title: {
30
30
  id: 'title',
31
- defaultMessage: 'API Token management',
31
+ defaultMessage: 'API token management',
32
32
  },
33
33
  tokenTitleLabel: {
34
34
  id: 'tokenTitleLabel',
@@ -24,7 +24,7 @@ class CLMSNewsletterSubscriberView extends Component {
24
24
  this.handleClick = this.handleClick.bind(this);
25
25
  this.state = {
26
26
  download: false,
27
- headers: [{ label: 'Newsletter Subscribers', key: 'email' }],
27
+ headers: [{ label: 'Newsletter subscribers', key: 'email' }],
28
28
  };
29
29
  }
30
30
  componentDidMount() {
@@ -54,15 +54,15 @@ class CLMSProfileView extends Component {
54
54
  <div className="ccl-container ">
55
55
  {loggedIn && (
56
56
  <CclTabs>
57
- <div tabTitle="USER PROFILE">
57
+ <div tabTitle="User profile">
58
58
  <CLMSUserProfileView />
59
59
  </div>
60
- <div tabTitle="API TOKENS">
60
+ <div tabTitle="API tokens">
61
61
  <CLMSApiTokensView />
62
62
  </div>
63
63
  {(this.props.roles?.includes('Manager') ||
64
64
  this.props.roles?.includes('Site Administrator')) && (
65
- <div tabTitle="NEWSLETTER SUBSCRIBERS">
65
+ <div tabTitle="Newsletter subscribers">
66
66
  <CLMSNewsletterSubscriberView />
67
67
  </div>
68
68
  )}
@@ -19,7 +19,7 @@ import { getUserSchema } from '../../actions';
19
19
  const messages = defineMessages({
20
20
  UserProfile: {
21
21
  id: 'UserProfile',
22
- defaultMessage: 'User Profile',
22
+ defaultMessage: 'User profile',
23
23
  },
24
24
  default: {
25
25
  id: 'Default',
@@ -27,7 +27,7 @@ const messages = defineMessages({
27
27
  },
28
28
  fullnameTitle: {
29
29
  id: 'Full Name',
30
- defaultMessage: 'Full Name',
30
+ defaultMessage: 'Full name',
31
31
  },
32
32
  fullnameDescription: {
33
33
  id: 'Enter full name, e.g. John Smith.',
@@ -1,16 +1,16 @@
1
1
  export const AVAILABLE_SUBSCRIPTIONS = [
2
2
  {
3
- title: 'SUBSCRIBE TO OUR NEWSLETTER',
3
+ title: 'Subscribe to our newsletter',
4
4
  type: 'newsletter',
5
5
  back_url: 'newsletter',
6
6
  },
7
7
  {
8
- title: 'SUBSCRIBE TO OUR NEWS',
8
+ title: 'Subscribe to our news',
9
9
  type: 'news',
10
10
  back_url: 'newsitem',
11
11
  },
12
12
  {
13
- title: 'SUBSCRIBE TO OUR EVENTS',
13
+ title: 'Subscribe to our events',
14
14
  type: 'events',
15
15
  back_url: 'event',
16
16
  },
@@ -11,6 +11,7 @@ import penSVG from '@plone/volto/icons/pen.svg';
11
11
  import { Icon } from '@plone/volto/components';
12
12
 
13
13
  import PlaceHolder from '@eeacms/volto-clms-theme/../theme/clms/img/ccl-thumbnail-placeholder.jpg';
14
+ import { cclDateTimeFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
14
15
 
15
16
  const CardImage = ({ card, size = 'preview', isCustomCard }) => {
16
17
  return card?.image_field ? (
@@ -180,7 +181,7 @@ function CclCard(props) {
180
181
  {/* <CardLink url={url} title={card?.title} /> */}
181
182
  </div>
182
183
  <div className="card-news-date">
183
- {new Date(card?.effective).toLocaleString()}
184
+ {cclDateTimeFormat(card?.effective)}
184
185
  </div>
185
186
  <p className="card-news-description">{card?.description}</p>
186
187
  </div>
@@ -0,0 +1,17 @@
1
+ export const cclDateTimeFormat = (date) => {
2
+ const dateObj = new Date(date);
3
+ const day = ('0' + (dateObj.getDate() + 1)).slice(-2);
4
+ const month = ('0' + (dateObj.getMonth() + 1)).slice(-2);
5
+ const year = dateObj.getFullYear();
6
+ const hours = ('0' + (dateObj.getHours() + 1)).slice(-2);
7
+ const minutes = ('0' + (dateObj.getMinutes() + 1)).slice(-2);
8
+ return `${day}.${month}.${year} ${hours}.${minutes}`;
9
+ };
10
+
11
+ export const cclDateFormat = (date) => {
12
+ const dateObj = new Date(date);
13
+ const day = dateObj.getDate();
14
+ const month = ('0' + (dateObj.getMonth() + 1)).slice(-2);
15
+ const year = dateObj.getFullYear();
16
+ return `${day}.${month}.${year}`;
17
+ };
@@ -1,3 +1,5 @@
1
1
  import StringToHTML from './StringToHTML';
2
2
 
3
3
  export { StringToHTML };
4
+
5
+ export { cclDateFormat, cclDateTimeFormat } from './dateFormats';