@eeacms/volto-clms-theme 1.0.129 → 1.0.131

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.131](https://github.com/eea/volto-clms-theme/compare/1.0.130...1.0.131) - 28 September 2022
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: change the text CLMS-1378 [Mikel Larreategi - [`01bd389`](https://github.com/eea/volto-clms-theme/commit/01bd38952280a9e60d38548a68f807ec757d2e1e)]
12
+ - fix: show the filter whenever there is a prepackaged file [Mikel Larreategi - [`6fe7ad4`](https://github.com/eea/volto-clms-theme/commit/6fe7ad4508cb032d110b80c3e09d11b188856236)]
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - filter items according to all attributes [Mikel Larreategi - [`c7d454f`](https://github.com/eea/volto-clms-theme/commit/c7d454f1f65f3b23666cbbc2cbb27506f5d01938)]
17
+ ### [1.0.130](https://github.com/eea/volto-clms-theme/compare/1.0.129...1.0.130) - 27 September 2022
18
+
19
+ #### :bug: Bug Fixes
20
+
21
+ - fix: mobile searchbar eventhandlers [joewdavies - [`d08ead4`](https://github.com/eea/volto-clms-theme/commit/d08ead4d05ccd491a51f4b232672e4e7d179a5cd)]
22
+ - fix: when log out redirect to portal [Unai - [`d3dfc18`](https://github.com/eea/volto-clms-theme/commit/d3dfc18da26a493186edc7718552a26c2915b7a1)]
23
+ - fix: CLMS-1405 - usecases are hidden in arcgis-block instead [joewdavies - [`69ea652`](https://github.com/eea/volto-clms-theme/commit/69ea65286b2bfc1ae13f27a87bcdfc4eae826c94)]
24
+ - fix: CLMS-1306 - prevent 'related datasets' accordion overlapping event content [joewdavies - [`e5d8994`](https://github.com/eea/volto-clms-theme/commit/e5d8994407cbebd1e863a1d73be8ef467de15a00)]
25
+ - fix: reformulate attachment format detection for ImageWidget used in volto-form-block CLMS-739 [Mikel Larreategi - [`44ffd90`](https://github.com/eea/volto-clms-theme/commit/44ffd90c6b22db24b8d14cab2584c0ae830faba9)]
26
+
27
+ #### :hammer_and_wrench: Others
28
+
29
+ - add an extra option to show/hide the dates [Mikel Larreategi - [`4f40640`](https://github.com/eea/volto-clms-theme/commit/4f406407e444c68b7f673bf9a663367d574ebb59)]
30
+ - ESlint fix [joewdavies - [`ca6ce28`](https://github.com/eea/volto-clms-theme/commit/ca6ce2864f28cf71e63e6d6d7755c2110a782c30)]
7
31
  ### [1.0.129](https://github.com/eea/volto-clms-theme/compare/1.0.128...1.0.129) - 26 September 2022
8
32
 
9
33
  #### :bug: Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.129",
3
+ "version": "1.0.131",
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",
@@ -89,9 +89,9 @@ const CclUseCaseListEdit = (props) => {
89
89
  {useCase.title}
90
90
  </div>
91
91
  <div className="use-case-element-description">
92
- {/* <span>
92
+ <span>
93
93
  {useCase.topics.map((topic) => topic.title)}
94
- </span> */}
94
+ </span>
95
95
  <span>{cclDateTimeFormat(useCase?.effective)}</span>
96
96
  <span>{useCase.responsibleOrganization}</span>
97
97
  </div>
@@ -81,9 +81,9 @@ const CclUseCaseListView = (props) => {
81
81
  {useCase.title}
82
82
  </div>
83
83
  <div className="use-case-element-description">
84
- {/* <span>
84
+ <span>
85
85
  {useCase.topics.map((topic) => topic.title)}
86
- </span> */}
86
+ </span>
87
87
  <span>
88
88
  {new Date(useCase?.effective).toLocaleDateString()}
89
89
  </span>
@@ -9,7 +9,14 @@ import { useSelector } from 'react-redux';
9
9
  import CclCard from '@eeacms/volto-clms-theme/components/CclCard/CclCard';
10
10
 
11
11
  const CclListingCards = (props) => {
12
- const { items, linkHref, linkTitle, isEditMode, variation = 'doc' } = props;
12
+ const {
13
+ items,
14
+ linkHref,
15
+ linkTitle,
16
+ isEditMode,
17
+ variation = 'doc',
18
+ showDates = true,
19
+ } = props;
13
20
  let link = null;
14
21
  let href = linkHref?.[0]?.['@id'] || '';
15
22
  const user = useSelector((state) => state.users.user);
@@ -37,6 +44,7 @@ const CclListingCards = (props) => {
37
44
  key={index}
38
45
  type={variation}
39
46
  card={item}
47
+ showDates={showDates}
40
48
  showEditor={user?.roles?.includes('Manager')}
41
49
  />
42
50
  ))
@@ -479,12 +479,13 @@ export const CLMSMeetingView = (props) => {
479
479
  <CclListingCards
480
480
  variation="file"
481
481
  items={files}
482
+ showDates={false}
482
483
  linkHref={`${files['@id']}/@@download/file`}
483
484
  />
484
485
  )}
485
486
 
486
487
  {is_manager && (
487
- <div className="dataset-info-documents dropdown">
488
+ <div className="dataset-info-documents dropdown card-container">
488
489
  <div className="accordion-block"></div>
489
490
  {content?.products?.length > 0 && (
490
491
  <Accordion fluid styled>
@@ -89,11 +89,12 @@ const CLMSNewsItemView = (props) => {
89
89
  <CclListingCards
90
90
  variation="file"
91
91
  items={files}
92
+ showDates={false}
92
93
  linkHref={`${files['@id']}/@@download/file`}
93
94
  />
94
95
  )}
95
96
  {is_manager && (
96
- <div className="dataset-info-documents dropdown">
97
+ <div className="dataset-info-documents dropdown card-container">
97
98
  <div className="accordion-block"></div>
98
99
  {content?.products?.length > 0 && (
99
100
  <Accordion fluid styled>
@@ -83,6 +83,7 @@ function CclCard(props) {
83
83
  card,
84
84
  showEditor = false,
85
85
  CclImageEditor = null,
86
+ showDates = true,
86
87
  onClickImage = () => {
87
88
  return '';
88
89
  },
@@ -142,11 +143,13 @@ function CclCard(props) {
142
143
  <div className="card-file-title">
143
144
  <CardLink url={url}>{card?.title}</CardLink>
144
145
  </div>
145
- <div className="card-file-date">
146
- {card?.effective
147
- ? cclDateFormat(card?.effective)
148
- : cclDateFormat(card?.created)}
149
- </div>
146
+ {showDates && (
147
+ <div className="card-file-date">
148
+ {card?.effective
149
+ ? cclDateFormat(card?.effective)
150
+ : cclDateFormat(card?.created)}
151
+ </div>
152
+ )}
150
153
  {children}
151
154
  </div>
152
155
  </>
@@ -55,8 +55,19 @@ function CclDownloadTable(props) {
55
55
  }, [cartSelection, currentPage]);
56
56
 
57
57
  React.useEffect(() => {
58
- let fItems = prePackagedCollection.filter((item) =>
59
- item?.resolution?.toLowerCase().includes(filterText.toLocaleLowerCase()),
58
+ let fItems = prePackagedCollection.filter(
59
+ (item) =>
60
+ item?.title?.toLowerCase().includes(filterText.toLocaleLowerCase()) ||
61
+ item?.file?.toLowerCase().includes(filterText.toLocaleLowerCase()) ||
62
+ item?.area?.toLowerCase().includes(filterText.toLocaleLowerCase()) ||
63
+ item?.year?.toLowerCase().includes(filterText.toLocaleLowerCase()) ||
64
+ item?.version?.toLowerCase().includes(filterText.toLocaleLowerCase()) ||
65
+ item?.resolution
66
+ ?.toLowerCase()
67
+ .includes(filterText.toLocaleLowerCase()) ||
68
+ item?.type?.toLowerCase().includes(filterText.toLocaleLowerCase()) ||
69
+ item?.format?.toLowerCase().includes(filterText.toLocaleLowerCase()) ||
70
+ item?.size?.toLowerCase().includes(filterText.toLocaleLowerCase()),
60
71
  );
61
72
  if (filterText) {
62
73
  setCurrentPageItems(fItems.slice(0, 10));
@@ -203,13 +214,13 @@ function CclDownloadTable(props) {
203
214
  )}
204
215
 
205
216
  <Segment basic>
206
- {prePackagedCollection.length > 10 && (
217
+ {prePackagedCollection.length > 1 && (
207
218
  <div className="block search">
208
219
  <div className="search-wrapper">
209
220
  <div className="search-input">
210
221
  <Input
211
222
  id={`${props.id}-searchtext`}
212
- placeholder={'Filter by Resolution'}
223
+ placeholder={'Search in the pre-packaged data collection'}
213
224
  fluid
214
225
  onChange={(event, { value }) => {
215
226
  setFilterText(value);
@@ -14,6 +14,9 @@ import loadable from '@loadable/component';
14
14
  import { flattenToAppURL } from '@plone/volto/helpers';
15
15
  import { defineMessages, useIntl } from 'react-intl';
16
16
 
17
+ import { Toast } from '@plone/volto/components';
18
+ import { toast } from 'react-toastify';
19
+
17
20
  const imageMimetypes = [
18
21
  'image/png',
19
22
  'image/jpeg',
@@ -91,6 +94,15 @@ const FileWidget = (props) => {
91
94
  ? `data:${value['content-type']};${value.encoding},${value.data}`
92
95
  : null;
93
96
 
97
+ const allowedFileTypes = [
98
+ 'image/png',
99
+ 'image/jpeg',
100
+ 'image/webp',
101
+ 'image/jpg',
102
+ 'image/gif',
103
+ 'image/svg+xml',
104
+ ];
105
+
94
106
  /**
95
107
  * Drop handler
96
108
  * @method onDrop
@@ -101,18 +113,14 @@ const FileWidget = (props) => {
101
113
  const file = files[0];
102
114
  readAsDataURL(file).then((data) => {
103
115
  const fields = data.match(/^data:(.*);(.*),(.*)$/);
104
- if (
105
- fields[0].indexOf(
106
- 'image/png' ||
107
- 'image/jpeg' ||
108
- 'image/webp' ||
109
- 'image/jpg' ||
110
- 'image/gif' ||
111
- 'image/svg+xml',
112
- ) <= -1
113
- ) {
114
- // eslint-disable-next-line no-alert
115
- alert(intl.formatMessage(messages.invalid_file));
116
+ if (!allowedFileTypes.includes(fields[1])) {
117
+ toast.error(
118
+ <Toast
119
+ autoClose={5000}
120
+ title={intl.formatMessage(messages.invalid_file)}
121
+ />,
122
+ );
123
+
116
124
  return;
117
125
  } else {
118
126
  onChange(id, {
@@ -218,39 +218,18 @@ class Header extends Component {
218
218
  </li>
219
219
  </ul>
220
220
  <div
221
- onMouseOut={(e) => {
222
- // this event might be a touch on the search button, make sure it isnt.
223
- // ccl-header-search-show
224
- if (
225
- !e.currentTarget.classList.contains(
226
- 'ccl-header-search-show',
227
- ) &&
228
- !e.currentTarget.classList.contains(
229
- 'ccl-header-search-hidden',
230
- )
231
- ) {
232
- this.setState({ mobileSearchBoxOpen: false });
233
- }
234
- }}
235
- onBlur={(e) => {
236
- if (
237
- !e.currentTarget.classList.contains(
238
- 'ccl-header-search-show',
239
- ) &&
240
- !e.currentTarget.classList.contains(
241
- 'ccl-header-search-hidden',
242
- )
243
- ) {
244
- this.setState({ mobileSearchBoxOpen: false });
245
- }
246
- }}
247
221
  className={
248
222
  this.state.mobileSearchBoxOpen
249
223
  ? 'ccl-header-search-show'
250
224
  : 'ccl-header-search-hidden'
251
225
  }
252
226
  >
253
- <SearchWidget pathname={this.props.pathname} />
227
+ <SearchWidget
228
+ pathname={this.props.pathname}
229
+ setHeaderState={(p) => {
230
+ this.setState(p);
231
+ }}
232
+ />
254
233
  </div>
255
234
  {/* Language selector wont be shown until translations are completed */}
256
235
  {/* <CclLanguageSelector /> */}
@@ -1,14 +1,16 @@
1
+ import { Component } from 'react';
2
+ import { connect } from 'react-redux';
3
+
4
+ import { logout, purgeMessages } from '@plone/volto/actions';
5
+
6
+ import PropTypes from 'prop-types';
7
+ import qs from 'query-string';
8
+
1
9
  /**
2
10
  * Login container.
3
11
  * @module components/theme/Logout/Logout
4
12
  */
5
13
 
6
- import { Component } from 'react';
7
- import PropTypes from 'prop-types';
8
- import { connect } from 'react-redux';
9
- import qs from 'query-string';
10
- import { logout, purgeMessages } from '@plone/volto/actions';
11
-
12
14
  /**
13
15
  * Logout class.
14
16
  * @class Logout
@@ -39,7 +41,8 @@ class CclLogout extends Component {
39
41
 
40
42
  componentDidMount() {
41
43
  // eslint-disable-next-line no-restricted-globals
42
- this.props.logout().then(history.back(1));
44
+ this.props.logout();
45
+ window.location.href = '/';
43
46
  this.props.purgeMessages();
44
47
  }
45
48
 
@@ -105,7 +105,32 @@ class SearchWidget extends Component {
105
105
  <Form
106
106
  className="ccl-header-search"
107
107
  action="/global-search"
108
- onSubmit={this.onSubmit}
108
+ onMouseOut={(e) => {
109
+ if (e.relatedTarget) {
110
+ if (
111
+ !e.relatedTarget.offsetParent.classList.contains(
112
+ 'ccl-header-search',
113
+ )
114
+ ) {
115
+ this.props.setHeaderState({ mobileSearchBoxOpen: false });
116
+ }
117
+ } else {
118
+ this.props.setHeaderState({ mobileSearchBoxOpen: false });
119
+ }
120
+ }}
121
+ onBlur={(e) => {
122
+ if (e.relatedTarget) {
123
+ if (
124
+ !e.relatedTarget.offsetParent.classList.contains(
125
+ 'ccl-header-search',
126
+ )
127
+ ) {
128
+ this.props.setHeaderState({ mobileSearchBoxOpen: false });
129
+ }
130
+ } else {
131
+ this.props.setHeaderState({ mobileSearchBoxOpen: false });
132
+ }
133
+ }}
109
134
  >
110
135
  <Input
111
136
  aria-label={this.props.intl.formatMessage(messages.search)}
@@ -119,8 +144,15 @@ class SearchWidget extends Component {
119
144
  <button
120
145
  type="submit"
121
146
  aria-label={this.props.intl.formatMessage(messages.search)}
147
+ onClick={this.onSubmit}
122
148
  >
123
- <span className="ccl-icon-zoom"></span>
149
+ <span
150
+ className="ccl-icon-zoom"
151
+ role="button"
152
+ onClick={this.onSubmit}
153
+ onKeyDown={this.onSubmit}
154
+ tabIndex={0}
155
+ ></span>
124
156
  </button>
125
157
  </Form>
126
158
  );