@eeacms/volto-clms-theme 1.0.113 → 1.0.114

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,18 @@ 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.114](https://github.com/eea/volto-clms-theme/compare/1.0.113...1.0.114)
8
+
9
+ - show the message coming from backend [`da826b3`](https://github.com/eea/volto-clms-theme/commit/da826b3c9adab0091f643c326cbd716dd523e2a8)
10
+ - remove the years from the title DoubleRangeFacet [`e32c20e`](https://github.com/eea/volto-clms-theme/commit/e32c20e6cd3a1f096da242ce9f0c5518794a26fd)
11
+ - HomeUsersBlock improvements [`a05b1fb`](https://github.com/eea/volto-clms-theme/commit/a05b1fb16ef3d736ffc486f2a82b0c5014f102b6)
12
+ - unsubscribe checkbox condition [`86db726`](https://github.com/eea/volto-clms-theme/commit/86db726bd33884e8927859f540b33c8c69359a7a)
13
+
7
14
  #### [1.0.113](https://github.com/eea/volto-clms-theme/compare/1.0.112...1.0.113)
8
15
 
16
+ > 4 August 2022
17
+
18
+ - Develop [`#287`](https://github.com/eea/volto-clms-theme/pull/287)
9
19
  - Area widget explanation [`#286`](https://github.com/eea/volto-clms-theme/pull/286)
10
20
  - UniversalLink override to download files in case user is not Manager [`dd206ae`](https://github.com/eea/volto-clms-theme/commit/dd206ae6040fe927d2895c00beeaf55e1fd0a6fe)
11
21
  - fix profile subscribe checkbox checking [`62facfa`](https://github.com/eea/volto-clms-theme/commit/62facfa2db2ba518f421eca0002c2774c080d1da)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.113",
3
+ "version": "1.0.114",
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",
@@ -57,7 +57,7 @@ const CclHomeUsersBlockEdit = ({
57
57
  }}
58
58
  aria-hidden="true"
59
59
  >
60
- {data.title}
60
+ {data.title || 'Home users block'}
61
61
  </div>
62
62
  <div>
63
63
  <div className={'line'}>
@@ -91,8 +91,22 @@ const CclHomeUsersBlockEdit = ({
91
91
  />
92
92
  </div>
93
93
  <div className={'card-text'}>
94
- <div className="card-title">{panel?.title}</div>
95
- <div className="card-description">{panel?.description}</div>
94
+ <div className="card-title">
95
+ {panel.title
96
+ ? panel.title
97
+ : panel.productUrl &&
98
+ panel.productUrl.length > 0 &&
99
+ panel.productUrl[0]['@id'].indexOf('http') !== 0
100
+ ? panel.productUrl[0].title
101
+ : panel.title}
102
+ </div>
103
+ <div className="card-description">
104
+ {panel.description
105
+ ? panel.description
106
+ : panel.productUrl && panel.productUrl.length > 0
107
+ ? panel.productUrl[0].description
108
+ : panel.description}
109
+ </div>
96
110
  </div>
97
111
  </div>
98
112
  </div>
@@ -4,7 +4,7 @@ import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
4
4
  import 'slick-carousel/slick/slick.css';
5
5
  import 'slick-carousel/slick/slick-theme.css';
6
6
  import './styles.less';
7
- import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
7
+ import { ConditionalLink } from '@plone/volto/components';
8
8
 
9
9
  const CclHomeUsersBlockView = (props) => {
10
10
  const settings = {
@@ -42,7 +42,6 @@ const CclHomeUsersBlockView = (props) => {
42
42
  let cards = data?.customCards?.blocks_layout?.items.map(
43
43
  (uid) => data.customCards.blocks[uid],
44
44
  );
45
-
46
45
  return (
47
46
  <div className="home-meet-container">
48
47
  <div className="ccl-container">
@@ -57,6 +56,13 @@ const CclHomeUsersBlockView = (props) => {
57
56
  src={`${card.image.url}/@@images/image`}
58
57
  alt={card.image.alt}
59
58
  />
59
+ ) : card.productUrl &&
60
+ card.productUrl.length > 0 &&
61
+ card.productUrl[0].image_field ? (
62
+ <img
63
+ src={`${card.productUrl[0]['@id']}/@@images/${card.productUrl[0].image_field}/preview`}
64
+ alt={card?.productUrl[0].title || 'Placeholder'}
65
+ />
60
66
  ) : (
61
67
  <img
62
68
  src={
@@ -66,14 +72,31 @@ const CclHomeUsersBlockView = (props) => {
66
72
  />
67
73
  )}
68
74
  </div>
69
- <a
70
- href={flattenToAppURL(card.url)}
71
- target={'_blank'}
72
- rel="noreferrer"
75
+ <ConditionalLink
76
+ condition={card.productUrl && card.productUrl.length > 0}
77
+ item={
78
+ card.productUrl && card.productUrl.length > 0
79
+ ? card.productUrl[0]
80
+ : {}
81
+ }
73
82
  >
74
- <h4>{card.title}</h4>
75
- </a>
76
- <p>{card.description}</p>
83
+ <h4>
84
+ {card.title
85
+ ? card.title
86
+ : card.productUrl &&
87
+ card.productUrl.length > 0 &&
88
+ card.productUrl[0]['@id'].indexOf('http') !== 0
89
+ ? card.productUrl[0].title
90
+ : card.title}
91
+ </h4>
92
+ </ConditionalLink>
93
+ <p>
94
+ {card.description
95
+ ? card.description
96
+ : card.productUrl && card.productUrl.length > 0
97
+ ? card.productUrl[0].description
98
+ : card.description}
99
+ </p>
77
100
  </div>
78
101
  </div>
79
102
  ))}
@@ -28,7 +28,7 @@ export const CardBlockSchema = () => ({
28
28
  {
29
29
  id: 'default',
30
30
  title: 'Default',
31
- fields: ['title', 'description', 'url'],
31
+ fields: ['title', 'description', 'productUrl'],
32
32
  },
33
33
  ],
34
34
  properties: {
@@ -42,9 +42,12 @@ export const CardBlockSchema = () => ({
42
42
  title: 'Product description',
43
43
  type: 'string',
44
44
  },
45
- url: {
46
- title: 'url',
47
- type: 'string',
45
+ productUrl: {
46
+ title: 'Object or url',
47
+ widget: 'object_browser',
48
+ mode: 'link',
49
+ selectedItemAttrs: ['description', 'image_field'],
50
+ allowExternals: true,
48
51
  },
49
52
  },
50
53
  required: ['product'],
@@ -57,9 +57,7 @@ const DoubleRangeFacet = (props) => {
57
57
  tabIndex={0}
58
58
  role={'button'}
59
59
  >
60
- <legend className="ccl-form-legend">
61
- {facet.title} {startingValues.min} - {startingValues.max}
62
- </legend>
60
+ <legend className="ccl-form-legend">{facet.title}</legend>
63
61
  </div>
64
62
  <div>
65
63
  <Segment basic padded>
@@ -163,12 +163,14 @@ class SubscriptionView extends Component {
163
163
  );
164
164
  };
165
165
 
166
- requestErrorToast = () => {
166
+ requestErrorToast = (errorMessage) => {
167
167
  toast.error(
168
168
  <Toast
169
169
  error
170
170
  title={this.props.intl.formatMessage(messages.error)}
171
- content={this.props.intl.formatMessage(messages.errorMessage)}
171
+ content={
172
+ errorMessage || this.props.intl.formatMessage(messages.errorMessage)
173
+ }
172
174
  />,
173
175
  );
174
176
  };
@@ -210,7 +212,11 @@ class SubscriptionView extends Component {
210
212
  this.props
211
213
  .unsubscribeTo(this.state.type_conf.back_url, this.state.value)
212
214
  .then(() => this.props.loaded && this.requestSuccessToast())
213
- .catch(() => this.props.error && this.requestErrorToast());
215
+ .catch(
216
+ () =>
217
+ this.props.error &&
218
+ this.requestErrorToast(this.props.error_message),
219
+ );
214
220
  } else {
215
221
  this.emptyFieldErrorToast();
216
222
  }
@@ -220,7 +226,11 @@ class SubscriptionView extends Component {
220
226
  this.props
221
227
  .subscribeTo(this.state.type_conf.back_url, this.state.value)
222
228
  .then(() => this.props.loaded && this.requestSuccessToast())
223
- .catch(() => this.props.error && this.requestErrorToast());
229
+ .catch(
230
+ () =>
231
+ this.props.error &&
232
+ this.requestErrorToast(this.props.error_message),
233
+ );
224
234
  } else {
225
235
  this.emptyFieldErrorToast();
226
236
  }
@@ -256,10 +266,11 @@ class SubscriptionView extends Component {
256
266
  className="ccl-form user-form contact-form"
257
267
  size={'large'}
258
268
  onSubmit={
259
- validator.isEmail(this.state.value)
260
- ? this.state.inputValue === true
261
- ? this.onSubmit
262
- : this.invalidEmailErrorToast
269
+ validator.isEmail(this.state.value) &&
270
+ ((!this.props.isUnsubscribe &&
271
+ this.state.inputValue === true) ||
272
+ this.props.isUnsubscribe)
273
+ ? this.onSubmit
263
274
  : this.invalidEmailErrorToast
264
275
  }
265
276
  >
@@ -8,6 +8,7 @@ const getInitialState = {
8
8
  error: null,
9
9
  loaded: false,
10
10
  loading: false,
11
+ error_message: '',
11
12
  };
12
13
 
13
14
  export const subscribeToReducer = (state = getInitialState, action = {}) => {
@@ -25,7 +26,10 @@ export const subscribeToReducer = (state = getInitialState, action = {}) => {
25
26
  error: true,
26
27
  loaded: false,
27
28
  loading: false,
28
- error_message: action.error?.response?.body?.error || '',
29
+ error_message:
30
+ action.error?.response?.body?.message ||
31
+ action.error?.response?.body?.error ||
32
+ '',
29
33
  };
30
34
  case `${POST_SUBSCRIBE_TO}_SUCCESS`:
31
35
  return {