@eeacms/volto-eea-website-theme 1.21.0 → 1.22.0
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/.husky/pre-commit +2 -0
- package/CHANGELOG.md +21 -0
- package/cypress.config.js +2 -2
- package/package.json +26 -2
- package/src/components/manage/Blocks/Title/schema.js +4 -0
- package/src/components/theme/Banner/View.jsx +2 -0
- package/src/customizations/@root/theme.js +2 -0
- package/src/customizations/volto/components/manage/Sharing/Sharing.jsx +55 -22
- package/src/customizations/volto/components/manage/Sharing/Sharing.test.jsx +72 -0
package/CHANGELOG.md
CHANGED
@@ -4,6 +4,27 @@ 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.22.0](https://github.com/eea/volto-eea-website-theme/compare/1.21.0...1.22.0) - 26 September 2023
|
8
|
+
|
9
|
+
#### :rocket: New Features
|
10
|
+
|
11
|
+
- feat: Sync Sharing component customzation to Volto 16.24.0 - refs #256039 [Alin Voinea - [`5dd215e`](https://github.com/eea/volto-eea-website-theme/commit/5dd215e4782e3ef47d558a8d57f979979496e5d9)]
|
12
|
+
|
13
|
+
#### :bug: Bug Fixes
|
14
|
+
|
15
|
+
- fix(tests): fix failing cypress tests [kreafox - [`6f729e4`](https://github.com/eea/volto-eea-website-theme/commit/6f729e40780cd02999685382f51903e0b988d647)]
|
16
|
+
- fix(tests): fix failing cypress tests [kreafox - [`cccf2c5`](https://github.com/eea/volto-eea-website-theme/commit/cccf2c561621e60ae76b1eab6a34a078f72b6bce)]
|
17
|
+
- fix(tests): fix failing cypress tests [kreafox - [`89f7572`](https://github.com/eea/volto-eea-website-theme/commit/89f7572850928501812b7cbaeea2db7346aeda82)]
|
18
|
+
- fix(tests): fix failing cypress tests [kreafox - [`fc4d65d`](https://github.com/eea/volto-eea-website-theme/commit/fc4d65de6b437cf699f70babb76de80be9b80681)]
|
19
|
+
|
20
|
+
#### :house: Internal changes
|
21
|
+
|
22
|
+
- style: lint-staged reorder in package.json [Alin Voinea - [`e9db5f2`](https://github.com/eea/volto-eea-website-theme/commit/e9db5f22d8d6b43383d40d3cb6415ee7ab4c9e70)]
|
23
|
+
|
24
|
+
#### :hammer_and_wrench: Others
|
25
|
+
|
26
|
+
- Release 1.22.0 [Alin Voinea - [`50f6493`](https://github.com/eea/volto-eea-website-theme/commit/50f649344153f7501f6e9f917fc0a44923271bd2)]
|
27
|
+
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`56b7442`](https://github.com/eea/volto-eea-website-theme/commit/56b744237da1f9ba688b7b2e06a20e1758364c31)]
|
7
28
|
### [1.21.0](https://github.com/eea/volto-eea-website-theme/compare/1.20.0...1.21.0) - 5 September 2023
|
8
29
|
|
9
30
|
#### :house: Internal changes
|
package/cypress.config.js
CHANGED
@@ -2,12 +2,12 @@ const { defineConfig } = require('cypress');
|
|
2
2
|
|
3
3
|
module.exports = defineConfig({
|
4
4
|
viewportWidth: 1280,
|
5
|
-
defaultCommandTimeout:
|
5
|
+
defaultCommandTimeout: 5000,
|
6
6
|
chromeWebSecurity: false,
|
7
7
|
reporter: 'junit',
|
8
8
|
video: true,
|
9
9
|
retries: {
|
10
|
-
runMode:
|
10
|
+
runMode: 1,
|
11
11
|
openMode: 0,
|
12
12
|
},
|
13
13
|
reporterOptions: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@eeacms/volto-eea-website-theme",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.22.0",
|
4
4
|
"description": "@eeacms/volto-eea-website-theme: Volto add-on",
|
5
5
|
"main": "src/index.js",
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
@@ -31,9 +31,32 @@
|
|
31
31
|
"@cypress/code-coverage": "^3.10.0",
|
32
32
|
"@plone/scripts": "*",
|
33
33
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
34
|
+
"husky": "*",
|
35
|
+
"lint-staged": "*",
|
34
36
|
"md5": "^2.3.0",
|
35
37
|
"postcss-less": "6.0.0"
|
36
38
|
},
|
39
|
+
"lint-staged": {
|
40
|
+
"src/**/*.{js,jsx,ts,tsx,json}": [
|
41
|
+
"make lint-fix",
|
42
|
+
"make prettier-fix"
|
43
|
+
],
|
44
|
+
"src/**/*.{jsx}": [
|
45
|
+
"make i18n"
|
46
|
+
],
|
47
|
+
"theme/**/*.{css,less}": [
|
48
|
+
"make stylelint-fix"
|
49
|
+
],
|
50
|
+
"src/**/*.{css,less}": [
|
51
|
+
"make stylelint-fix"
|
52
|
+
],
|
53
|
+
"theme/**/*.overrides": [
|
54
|
+
"make stylelint-fix"
|
55
|
+
],
|
56
|
+
"src/**/*.overrides": [
|
57
|
+
"make stylelint-fix"
|
58
|
+
]
|
59
|
+
},
|
37
60
|
"scripts": {
|
38
61
|
"release": "release-it",
|
39
62
|
"release-major-beta": "release-it major --preRelease=beta",
|
@@ -51,6 +74,7 @@
|
|
51
74
|
"lint:fix": "make lint-fix",
|
52
75
|
"i18n": "make i18n",
|
53
76
|
"cypress:run": "make cypress-run",
|
54
|
-
"cypress:open": "make cypress-open"
|
77
|
+
"cypress:open": "make cypress-open",
|
78
|
+
"prepare": "husky install"
|
55
79
|
}
|
56
80
|
}
|
@@ -55,6 +55,7 @@ export default {
|
|
55
55
|
'hideCreationDate',
|
56
56
|
'hidePublishingDate',
|
57
57
|
'hideModificationDate',
|
58
|
+
'subtitle',
|
58
59
|
'info',
|
59
60
|
],
|
60
61
|
},
|
@@ -94,6 +95,9 @@ export default {
|
|
94
95
|
title: 'Hide download button',
|
95
96
|
type: 'boolean',
|
96
97
|
},
|
98
|
+
subtitle: {
|
99
|
+
title: 'Subtitle',
|
100
|
+
},
|
97
101
|
rssLinks: {
|
98
102
|
title: 'RSS Links',
|
99
103
|
widget: 'object_list',
|
@@ -80,6 +80,7 @@ const View = (props) => {
|
|
80
80
|
copyrightIcon,
|
81
81
|
copyrightPosition,
|
82
82
|
rssLinks,
|
83
|
+
subtitle,
|
83
84
|
// contentType,
|
84
85
|
} = props.data;
|
85
86
|
const copyrightPrefix =
|
@@ -199,6 +200,7 @@ const View = (props) => {
|
|
199
200
|
</>
|
200
201
|
}
|
201
202
|
>
|
203
|
+
{subtitle && <Banner.Subtitle>{subtitle}</Banner.Subtitle>}
|
202
204
|
<Title config={banner.title} properties={metadata} />
|
203
205
|
<Banner.Metadata>
|
204
206
|
<Banner.MetadataField
|
@@ -14,7 +14,7 @@ import { Portal } from 'react-portal';
|
|
14
14
|
import {
|
15
15
|
Button,
|
16
16
|
Checkbox,
|
17
|
-
Container,
|
17
|
+
Container as SemanticContainer,
|
18
18
|
Form,
|
19
19
|
Icon as IconOld,
|
20
20
|
Input,
|
@@ -28,6 +28,7 @@ import { updateSharing, getSharing } from '@plone/volto/actions';
|
|
28
28
|
import { getBaseUrl } from '@plone/volto/helpers';
|
29
29
|
import { Icon, Toolbar, Toast } from '@plone/volto/components';
|
30
30
|
import { toast } from 'react-toastify';
|
31
|
+
import config from '@plone/volto/registry';
|
31
32
|
|
32
33
|
import aheadSVG from '@plone/volto/icons/ahead.svg';
|
33
34
|
import clearSVG from '@plone/volto/icons/clear.svg';
|
@@ -144,6 +145,7 @@ class SharingComponent extends Component {
|
|
144
145
|
this.onToggleInherit = this.onToggleInherit.bind(this);
|
145
146
|
this.state = {
|
146
147
|
search: '',
|
148
|
+
isLoading: false,
|
147
149
|
inherit: props.inherit,
|
148
150
|
entries: props.entries,
|
149
151
|
isClient: false,
|
@@ -224,7 +226,17 @@ class SharingComponent extends Component {
|
|
224
226
|
*/
|
225
227
|
onSearch(event) {
|
226
228
|
event.preventDefault();
|
227
|
-
this.
|
229
|
+
this.setState({ isLoading: true });
|
230
|
+
this.props
|
231
|
+
.getSharing(getBaseUrl(this.props.pathname), this.state.search)
|
232
|
+
.then(() => {
|
233
|
+
this.setState({ isLoading: false });
|
234
|
+
})
|
235
|
+
.catch((error) => {
|
236
|
+
this.setState({ isLoading: false });
|
237
|
+
// eslint-disable-next-line no-console
|
238
|
+
console.error('Error searching users or groups', error);
|
239
|
+
});
|
228
240
|
}
|
229
241
|
|
230
242
|
/**
|
@@ -245,9 +257,9 @@ class SharingComponent extends Component {
|
|
245
257
|
* @returns {undefined}
|
246
258
|
*/
|
247
259
|
onToggleInherit() {
|
248
|
-
this.setState({
|
249
|
-
inherit: !
|
250
|
-
});
|
260
|
+
this.setState((state) => ({
|
261
|
+
inherit: !state.inherit,
|
262
|
+
}));
|
251
263
|
}
|
252
264
|
|
253
265
|
/**
|
@@ -288,11 +300,17 @@ class SharingComponent extends Component {
|
|
288
300
|
* @returns {string} Markup for the component.
|
289
301
|
*/
|
290
302
|
render() {
|
303
|
+
const Container =
|
304
|
+
config.getComponent({ name: 'Container' }).component || SemanticContainer;
|
305
|
+
|
291
306
|
return (
|
292
307
|
<Container id="page-sharing">
|
293
308
|
<Helmet title={this.props.intl.formatMessage(messages.sharing)} />
|
294
309
|
<Segment.Group raised>
|
295
|
-
<Pluggable
|
310
|
+
<Pluggable
|
311
|
+
name="sharing-component"
|
312
|
+
params={{ isLoading: this.state.isLoading }}
|
313
|
+
/>
|
296
314
|
<Plug pluggable="sharing-component" id="sharing-component-title">
|
297
315
|
<Segment className="primary">
|
298
316
|
<FormattedMessage
|
@@ -314,20 +332,29 @@ class SharingComponent extends Component {
|
|
314
332
|
</Segment>
|
315
333
|
</Plug>
|
316
334
|
<Plug pluggable="sharing-component" id="sharing-component-search">
|
317
|
-
|
318
|
-
|
319
|
-
<
|
320
|
-
<
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
335
|
+
{({ isLoading }) => {
|
336
|
+
return (
|
337
|
+
<Segment>
|
338
|
+
<Form onSubmit={this.onSearch}>
|
339
|
+
<Form.Field>
|
340
|
+
<Input
|
341
|
+
name="SearchableText"
|
342
|
+
action={{
|
343
|
+
icon: 'search',
|
344
|
+
loading: isLoading,
|
345
|
+
disabled: isLoading,
|
346
|
+
}}
|
347
|
+
placeholder={this.props.intl.formatMessage(
|
348
|
+
messages.searchForUserOrGroup,
|
349
|
+
)}
|
350
|
+
onChange={this.onChangeSearch}
|
351
|
+
id="sharing-component-search"
|
352
|
+
/>
|
353
|
+
</Form.Field>
|
354
|
+
</Form>
|
355
|
+
</Segment>
|
356
|
+
);
|
357
|
+
}}
|
331
358
|
</Plug>
|
332
359
|
<Plug
|
333
360
|
pluggable="sharing-component"
|
@@ -400,9 +427,15 @@ class SharingComponent extends Component {
|
|
400
427
|
<Segment attached>
|
401
428
|
<Form.Field>
|
402
429
|
<Checkbox
|
403
|
-
|
430
|
+
id="inherit-permissions-checkbox"
|
431
|
+
name="inherit-permissions-checkbox"
|
432
|
+
defaultChecked={this.state.inherit}
|
404
433
|
onChange={this.onToggleInherit}
|
405
|
-
label={
|
434
|
+
label={
|
435
|
+
<label htmlFor="inherit-permissions-checkbox">
|
436
|
+
{this.props.intl.formatMessage(messages.inherit)}
|
437
|
+
</label>
|
438
|
+
}
|
406
439
|
/>
|
407
440
|
</Form.Field>
|
408
441
|
<p className="help">
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import renderer from 'react-test-renderer';
|
3
|
+
import configureStore from 'redux-mock-store';
|
4
|
+
import { Provider } from 'react-intl-redux';
|
5
|
+
import jwt from 'jsonwebtoken';
|
6
|
+
import { MemoryRouter } from 'react-router-dom';
|
7
|
+
import { PluggablesProvider } from '@plone/volto/components/manage/Pluggable';
|
8
|
+
|
9
|
+
import Sharing from './Sharing';
|
10
|
+
|
11
|
+
const mockStore = configureStore();
|
12
|
+
|
13
|
+
jest.mock('react-portal', () => ({
|
14
|
+
Portal: jest.fn(() => <div id="Portal" />),
|
15
|
+
}));
|
16
|
+
|
17
|
+
describe('Sharing', () => {
|
18
|
+
it('renders a sharing component', () => {
|
19
|
+
const store = mockStore({
|
20
|
+
userSession: {
|
21
|
+
token: jwt.sign({ sub: 'john-doe' }, 'secret'),
|
22
|
+
},
|
23
|
+
sharing: {
|
24
|
+
data: {
|
25
|
+
entries: [
|
26
|
+
{
|
27
|
+
id: 'john-doe',
|
28
|
+
disabled: false,
|
29
|
+
login: 'john-doe',
|
30
|
+
roles: {
|
31
|
+
Contributer: true,
|
32
|
+
},
|
33
|
+
title: 'John Doe',
|
34
|
+
type: 'user',
|
35
|
+
},
|
36
|
+
],
|
37
|
+
inherit: true,
|
38
|
+
available_roles: [
|
39
|
+
{
|
40
|
+
id: 'Contributor',
|
41
|
+
title: 'Can add',
|
42
|
+
},
|
43
|
+
],
|
44
|
+
},
|
45
|
+
update: {
|
46
|
+
loading: false,
|
47
|
+
loaded: true,
|
48
|
+
},
|
49
|
+
},
|
50
|
+
content: {
|
51
|
+
data: {
|
52
|
+
title: 'Blog',
|
53
|
+
},
|
54
|
+
},
|
55
|
+
intl: {
|
56
|
+
locale: 'en',
|
57
|
+
messages: {},
|
58
|
+
},
|
59
|
+
});
|
60
|
+
const component = renderer.create(
|
61
|
+
<Provider store={store}>
|
62
|
+
<PluggablesProvider>
|
63
|
+
<MemoryRouter>
|
64
|
+
<Sharing location={{ pathname: '/blog' }} />
|
65
|
+
</MemoryRouter>
|
66
|
+
</PluggablesProvider>
|
67
|
+
</Provider>,
|
68
|
+
);
|
69
|
+
const json = component.toJSON();
|
70
|
+
expect(json).toMatchSnapshot();
|
71
|
+
});
|
72
|
+
});
|