@eeacms/volto-clms-theme 1.0.100 → 1.0.101

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,16 @@ 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.101](https://github.com/eea/volto-clms-theme/compare/1.0.100...1.0.101)
8
+
9
+ - Sprint 27 [`67c5d34`](https://github.com/eea/volto-clms-theme/commit/67c5d340fe2b4bbab19d52936e4e5013040c0f65)
10
+ - some corrections of Sprint 27 [`9bb92da`](https://github.com/eea/volto-clms-theme/commit/9bb92dac754a5c7969b2e78c958918d5099a6d29)
11
+
7
12
  #### [1.0.100](https://github.com/eea/volto-clms-theme/compare/1.0.99...1.0.100)
8
13
 
14
+ > 14 June 2022
15
+
16
+ - save original format of the dataset to be able to handle conversions … [`#266`](https://github.com/eea/volto-clms-theme/pull/266)
9
17
  - remove console.log [`87d44e1`](https://github.com/eea/volto-clms-theme/commit/87d44e1eae1460da3eeeaa4936de00dcdd1617d9)
10
18
  - save original format of the dataset to be able to handle conversions correctlyÇ [`cb90951`](https://github.com/eea/volto-clms-theme/commit/cb909517bd8c8a1b3a0f9511a0a690d3c05b26ff)
11
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.100",
3
+ "version": "1.0.101",
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",
@@ -55,7 +55,8 @@
55
55
  "volto-dropdownmenu": "2.2.7",
56
56
  "volto-form-block": "2.2.2",
57
57
  "react-input-range": "^1.3.0",
58
- "lightgallery": "^2.4.0"
58
+ "lightgallery": "^2.4.0",
59
+ "validator": "13.7.0"
59
60
  },
60
61
  "devDependencies": {
61
62
  "@cypress/code-coverage": "^3.9.5",
@@ -18,10 +18,12 @@ const CclHomeProductsBlockView = (props) => {
18
18
  }
19
19
  tabIndex={0}
20
20
  onClick={() => {
21
- window.location.href = product?.linkSelector || props.path;
21
+ window.location.href =
22
+ product?.linkSelector[0]['@id'] || props.path;
22
23
  }}
23
24
  onKeyDown={() => {
24
- window.location.href = product?.linkSelector || props.path;
25
+ window.location.href =
26
+ product?.linkSelector[0]['@id'] || props.path;
25
27
  }}
26
28
  id={product.productIcon === 'iconless' ? '' : product.productIcon}
27
29
  >
@@ -53,7 +53,11 @@ export const ProductSchema = () => ({
53
53
  },
54
54
  linkSelector: {
55
55
  title: 'Product link selector',
56
- type: 'string',
56
+ description: 'Select site content or paste external url',
57
+ widget: 'object_browser',
58
+ mode: 'link',
59
+ selectedItemAttrs: ['Title', 'Description', '@type', '@id'],
60
+ allowExternals: true,
57
61
  },
58
62
  },
59
63
  required: [],
@@ -50,6 +50,7 @@ const CclRelatedListingView = (props) => {
50
50
  sort_on = 'start';
51
51
  sort_order = 'descending';
52
52
  } else if (data.content_type === 'TechnicalLibrary') {
53
+ //if documentation_sorting is null the TechnicalLibrary is not stored in libraries [BACKEND]
53
54
  sort_on = 'documentation_sorting';
54
55
  sort_order = 'ascending';
55
56
  }
@@ -90,6 +90,7 @@ function listingVariation(id, isDefault, title, template, isWO = false) {
90
90
 
91
91
  const availableVariations = [
92
92
  listingVariation('CclCardsdoc', true, 'Line list', 'doc'),
93
+ listingVariation('CclFiles', false, 'Files list', 'file'),
93
94
  listingVariation('CclCardsline', false, 'Line list with Image', 'line'),
94
95
  listingVariation(
95
96
  'CclCardsline-color',
@@ -19,6 +19,7 @@ import jwtDecode from 'jwt-decode';
19
19
  import { postMeetingRegister } from '../../actions';
20
20
  import { toast } from 'react-toastify';
21
21
  import { LightGalleryListing } from './CclLightGallery';
22
+ import CclListingCards from '@eeacms/volto-clms-theme/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards';
22
23
 
23
24
  export const CLMSMeetingView = (props) => {
24
25
  const { content, intl } = props;
@@ -108,6 +109,13 @@ export const CLMSMeetingView = (props) => {
108
109
  );
109
110
  history.push(props.location.pathname + '/form');
110
111
  }
112
+ const files = content.items.map((item) =>
113
+ item['@type'] === 'File' ? item : null,
114
+ );
115
+ const index = files.indexOf(null);
116
+ if (index > -1) {
117
+ files.splice(index, 1);
118
+ }
111
119
  const RegistrationButton = ({ rContent, rMeeting_register, rIsLoggedIn }) => {
112
120
  return (
113
121
  <>
@@ -382,6 +390,11 @@ export const CLMSMeetingView = (props) => {
382
390
  )}
383
391
  <StringToHTML string={content.text?.data || ''} />
384
392
  <LightGalleryListing />
393
+ <CclListingCards
394
+ variation="file"
395
+ items={files}
396
+ linkHref={`${files['@id']}/@@download/file`}
397
+ />
385
398
  </Segment>
386
399
  </div>
387
400
  );
@@ -3,8 +3,17 @@ 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
+ import { LightGalleryListing } from '@eeacms/volto-clms-theme/components/CLMSMeetingView/CclLightGallery';
7
+ import CclListingCards from '@eeacms/volto-clms-theme/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards';
6
8
  const CLMSNewsItemView = (props) => {
7
9
  const { content } = props;
10
+ const files = content.items.map((item) =>
11
+ item['@type'] === 'File' ? item : null,
12
+ );
13
+ const index = files.indexOf(null);
14
+ if (index > -1) {
15
+ files.splice(index, 1);
16
+ }
8
17
  return (
9
18
  <div className="ccl-container">
10
19
  {hasBlocksData(content) && content.blocks_layout?.items?.length > 4 ? (
@@ -34,6 +43,12 @@ const CLMSNewsItemView = (props) => {
34
43
  <div className="news-detail-content">
35
44
  <StringToHTML string={content.text?.data || ''} />
36
45
  </div>
46
+ <LightGalleryListing />
47
+ <CclListingCards
48
+ variation="file"
49
+ items={files}
50
+ linkHref={`${files['@id']}/@@download/file`}
51
+ />
37
52
  </div>
38
53
  </>
39
54
  )}
@@ -20,6 +20,7 @@ import { compose } from 'redux';
20
20
  import { connect } from 'react-redux';
21
21
  import { getExtraBreadcrumbItems } from '../../actions';
22
22
  import jwtDecode from 'jwt-decode';
23
+ import { Unauthorized } from '@plone/volto/components';
23
24
  /**
24
25
  * CLMSProfileView class.
25
26
  * @class CLMSProfileView
@@ -52,7 +53,7 @@ class CLMSProfileView extends Component {
52
53
 
53
54
  return (
54
55
  <div className="ccl-container ">
55
- {loggedIn && (
56
+ {loggedIn ? (
56
57
  <CclTabs>
57
58
  <div tabTitle="User profile">
58
59
  <CLMSUserProfileView />
@@ -72,6 +73,8 @@ class CLMSProfileView extends Component {
72
73
  </div>
73
74
  ))}
74
75
  </CclTabs>
76
+ ) : (
77
+ <Unauthorized />
75
78
  )}
76
79
  </div>
77
80
  );
@@ -20,6 +20,7 @@ import { compose } from 'redux';
20
20
  import { connect } from 'react-redux';
21
21
  import { getSubscriptionConfig } from './subscription_utils';
22
22
  import { toast } from 'react-toastify';
23
+ import validator from 'validator';
23
24
 
24
25
  const messages = defineMessages({
25
26
  subscribeToThe: {
@@ -39,8 +40,12 @@ const messages = defineMessages({
39
40
  defaultMessage: 'Changes saved!',
40
41
  },
41
42
  subscriptionSuccessMessage: {
42
- id: 'You will receive an email confirmation to',
43
- defaultMessage: 'You will receive an email confirmation to {email}',
43
+ id: 'You will receive a subscription confirmation email to',
44
+ defaultMessage: 'You will receive a subscription confirmation email to',
45
+ },
46
+ unsubscriptionSuccessMessage: {
47
+ id: 'You will receive an unsubscription confirmation email to',
48
+ defaultMessage: 'You will receive an unsubscription confirmation email to',
44
49
  },
45
50
  success: {
46
51
  id: 'Success',
@@ -103,6 +108,10 @@ class SubscriptionView extends Component {
103
108
  );
104
109
  };
105
110
 
111
+ invalidEmailErrorToast = () => {
112
+ toast.error(<Toast error title={'Error'} content={'Invalid email'} />);
113
+ };
114
+
106
115
  requestErrorToast = () => {
107
116
  toast.error(
108
117
  <Toast
@@ -122,10 +131,15 @@ class SubscriptionView extends Component {
122
131
  <>
123
132
  <p>{this.props.intl.formatMessage(messages.saved)}</p>
124
133
  <small>
125
- {this.props.intl.formatMessage(
126
- messages.subscriptionSuccessMessage,
127
- { email: this.state.value },
128
- )}
134
+ {this.props.isUnsubscribe
135
+ ? this.props.intl.formatMessage(
136
+ messages.unsubscriptionSuccessMessage,
137
+ { email: this.state.value },
138
+ )
139
+ : this.props.intl.formatMessage(
140
+ messages.subscriptionSuccessMessage,
141
+ { email: this.state.value },
142
+ )}
129
143
  </small>
130
144
  </>
131
145
  }
@@ -183,7 +197,11 @@ class SubscriptionView extends Component {
183
197
  <Form
184
198
  className="ccl-form user-form contact-form"
185
199
  size={'large'}
186
- onSubmit={this.onSubmit}
200
+ onSubmit={
201
+ validator.isEmail(this.state.value)
202
+ ? this.onSubmit
203
+ : this.invalidEmailErrorToast
204
+ }
187
205
  >
188
206
  <div className="ccl-fieldset">
189
207
  <div className="ccl-form-group">
@@ -201,11 +219,12 @@ class SubscriptionView extends Component {
201
219
  </p>
202
220
  <Form.Group inline widths="equal">
203
221
  <Form.Input
222
+ maxLength={8000}
204
223
  placeholder="example@example.com"
205
224
  fluid
206
225
  name="email"
207
226
  id="email"
208
- required={true}
227
+ // required={true}
209
228
  value={this.state.value}
210
229
  onChange={this.handleChange}
211
230
  />
@@ -8,7 +8,7 @@ import { When } from '@plone/volto/components/theme/View/EventDatesInfo';
8
8
  import { Label } from 'semantic-ui-react';
9
9
  import { portal_types_labels } from '../Blocks/CustomTemplates/VoltoSearchBlock';
10
10
  import penSVG from '@plone/volto/icons/pen.svg';
11
- import { Icon } from '@plone/volto/components';
11
+ import { Icon, Grid } from 'semantic-ui-react';
12
12
 
13
13
  import PlaceHolder from '@eeacms/volto-clms-theme/../theme/clms/img/ccl-thumbnail-placeholder.jpg';
14
14
  import { cclDateTimeFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
@@ -105,6 +105,7 @@ function CclCard(props) {
105
105
  'block',
106
106
  'threeColumns',
107
107
  'globalSearch',
108
+ 'file',
108
109
  ];
109
110
  const wrapperClass =
110
111
  'card-' + (type === 'globalSearch' ? 'doc' : type || 'line');
@@ -132,6 +133,28 @@ function CclCard(props) {
132
133
  </DocCard>
133
134
  </>
134
135
  )}
136
+ {type === 'file' && (
137
+ <>
138
+ <Grid columns={2}>
139
+ <Grid.Row>
140
+ <Grid.Column className="card-icon" width={2}>
141
+ <Icon
142
+ color="olive"
143
+ size="huge"
144
+ name="file alternate outline"
145
+ />
146
+ </Grid.Column>
147
+ <Grid.Column className="card-text" width={10}>
148
+ <CardLink url={url}>{card?.title}</CardLink>
149
+ <div className="card-description">
150
+ {card?.description}
151
+ </div>
152
+ {children}
153
+ </Grid.Column>
154
+ </Grid.Row>
155
+ </Grid>
156
+ </>
157
+ )}
135
158
  {type === 'globalSearch' && (
136
159
  <>
137
160
  <Label ribbon="right" color="olive">
@@ -59,6 +59,15 @@
59
59
  background-color: #a0b1280f;
60
60
  }
61
61
 
62
+ .card-file {
63
+ position: relative;
64
+ display: flex;
65
+ width: 100%;
66
+ padding: 0;
67
+ margin-bottom: 1rem;
68
+ background-color: #a0b1280f;
69
+ }
70
+
62
71
  .card-line-color .card-image {
63
72
  width: 12rem;
64
73
  height: 12rem;
@@ -26,6 +26,7 @@ import { compose } from 'redux';
26
26
  import { connect } from 'react-redux';
27
27
  import { subscribeTo } from '../../../../../actions';
28
28
  import { toast } from 'react-toastify';
29
+ import validator from 'validator';
29
30
 
30
31
  const messages = defineMessages({
31
32
  copernicusServices: {
@@ -156,6 +157,10 @@ class Footer extends Component {
156
157
  );
157
158
  };
158
159
 
160
+ invalidEmailErrorToast = () => {
161
+ toast.error(<Toast error title={'Error'} content={'Invalid email'} />);
162
+ };
163
+
159
164
  /**
160
165
  * Submit handler
161
166
  * @method onSubmit
@@ -335,6 +340,7 @@ class Footer extends Component {
335
340
  <form action="" className="ccl-footer-form">
336
341
  <div className="ccl-footer-newsletter">
337
342
  <input
343
+ maxLength="8000"
338
344
  placeholder="Enter an email adress"
339
345
  type="text"
340
346
  value={this.state.value}
@@ -343,7 +349,11 @@ class Footer extends Component {
343
349
  <button
344
350
  type="submit"
345
351
  className="footer-privacy-button"
346
- onClick={this.onSubmit}
352
+ onClick={
353
+ validator.isEmail(this.state.value)
354
+ ? this.onSubmit
355
+ : this.invalidEmailErrorToast
356
+ }
347
357
  >
348
358
  {this.props.intl.formatMessage(messages.subscribe)}
349
359
  </button>
@@ -57,7 +57,7 @@ class CclLogout extends Component {
57
57
  <div className="event-detail-content">
58
58
  <p>{'You have logged out correctly'}</p>
59
59
  </div>
60
- <CclButton mode={'filled'}>
60
+ <CclButton isButton={'false'} mode={'filled'}>
61
61
  <CclLoginModal />
62
62
  </CclButton>
63
63
  </div>