@eeacms/volto-clms-theme 1.0.135 → 1.0.136

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,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.0.136](https://github.com/eea/volto-clms-theme/compare/1.0.135...1.0.136) - 26 October 2022
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: redirection on tabs [ionlizarazu - [`68f9a74`](https://github.com/eea/volto-clms-theme/commit/68f9a7402ac9988516dd2926961f3b0321ed69e9)]
12
+ - fix: cart items naming [ionlizarazu - [`bde8fba`](https://github.com/eea/volto-clms-theme/commit/bde8fba4e3e0378ae82ec5deb75b791698f10a6a)]
13
+ - fix: go to the form top position after sending it correctly [ionlizarazu - [`38c1f2c`](https://github.com/eea/volto-clms-theme/commit/38c1f2c6061f617e105b4208ca412482eea33ecd)]
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - tabs preventDefault [ionlizarazu - [`31bf522`](https://github.com/eea/volto-clms-theme/commit/31bf522517e41167bae9bb81e59fa1342c426a7e)]
18
+ - add an option to redirect another path after login [ionlizarazu - [`85b8d98`](https://github.com/eea/volto-clms-theme/commit/85b8d9860dade00d33fdf60bd371b4b9c98edcb1)]
19
+ - Satellite background image [ionlizarazu - [`5fc29eb`](https://github.com/eea/volto-clms-theme/commit/5fc29ebc8bb956e1c775c50aefaee0e429e79913)]
20
+ - tabs functionality for redirects and not logged in users [ionlizarazu - [`7e0ae6e`](https://github.com/eea/volto-clms-theme/commit/7e0ae6e12385c2a4b64ad9029ba5aafb70e14bc1)]
21
+ - change Document naming to Other content [ionlizarazu - [`ddaa1d0`](https://github.com/eea/volto-clms-theme/commit/ddaa1d0664669641c2b67fa01119c8b6cf7ba57c)]
22
+ - meeting register button condition [ionlizarazu - [`73fea5b`](https://github.com/eea/volto-clms-theme/commit/73fea5b2964c106efa405ad9047ba9bd910394e1)]
7
23
  ### [1.0.135](https://github.com/eea/volto-clms-theme/compare/1.0.134...1.0.135) - 13 October 2022
8
24
 
9
25
  #### :rocket: New Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.135",
3
+ "version": "1.0.136",
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",
@@ -49,6 +49,7 @@ export const ProductSchema = () => ({
49
49
  ['home_product_3', 'Leaf'],
50
50
  ['home_product_4', 'Computer'],
51
51
  ['home_product_5', 'Database'],
52
+ ['home_product_6', 'Satellite'],
52
53
  ],
53
54
  },
54
55
  linkSelector: {
@@ -225,6 +225,8 @@ const View = ({ data, id, path }) => {
225
225
  onChangeFormData,
226
226
  });
227
227
 
228
+ const formid = `form-${id}`;
229
+
228
230
  useEffect(() => {
229
231
  if (submitResults?.loaded) {
230
232
  setFormState({
@@ -232,6 +234,16 @@ const View = ({ data, id, path }) => {
232
234
  result: intl.formatMessage(messages.formSubmitted),
233
235
  });
234
236
  captcha.reset();
237
+ const formItem = document.getElementById(formid);
238
+ if (formItem !== null) {
239
+ const formItemPosition = formItem.getBoundingClientRect();
240
+ formItemPosition !== null &&
241
+ window.scrollTo({
242
+ top: formItemPosition.x,
243
+ left: formItemPosition.y,
244
+ behavior: 'smooth',
245
+ });
246
+ }
235
247
  } else if (submitResults?.error) {
236
248
  let errorDescription = `${
237
249
  JSON.parse(submitResults.error.response?.text ?? '{}')?.message
@@ -249,6 +261,7 @@ const View = ({ data, id, path }) => {
249
261
 
250
262
  return (
251
263
  <FormView
264
+ id={formid}
252
265
  formState={formState}
253
266
  formErrors={formErrors}
254
267
  formData={formData}
@@ -7,7 +7,7 @@ export const portal_types_labels = {
7
7
  WorkOpportunity: 'Vacancy',
8
8
  Tender: 'Tender',
9
9
  TechnicalLibrary: 'Product documentation',
10
- Document: 'Page',
10
+ Document: 'Other content',
11
11
  };
12
12
 
13
13
  export const category_labels = {
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { FormattedMessage } from 'react-intl';
3
3
  import { connect, useDispatch, useSelector } from 'react-redux';
4
4
  import { useLocation } from 'react-router-dom';
5
+ import { compose } from 'redux';
5
6
  import { Modal, Segment } from 'semantic-ui-react';
6
7
 
7
8
  import { getUser } from '@plone/volto/actions';
@@ -20,7 +21,6 @@ import {
20
21
 
21
22
  import jwtDecode from 'jwt-decode';
22
23
  import PropTypes from 'prop-types';
23
- import { compose } from 'redux';
24
24
 
25
25
  /**
26
26
  * Full view component.
@@ -390,19 +390,27 @@ const CLMSDatasetDetailView = ({ content, token }) => {
390
390
 
391
391
  {content?.downloadable_dataset &&
392
392
  content?.downloadable_files?.items?.length > 0 && (
393
- <div tabTitle="Download">
393
+ <div
394
+ tabTitle="Download"
395
+ loginRequired={true}
396
+ redirect={
397
+ content?.downloadable_files?.items[0].path === ''
398
+ ? location.pathname + '/download-by-area'
399
+ : ''
400
+ }
401
+ >
394
402
  {DownloadDataSetContent(content, token)}
395
403
  </div>
396
404
  )}
397
- {content?.downloadable_dataset &&
405
+ {/* {content?.downloadable_dataset &&
398
406
  content?.downloadable_files?.items?.length === 0 && (
399
407
  <div
400
- tabTitle="Download"
408
+ tabTitle="Downloadaa"
401
409
  redirect={`${location.pathname}/download-by-area`}
402
410
  >
403
411
  {''}
404
412
  </div>
405
- )}
413
+ )} */}
406
414
 
407
415
  <div underPanel={true}>
408
416
  <nav className="left-menu-detail">
@@ -1,48 +1,25 @@
1
- import React, { useEffect } from 'react';
2
- import CclDownloadTable from '@eeacms/volto-clms-theme/components/CclDownloadTable/CclDownloadTable';
3
- import { useDispatch, useSelector } from 'react-redux';
4
- import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
5
- import config from '@plone/volto/registry';
6
- import { UniversalLink } from '@plone/volto/components';
7
- import CclModal from '../CclModal/CclModal';
8
- import { getRegistry } from '@eeacms/volto-clms-theme/actions';
1
+ import React from 'react';
9
2
  import { FormattedMessage } from 'react-intl';
10
- import { useLocation, Redirect } from 'react-router-dom';
3
+ import { useSelector } from 'react-redux';
4
+ import { useLocation } from 'react-router-dom';
5
+
6
+ import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
7
+ import CclDownloadTable from '@eeacms/volto-clms-theme/components/CclDownloadTable/CclDownloadTable';
8
+ import CclLoginModal from '@eeacms/volto-clms-theme/components/CclLoginModal/CclLoginModal';
11
9
 
12
10
  const DownloadDataSetContent = (data, token) => {
13
11
  const location = useLocation();
14
- const dispatch = useDispatch();
15
12
 
16
- const registryRecords = useSelector((state) => state.registry.records);
17
- const [loginUrl, setLoginUrl] = React.useState('');
18
- const registry_key = config.settings?.registry?.login_url || null;
19
-
20
- useEffect(() => {
21
- if (registryRecords && registry_key in registryRecords) {
22
- setLoginUrl(
23
- registryRecords[registry_key] +
24
- '?came_from=' +
25
- location.pathname +
26
- '/download-by-area',
27
- );
28
- }
29
- }, [registryRecords, registry_key, location.pathname]);
30
13
  const user = useSelector((state) => state.users?.user);
31
14
 
32
- function modalStatus(status) {
33
- if (status === true) {
34
- dispatch(getRegistry(registry_key));
35
- }
36
- }
37
-
38
15
  return (
39
16
  <div>
40
- {data.downloadable_files?.items[0].path === '' &&
17
+ {/* {data.downloadable_files?.items[0].path === '' &&
41
18
  location.hash === '#Download' ? (
42
19
  <Redirect to={location.pathname + '/download-by-area'} />
43
20
  ) : (
44
21
  ''
45
- )}
22
+ )} */}
46
23
 
47
24
  {data?.mapviewer_viewservice?.length > 0 && (
48
25
  <div className="dataset-download-area">
@@ -62,8 +39,8 @@ const DownloadDataSetContent = (data, token) => {
62
39
  </CclButton>
63
40
  )
64
41
  ) : (
65
- <CclModal
66
- trigger={
42
+ <CclLoginModal
43
+ triggerComponent={() => (
67
44
  <CclButton
68
45
  isButton={true}
69
46
  className={'ccl-button ccl-button--default'}
@@ -73,64 +50,8 @@ const DownloadDataSetContent = (data, token) => {
73
50
  defaultMessage="Go to download by area"
74
51
  />
75
52
  </CclButton>
76
- }
77
- size="tiny"
78
- modalStatus={modalStatus}
79
- >
80
- <div className="content">
81
- <div className="modal-login-title">
82
- This website uses EU Login for user authentication.
83
- </div>
84
- <div className="modal-login-text">
85
- <p>
86
- {' '}
87
- EU Login, the European Commission Authentication Service,
88
- enables you to access various web applications centrally
89
- using the same e-mail and password. You can read more{' '}
90
- <UniversalLink
91
- openLinkInNewTab
92
- href="https://ecas.ec.europa.eu/cas/about.html"
93
- >
94
- here
95
- </UniversalLink>
96
- .
97
- </p>
98
- <p>
99
- {' '}
100
- If you have EU Login account, please click 'Login using EU
101
- Login'.
102
- </p>
103
- <p>
104
- If you don't have EU Login account, please follow this{' '}
105
- <UniversalLink
106
- openLinkInNewTab
107
- href="https://ecas.ec.europa.eu/cas/eim/external/register.cgi"
108
- >
109
- link
110
- </UniversalLink>{' '}
111
- to create it
112
- </p>
113
- <p>
114
- If you have other questions, please contact our
115
- <UniversalLink openLinkInNewTab href="/en/service-desk">
116
- {' '}
117
- Service desk
118
- </UniversalLink>
119
- .
120
- </p>
121
- </div>
122
- </div>
123
- <div className="actions">
124
- <div className="modal-buttons">
125
- <a
126
- href={loginUrl || '#'}
127
- className="ccl-button ccl-button-green"
128
- >
129
- Login using EU Login
130
- </a>
131
- </div>
132
- </div>
133
- </CclModal>
53
+ )}
54
+ />
134
55
  )}
135
56
  {/* {data.token === '' ? (
136
57
  <CclButton
@@ -233,11 +233,7 @@ const CLMSCartContent = (props) => {
233
233
  const CollectionNaming = (typeProps) => {
234
234
  const { item } = typeProps;
235
235
  if (item.file_id) {
236
- return (
237
- <span className={'tag tag-' + item?.type?.toLowerCase()}>
238
- {contentOrDash(item.type)}
239
- </span>
240
- );
236
+ return '-';
241
237
  } else if (!item.type) {
242
238
  return '-';
243
239
  }
@@ -250,13 +246,17 @@ const CLMSCartContent = (props) => {
250
246
  ? item.type
251
247
  : item.type_options.length > 0 && item.type_options[0].id
252
248
  }
253
- options={item.type_options.map((option) => {
254
- return {
255
- key: option.id,
256
- value: option.id,
257
- text: (option.collection === undefined && '-') || option.collection,
258
- };
259
- })}
249
+ options={
250
+ item?.type_options?.length > 0 &&
251
+ item?.type_options.map((option) => {
252
+ return {
253
+ key: option.id,
254
+ value: option.id,
255
+ text:
256
+ (option.collection === undefined && '-') || option.collection,
257
+ };
258
+ })
259
+ }
260
260
  onChange={(e, data) => {
261
261
  const objIndex = cartItems.findIndex(
262
262
  (obj) => obj.unique_id === item.unique_id,
@@ -346,13 +346,13 @@ const CLMSCartContent = (props) => {
346
346
  </div>
347
347
  </div>
348
348
  </td>
349
- {item.title ? (
349
+ {/* {item.title ? (
350
350
  <td>
351
351
  {item.title} ({contentOrDash(item.name)})
352
352
  </td>
353
- ) : (
354
- <td>{contentOrDash(item.name)}</td>
355
- )}
353
+ ) : ( */}
354
+ <td>{contentOrDash(item.name)}</td>
355
+ {/* )} */}
356
356
  <td>{contentOrDash(item.source)}</td>
357
357
  <td style={{ wordBreak: 'break-word' }}>
358
358
  <AreaNaming item={item} />
@@ -38,7 +38,7 @@ const DatasetNaming = (props) => {
38
38
  const { dataset } = props;
39
39
  return (
40
40
  <>
41
- {`${dataset['name']} -
41
+ {`${dataset['name'] ? dataset['name'] : 'loading...'} -
42
42
  ${
43
43
  dataset?.OutputFormat
44
44
  ? dataset?.OutputFormat
@@ -146,7 +146,8 @@ export const CLMSMeetingView = (props) => {
146
146
  />
147
147
  </Message>
148
148
  ) : (
149
- rIsLoggedIn && (
149
+ rIsLoggedIn &&
150
+ rContent.can_register && (
150
151
  <>
151
152
  <div>
152
153
  <input
@@ -439,7 +440,8 @@ export const CLMSMeetingView = (props) => {
439
440
  <>
440
441
  {content.anonymous_registration_form?.published &&
441
442
  content.anonymous_registration_form?.email &&
442
- content.anonymous_registration_form?.fullname && (
443
+ content.anonymous_registration_form?.fullname &&
444
+ content.can_register && (
443
445
  <CclButton url={content.anonymous_registration_form?.url}>
444
446
  <FormattedMessage
445
447
  id="Register"
@@ -1,11 +1,14 @@
1
1
  import React, { useEffect } from 'react';
2
- import CclModal from '@eeacms/volto-clms-theme/components/CclModal/CclModal';
3
- import { useDispatch, useSelector } from 'react-redux';
4
- import { getRegistry } from '@eeacms/volto-clms-theme/actions';
5
2
  import { FormattedMessage } from 'react-intl';
6
- import config from '@plone/volto/registry';
3
+ import { useDispatch, useSelector } from 'react-redux';
4
+
7
5
  import { UniversalLink } from '@plone/volto/components';
6
+ import config from '@plone/volto/registry';
7
+ import { getRegistry } from '@eeacms/volto-clms-theme/actions';
8
+ import CclModal from '@eeacms/volto-clms-theme/components/CclModal/CclModal';
9
+
8
10
  import './ccl-login-modal.css';
11
+
9
12
  /**
10
13
  * Login Modal component doc.
11
14
  * @function CclLoginModal
@@ -13,7 +16,15 @@ import './ccl-login-modal.css';
13
16
  *
14
17
  */
15
18
  function CclLoginModal(props) {
16
- let { classname = 'header-login-link' } = props;
19
+ let {
20
+ classname = 'header-login-link',
21
+ triggerComponent = () => (
22
+ <span className={classname}>
23
+ <FormattedMessage id="loginRegister" defaultMessage="Register/Login" />
24
+ </span>
25
+ ),
26
+ otherPath = undefined,
27
+ } = props;
17
28
  const dispatch = useDispatch();
18
29
  const registryRecords = useSelector((state) => state.registry.records);
19
30
  const [loginUrl, setLoginUrl] = React.useState('');
@@ -21,11 +32,15 @@ function CclLoginModal(props) {
21
32
 
22
33
  useEffect(() => {
23
34
  if (registryRecords && registry_key in registryRecords) {
24
- setLoginUrl(
25
- registryRecords[registry_key] + '?came_from=' + window.location.href,
26
- );
35
+ if (otherPath) {
36
+ setLoginUrl(`${registryRecords[registry_key]}?came_from=${otherPath}`);
37
+ } else {
38
+ setLoginUrl(
39
+ `${registryRecords[registry_key]}?came_from=${window.location.href}`,
40
+ );
41
+ }
27
42
  }
28
- }, [registryRecords, registry_key]);
43
+ }, [otherPath, registryRecords, registry_key]);
29
44
 
30
45
  function modalStatus(status) {
31
46
  if (status === true) {
@@ -35,14 +50,7 @@ function CclLoginModal(props) {
35
50
 
36
51
  return (
37
52
  <CclModal
38
- trigger={
39
- <span className={classname}>
40
- <FormattedMessage
41
- id="loginRegister"
42
- defaultMessage="Register/Login"
43
- />
44
- </span>
45
- }
53
+ trigger={triggerComponent()}
46
54
  size="tiny"
47
55
  modalStatus={modalStatus}
48
56
  >
@@ -90,7 +98,12 @@ function CclLoginModal(props) {
90
98
  </div>
91
99
  <div className="actions">
92
100
  <div className="modal-buttons">
93
- <a href={loginUrl || '#'} className="ccl-button ccl-button-green">
101
+ <a
102
+ href={loginUrl || '#'}
103
+ target="_blank"
104
+ rel="noreferrer"
105
+ className="ccl-button ccl-button-green"
106
+ >
94
107
  Login using EU Login
95
108
  </a>
96
109
  </div>
@@ -1,32 +1,72 @@
1
- import { NavLink } from 'react-router-dom';
2
- import PropTypes from 'prop-types';
3
1
  import React from 'react';
2
+ import { useSelector } from 'react-redux';
3
+ import { NavLink } from 'react-router-dom';
4
+ import { Redirect } from 'react-router-dom';
5
+
6
+ import CclLoginModal from '@eeacms/volto-clms-theme/components/CclLoginModal/CclLoginModal';
7
+
4
8
  import cx from 'classnames';
9
+ import PropTypes from 'prop-types';
5
10
 
6
11
  function CclTab(props) {
7
- let { activeTab, tabTitle, onClick, tabId, routing, redirect } = props;
8
-
12
+ let {
13
+ activeTab,
14
+ tabTitle,
15
+ onClick,
16
+ tabId,
17
+ routing,
18
+ redirect,
19
+ loginRequired,
20
+ } = props;
21
+ const token = useSelector((state) => state.userSession?.token);
9
22
  function onTabClick() {
10
23
  onClick(tabId);
11
24
  }
25
+ const [redirecting, setRedirecting] = React.useState(false);
12
26
  return (
13
27
  <div
14
- className={cx('card', activeTab === tabId && 'active')}
15
- onClick={onTabClick}
16
- onKeyDown={onTabClick}
28
+ className={cx('card', activeTab === tabId ? 'active' : '')}
29
+ onClick={(e) => {
30
+ !loginRequired
31
+ ? onTabClick(e)
32
+ : loginRequired && token && onTabClick(e);
33
+ }}
34
+ onKeyDown={(e) => {
35
+ !loginRequired
36
+ ? onTabClick(e)
37
+ : loginRequired && token && onTabClick(e);
38
+ }}
17
39
  tabIndex="0"
18
40
  role="button"
19
41
  id={tabId}
20
42
  >
21
- {routing && !redirect ? (
43
+ {loginRequired && !token ? (
44
+ <CclLoginModal
45
+ otherPath={redirect ? redirect : undefined}
46
+ triggerComponent={() => (
47
+ // eslint-disable-next-line jsx-a11y/anchor-is-valid
48
+ <a style={{ cursor: 'pointer' }}>{tabTitle}</a>
49
+ )}
50
+ />
51
+ ) : routing && !redirect ? (
22
52
  <NavLink to={'#' + tabId}>{tabTitle}</NavLink>
53
+ ) : !redirect ? (
54
+ <NavLink to={'#'}>{tabTitle}</NavLink>
23
55
  ) : (
24
- !redirect && <NavLink to={'#'}>{tabTitle}</NavLink>
25
- )}
26
- {redirect && (
27
- <a href={redirect} target="_blank" rel="noreferrer">
28
- {tabTitle}
29
- </a>
56
+ redirect && (
57
+ // eslint-disable-next-line jsx-a11y/anchor-is-valid
58
+ <a
59
+ rel="noreferrer"
60
+ role="button"
61
+ onClick={() => setRedirecting(true)}
62
+ onKeyPress={() => setRedirecting(true)}
63
+ tabIndex={0}
64
+ style={{ cursor: 'pointer' }}
65
+ >
66
+ {tabTitle}
67
+ {redirecting && <Redirect push to={redirect} />}
68
+ </a>
69
+ )
30
70
  )}
31
71
  </div>
32
72
  );
@@ -18,7 +18,7 @@ import PropTypes from 'prop-types';
18
18
  // Any content under tabs
19
19
  </div>
20
20
  </CclTabs>
21
- *
21
+ *
22
22
  */
23
23
  const CclTabs = (props) => {
24
24
  let { children, routing = false } = props;
@@ -63,6 +63,7 @@ const CclTabs = (props) => {
63
63
  tabTitle={tabTitle}
64
64
  onClick={onClickTabItem}
65
65
  redirect={redirect}
66
+ {...child.props}
66
67
  />
67
68
  );
68
69
  })}
@@ -248,6 +248,10 @@
248
248
  background-image: url('../img/home_product_5.png');
249
249
  }
250
250
 
251
+ #home_product_6 {
252
+ background-image: url('../img/home_product_6.png');
253
+ }
254
+
251
255
  /* Datasets band */
252
256
  .home-datasets-container {
253
257
  padding: 3rem 1rem;