@eeacms/volto-clms-theme 1.0.173 → 1.0.175

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.175](https://github.com/eea/volto-clms-theme/compare/1.0.174...1.0.175) - 27 February 2023
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: CLMS-1683 direct the user to the download tab when loging-in when clicking on the Download tab [Mikel Larreategi - [`4768ed3`](https://github.com/eea/volto-clms-theme/commit/4768ed30d3685fc7583d25d9051be013f723be65)]
12
+ - feat: CLMS-1813 remove redirect to mapviewer for datasets not having prepackaged downloads [Mikel Larreategi - [`8471cbb`](https://github.com/eea/volto-clms-theme/commit/8471cbb76a5e3ab9e704b7264e3d139b28b3b42d)]
13
+
14
+ #### :bug: Bug Fixes
15
+
16
+ - fix: CLMS-1806 set semantic-ui olive color to match copernicus color #acbe39 [Mikel Larreategi - [`d121c7c`](https://github.com/eea/volto-clms-theme/commit/d121c7c6089171a3eb0b4d3e45fb264293ca5415)]
17
+ - fix: CLMS-1807 add some space between buttons [Mikel Larreategi - [`3fa1524`](https://github.com/eea/volto-clms-theme/commit/3fa1524fed6f86834cde90b9036f579d4a3092cd)]
18
+
19
+ #### :hammer_and_wrench: Others
20
+
21
+ - whitespace [Mikel Larreategi - [`328b7a9`](https://github.com/eea/volto-clms-theme/commit/328b7a906baa7408d8cb20cb51c1633c8fb6f86e)]
22
+ - remove unneeded [Mikel Larreategi - [`9aa9d38`](https://github.com/eea/volto-clms-theme/commit/9aa9d382bae7564ea4d5a00c77952eb2165a3b12)]
23
+ - whitespace [Mikel Larreategi - [`3953521`](https://github.com/eea/volto-clms-theme/commit/3953521277cbd892a0014a31ddc0f93385d7067f)]
24
+ ### [1.0.174](https://github.com/eea/volto-clms-theme/compare/1.0.173...1.0.174) - 17 February 2023
25
+
26
+ #### :hammer_and_wrench: Others
27
+
28
+ - add search and pagination to the metadata accordion content of the dataset view [ionlizarazu - [`cbdec51`](https://github.com/eea/volto-clms-theme/commit/cbdec5172d9a9e24cb63b46eb1b395a9751e7837)]
29
+ - get the search results from the state in a different way [ionlizarazu - [`9f4793f`](https://github.com/eea/volto-clms-theme/commit/9f4793f5637e6725679697de9e32723028113e9e)]
30
+ - search in another key to avoid conflicts with the contents view search [ionlizarazu - [`18d12fe`](https://github.com/eea/volto-clms-theme/commit/18d12feccb91986942837ba689d7847a2e811e5b)]
7
31
  ### [1.0.173](https://github.com/eea/volto-clms-theme/compare/1.0.172...1.0.173) - 17 February 2023
8
32
 
9
33
  ### [1.0.172](https://github.com/eea/volto-clms-theme/compare/1.0.171...1.0.172) - 17 February 2023
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.173",
3
+ "version": "1.0.175",
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",
@@ -17,6 +17,7 @@ const CclFAQBlockView = (props) => {
17
17
  const dispatch = useDispatch();
18
18
  const path = useSelector((state) => state.router.location.pathname);
19
19
  const search = useSelector((state) => state.search);
20
+ const search_key = 'faq-block';
20
21
  const handleClick = ({ index }) => {
21
22
  const newIndex =
22
23
  activeIndex.indexOf(index) === -1
@@ -27,51 +28,65 @@ const CclFAQBlockView = (props) => {
27
28
  };
28
29
  React.useEffect(() => {
29
30
  dispatch(
30
- searchContent(path.replace('/edit', ''), {
31
- fullobjects: 1,
32
- portal_type: 'FAQ',
33
- b_size: 999,
34
- sort_on: 'getObjPositionInParent',
35
- }),
31
+ searchContent(
32
+ path.replace('/edit', ''),
33
+ {
34
+ fullobjects: 1,
35
+ portal_type: 'FAQ',
36
+ b_size: 999,
37
+ sort_on: 'getObjPositionInParent',
38
+ },
39
+ search_key,
40
+ ),
36
41
  );
37
42
  }, [path, dispatch]);
38
43
  React.useEffect(() => {
39
- if (search.loaded) {
44
+ if (search?.subrequests?.[search_key]?.loaded) {
40
45
  const firstOfCategories = categories.map((cat, key, self) => {
41
- const cat_indexes = search.items.reduce((filtered, item, index) => {
42
- if (filtered.UID) {
43
- filtered = [];
44
- }
45
- if (
46
- item.taxonomy_faqcategories.filter((item_cat) =>
47
- item_cat.title.includes(cat.title),
48
- ).length > 0
49
- ) {
50
- if (index === 1) {
51
- filtered.push(0);
52
- } else {
53
- filtered.push(index);
46
+ const cat_indexes = search?.subrequests?.[search_key]?.items.reduce(
47
+ (filtered, item, index) => {
48
+ if (filtered.UID) {
49
+ filtered = [];
54
50
  }
55
- }
56
- return filtered;
57
- });
51
+ if (
52
+ item.taxonomy_faqcategories.filter(
53
+ (item_cat) =>
54
+ item_cat.title && item_cat.title.includes(cat.title),
55
+ ).length > 0
56
+ ) {
57
+ if (index === 1) {
58
+ filtered.push(0);
59
+ } else {
60
+ filtered.push(index);
61
+ }
62
+ }
63
+ return filtered;
64
+ },
65
+ );
58
66
  return cat_indexes.length > 0 ? cat_indexes[0] : 0;
59
67
  });
60
68
  setActiveIndex(firstOfCategories);
61
69
  }
62
70
  // eslint-disable-next-line react-hooks/exhaustive-deps
63
- }, [search]);
71
+ }, [search?.subrequests]);
64
72
  let categories =
65
- search.items.length > 0
73
+ search?.subrequests &&
74
+ search?.subrequests?.[search_key] &&
75
+ search?.subrequests?.[search_key]?.loaded &&
76
+ search?.subrequests?.[search_key]?.items.length > 0
66
77
  ? [
67
78
  ...new Set(
68
- search.items.map((item) => item.taxonomy_faqcategories).flat(),
79
+ search?.subrequests?.[search_key]?.items
80
+ .map((item) => item.taxonomy_faqcategories)
81
+ .flat(),
69
82
  ),
70
83
  ]
71
84
  .map((cat) => {
72
- const cat_family = cat.title?.split(' » ');
73
- if (cat_family.length > 1) {
74
- cat['subTab'] = true;
85
+ if (cat.title) {
86
+ const cat_family = cat.title?.split(' » ');
87
+ if (cat_family && cat_family.length > 1) {
88
+ cat['subTab'] = true;
89
+ }
75
90
  }
76
91
  return cat;
77
92
  })
@@ -98,16 +113,20 @@ const CclFAQBlockView = (props) => {
98
113
  const [activeIndex, setActiveIndex] = React.useState([0]);
99
114
  return (
100
115
  <div id="faq-listing" className="ccl-container tab-container">
101
- {search.loaded ? (
102
- search.items?.length > 0 &&
116
+ {search?.subrequests?.[search_key]?.loaded ? (
117
+ search?.subrequests?.[search_key]?.items?.length > 0 &&
103
118
  categories.length > 0 && (
104
119
  <CclTabs routing={true}>
105
120
  {categories.map((cat, key) => {
106
- const cat_family = cat.title.split(' » ');
107
- const cat_title =
108
- cat_family.length > 1
109
- ? cat_family[1].split('#')[1]
110
- : cat_family[0].split('#')[1];
121
+ let cat_title = '';
122
+ let cat_family = [];
123
+ if (cat.title) {
124
+ cat_family = cat.title.split(' » ');
125
+ cat_title =
126
+ cat_family.length > 1
127
+ ? cat_family[1].split('#')[1]
128
+ : cat_family[0].split('#')[1];
129
+ }
111
130
  return (
112
131
  <div
113
132
  key={key}
@@ -116,56 +135,64 @@ const CclFAQBlockView = (props) => {
116
135
  parent={cat.parent}
117
136
  >
118
137
  <div className="accordion-block">
119
- {search.items.map((item, item_key) => {
120
- return (
121
- item.taxonomy_faqcategories.filter((faq_cat) =>
122
- faq_cat.title.includes(cat.title),
123
- ).length > 0 && (
124
- <Accordion fluid styled key={item_key}>
125
- <Accordion.Title
126
- as={'h2'}
127
- onClick={() => handleClick({ index: item_key })}
128
- className={'accordion-title align-arrow-right'}
129
- >
130
- {activeIndex.includes(item_key) ? (
131
- <Icon name={titleIcons.opened.rightPosition} />
132
- ) : (
133
- <Icon name={titleIcons.closed.rightPosition} />
134
- )}
135
- {isEditMode && (
136
- <UniversalLink
137
- openLinkInNewTab={true}
138
- href={`${item['@id']}/edit`}
139
- >
138
+ {search?.subrequests?.[search_key]?.items.map(
139
+ (item, item_key) => {
140
+ return (
141
+ item.taxonomy_faqcategories.filter(
142
+ (faq_cat) =>
143
+ faq_cat.title &&
144
+ faq_cat.title.includes(cat.title),
145
+ ).length > 0 && (
146
+ <Accordion fluid styled key={item_key}>
147
+ <Accordion.Title
148
+ as={'h2'}
149
+ onClick={() => handleClick({ index: item_key })}
150
+ className={'accordion-title align-arrow-right'}
151
+ >
152
+ {activeIndex.includes(item_key) ? (
153
+ <Icon
154
+ name={titleIcons.opened.rightPosition}
155
+ />
156
+ ) : (
140
157
  <Icon
141
- name={penSVG}
142
- className="circled"
143
- title={'Edit'}
158
+ name={titleIcons.closed.rightPosition}
144
159
  />
145
- </UniversalLink>
146
- )}
147
- <span>{item.title}</span>
148
- </Accordion.Title>
149
- <Accordion.Content
150
- active={activeIndex.includes(item_key)}
151
- >
152
- <AnimateHeight
153
- animateOpacity
154
- duration={500}
155
- height={'auto'}
160
+ )}
161
+ {isEditMode && (
162
+ <UniversalLink
163
+ openLinkInNewTab={true}
164
+ href={`${item['@id']}/edit`}
165
+ >
166
+ <Icon
167
+ name={penSVG}
168
+ className="circled"
169
+ title={'Edit'}
170
+ />
171
+ </UniversalLink>
172
+ )}
173
+ <span>{item.title}</span>
174
+ </Accordion.Title>
175
+ <Accordion.Content
176
+ active={activeIndex.includes(item_key)}
156
177
  >
157
- {/* <StringToHTML
178
+ <AnimateHeight
179
+ animateOpacity
180
+ duration={500}
181
+ height={'auto'}
182
+ >
183
+ {/* <StringToHTML
158
184
  string={item.text ? item.text.data : ''}
159
185
  /> */}
160
- {hasBlocksData(item) && (
161
- <RenderBlocks content={item} />
162
- )}
163
- </AnimateHeight>
164
- </Accordion.Content>
165
- </Accordion>
166
- )
167
- );
168
- })}
186
+ {hasBlocksData(item) && (
187
+ <RenderBlocks content={item} />
188
+ )}
189
+ </AnimateHeight>
190
+ </Accordion.Content>
191
+ </Accordion>
192
+ )
193
+ );
194
+ },
195
+ )}
169
196
  </div>
170
197
  </div>
171
198
  );
@@ -173,7 +200,7 @@ const CclFAQBlockView = (props) => {
173
200
  </CclTabs>
174
201
  )
175
202
  ) : (
176
- <Segment loading={search.loading}></Segment>
203
+ <Segment loading={search?.subrequests?.[search_key]?.loading}></Segment>
177
204
  )}
178
205
  </div>
179
206
  );
@@ -14,7 +14,6 @@ import {
14
14
  } from '@eeacms/volto-clms-theme/components/CLMSDatasetDetailView';
15
15
 
16
16
  import { postImportWMSLayers, postImportWMSFields } from '../../actions';
17
- import { useSchema } from '../Widgets/SchemaCreatorWidget';
18
17
  import { GeonetworkImporterButtons } from './GeonetworkImporterButtons';
19
18
 
20
19
  import jwtDecode from 'jwt-decode';
@@ -63,34 +62,6 @@ const CLMSDatasetDetailView = ({ content, token }) => {
63
62
  'https://trial.discomap.eea.europa.eu/arcgis/services/clms/worldcountries/mapserver/wmsserver',
64
63
  )
65
64
  : false;
66
- const { data } = useSchema();
67
- const default_schema = data.schema;
68
- const saved_schema = content.downloadable_files.schema;
69
- const schema = saved_schema ?? default_schema;
70
- const hidden_columns = ['@id', 'path'];
71
- // complete the selected file with dataset UID, title and a concat of dataset.UID and block id to get unique id for the whole web
72
- const prePackagedCollection = content?.downloadable_files?.items.map(
73
- (element) => {
74
- return {
75
- ...element,
76
- name: content.title,
77
- UID: content.UID,
78
- unique_id: `${content.UID}_${element['@id']}`,
79
- };
80
- },
81
- );
82
- const hasSome = (field) => {
83
- return prePackagedCollection.filter((ppItem) => ppItem[field]).length > 0
84
- ? field
85
- : '';
86
- };
87
-
88
- const columns =
89
- schema?.fieldsets?.length > 0
90
- ? schema.fieldsets[0].fields.filter((key) => {
91
- return hasSome(key) && !hidden_columns.includes(key);
92
- })
93
- : [];
94
65
 
95
66
  return (
96
67
  <div className="ccl-container ">
@@ -298,15 +269,7 @@ const CLMSDatasetDetailView = ({ content, token }) => {
298
269
  <div tabTitle="General Info">{DataSetInfoContent(content)}</div>
299
270
 
300
271
  {content?.downloadable_dataset && (
301
- <div
302
- tabTitle="Download"
303
- loginRequired={true}
304
- redirect={
305
- columns.length === 0
306
- ? location.pathname + '/download-by-area'
307
- : ''
308
- }
309
- >
272
+ <div tabTitle="Download" loginRequired={true}>
310
273
  {DownloadDataSetContent(content, token)}
311
274
  </div>
312
275
  )}
@@ -10,7 +10,7 @@ import config from '@plone/volto/registry';
10
10
  import CclCitation from '@eeacms/volto-clms-theme/components/CclCitation/CclCitation';
11
11
  import { StringToHTML } from '@eeacms/volto-clms-theme/components/CclUtils';
12
12
  import CclRelatedListingView from '@eeacms/volto-clms-theme/components/Blocks/CclRelatedListingBlock/CclRelatedListingView';
13
-
13
+ import { MetadataPaginatedListing } from './MetadataPaginatedListing';
14
14
  import { CclInfoContainer, CclInfoDescription } from '../CclInfoDescription';
15
15
 
16
16
  const DataSetInfoContent = (props) => {
@@ -113,36 +113,11 @@ const DataSetInfoContent = (props) => {
113
113
  duration={500}
114
114
  height={'auto'}
115
115
  >
116
- <ul>
117
- {geonetwork_identifiers.items.map((geonetwork, key) => (
118
- <li key={key}>
119
- <strong>{geonetwork.title}</strong> -{' '}
120
- <a
121
- href={
122
- geonetwork.type === 'EEA'
123
- ? `https://sdi.eea.europa.eu/catalogue/srv/api/records/${geonetwork.id}/formatters/xsl-view?output=pdf&language=eng&approved=true`
124
- : `https://land.copernicus.vgt.vito.be/geonetwork/srv/api/records/${geonetwork.id}/formatters/xsl-view?root=div&output=pdf`
125
- }
126
- rel="noreferrer"
127
- target="_blank"
128
- >
129
- PDF
130
- </a>{' '}
131
- -{' '}
132
- <a
133
- href={
134
- geonetwork.type === 'EEA'
135
- ? `https://sdi.eea.europa.eu/catalogue/srv/api/records/${geonetwork.id}/formatters/xml?approved=true`
136
- : `https://land.copernicus.vgt.vito.be/geonetwork/srv/api/records/${geonetwork.id}/formatters/xml?attachment=true`
137
- }
138
- rel="noreferrer"
139
- target="_blank"
140
- >
141
- XML
142
- </a>
143
- </li>
144
- ))}
145
- </ul>
116
+ <MetadataPaginatedListing
117
+ geonetwork_identifiers_items={
118
+ geonetwork_identifiers.items
119
+ }
120
+ />
146
121
  </AnimateHeight>
147
122
  </Accordion.Content>
148
123
  </Accordion>
@@ -0,0 +1,95 @@
1
+ import React from 'react';
2
+ import { Input, Pagination } from 'semantic-ui-react';
3
+
4
+ import { Icon } from '@plone/volto/components';
5
+ import paginationLeftSVG from '@plone/volto/icons/left-key.svg';
6
+ import paginationRightSVG from '@plone/volto/icons/right-key.svg';
7
+
8
+ import { useFilteredPagination } from '../CclUtils/useFilteredPagination';
9
+ export const MetadataPaginatedListing = (props) => {
10
+ const { geonetwork_identifiers_items } = props;
11
+ const use_pagination = useFilteredPagination(geonetwork_identifiers_items);
12
+ const p_functions = use_pagination.functions;
13
+ const p_data = use_pagination.data;
14
+ const { pagination, currentPage, paginationSize, dataList } = p_data;
15
+ return (
16
+ <>
17
+ {paginationSize < geonetwork_identifiers_items.length && (
18
+ <div className="block search">
19
+ <div className="search-wrapper">
20
+ <div className="search-input">
21
+ <Input
22
+ id={`geonetwork-searchtext`}
23
+ placeholder={'Search in the following items'}
24
+ fluid
25
+ onChange={(event, value) => {
26
+ p_functions.applySearch(event, value, 'title');
27
+ p_functions.setCurrentPage(1);
28
+ }}
29
+ />
30
+ </div>
31
+ </div>
32
+ </div>
33
+ )}
34
+ <ul>
35
+ {pagination.map((geonetwork, key) => (
36
+ <li key={key}>
37
+ <strong>{geonetwork.title}</strong> -{' '}
38
+ <a
39
+ href={
40
+ geonetwork.type === 'EEA'
41
+ ? `https://sdi.eea.europa.eu/catalogue/srv/api/records/${geonetwork.id}/formatters/xsl-view?output=pdf&language=eng&approved=true`
42
+ : `https://land.copernicus.vgt.vito.be/geonetwork/srv/api/records/${geonetwork.id}/formatters/xsl-view?root=div&output=pdf`
43
+ }
44
+ rel="noreferrer"
45
+ target="_blank"
46
+ >
47
+ PDF
48
+ </a>{' '}
49
+ -{' '}
50
+ <a
51
+ href={
52
+ geonetwork.type === 'EEA'
53
+ ? `https://sdi.eea.europa.eu/catalogue/srv/api/records/${geonetwork.id}/formatters/xml?approved=true`
54
+ : `https://land.copernicus.vgt.vito.be/geonetwork/srv/api/records/${geonetwork.id}/formatters/xml?attachment=true`
55
+ }
56
+ rel="noreferrer"
57
+ target="_blank"
58
+ >
59
+ XML
60
+ </a>
61
+ </li>
62
+ ))}
63
+ </ul>
64
+ {dataList.length / paginationSize > 1 && (
65
+ <div className="pagination-wrapper">
66
+ <Pagination
67
+ activePage={currentPage}
68
+ totalPages={Math.ceil(dataList.length / paginationSize)}
69
+ onPageChange={(e, { activePage }) => {
70
+ p_functions.setCurrentPage(activePage);
71
+ }}
72
+ firstItem={null}
73
+ lastItem={null}
74
+ prevItem={{
75
+ content: <Icon name={paginationLeftSVG} size="18px" />,
76
+ icon: true,
77
+ 'aria-disabled': currentPage === 1,
78
+ className: currentPage === 1 ? 'disabled' : null,
79
+ }}
80
+ nextItem={{
81
+ content: <Icon name={paginationRightSVG} size="18px" />,
82
+ icon: true,
83
+ 'aria-disabled':
84
+ currentPage === Math.ceil(dataList.length / paginationSize),
85
+ className:
86
+ currentPage === Math.ceil(dataList.length / paginationSize)
87
+ ? 'disabled'
88
+ : null,
89
+ }}
90
+ ></Pagination>
91
+ </div>
92
+ )}
93
+ </>
94
+ );
95
+ };
@@ -257,11 +257,9 @@ function CclDownloadTable(props) {
257
257
  please contact us.
258
258
  </p>
259
259
  )} */}
260
-
261
260
  {dataset?.download_page_information?.data && (
262
261
  <StringToHTML string={dataset?.download_page_information?.data} />
263
262
  )}
264
-
265
263
  <Segment basic>
266
264
  {prePackagedCollection.length > 1 && (
267
265
  <div className="block search">
@@ -464,7 +462,6 @@ function CclDownloadTable(props) {
464
462
  </div>
465
463
  )}
466
464
  </div>
467
-
468
465
  <CclButton
469
466
  isButton={true}
470
467
  onClick={() => addToCard()}
@@ -472,9 +469,8 @@ function CclDownloadTable(props) {
472
469
  >
473
470
  Add to cart
474
471
  </CclButton>
475
-
472
+ &nbsp;&nbsp;&nbsp;
476
473
  {isLoggedIn && <CclButton url={`/${locale}/cart`}>Show cart</CclButton>}
477
-
478
474
  <br></br>
479
475
  </div>
480
476
  )
@@ -46,7 +46,7 @@ function CclTab(props) {
46
46
  <span>{tabTitle}</span>
47
47
  ) : loginRequired && !token ? (
48
48
  <CclLoginModal
49
- otherPath={redirect ? redirect : undefined}
49
+ otherPath={redirect ? redirect : `${window.location.href}#${tabId}`}
50
50
  triggerComponent={() => (
51
51
  // eslint-disable-next-line jsx-a11y/anchor-is-valid
52
52
  <a style={{ cursor: 'pointer' }}>{tabTitle}</a>
@@ -143,6 +143,7 @@
143
143
  @grey : #68778D; // Palette: blueishGrey
144
144
  @black : #252525; // Palette: darkishGrey
145
145
  @clmsGreen : #ACBE39; // CLMS green color
146
+ @olive : #ACBE39; // CLMS green color
146
147
 
147
148
  /*--- Light Colors ---*/
148
149
  @lightOlive : #C9EAB1; // Palette: lightSage