@eeacms/volto-eea-website-theme 1.21.0 → 1.22.1
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 +38 -0
- package/DEVELOP.md +6 -7
- package/README.md +20 -20
- 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,34 @@ 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.1](https://github.com/eea/volto-eea-website-theme/compare/1.22.0...1.22.1) - 29 September 2023
|
8
|
+
|
9
|
+
#### :house: Documentation changes
|
10
|
+
|
11
|
+
- docs: Update README and DEVELOP [Alin Voinea - [`d0a8655`](https://github.com/eea/volto-eea-website-theme/commit/d0a86555904b43cdc477bc745989b819ab0e86b4)]
|
12
|
+
- docs: Update README and add demo gifs [Alin Voinea - [`ad00749`](https://github.com/eea/volto-eea-website-theme/commit/ad007497c063e0c46d444df9ecb54858add23682)]
|
13
|
+
|
14
|
+
### [1.22.0](https://github.com/eea/volto-eea-website-theme/compare/1.21.0...1.22.0) - 27 September 2023
|
15
|
+
|
16
|
+
#### :rocket: New Features
|
17
|
+
|
18
|
+
- 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)]
|
19
|
+
|
20
|
+
#### :bug: Bug Fixes
|
21
|
+
|
22
|
+
- fix(tests): fix failing cypress tests [kreafox - [`6f729e4`](https://github.com/eea/volto-eea-website-theme/commit/6f729e40780cd02999685382f51903e0b988d647)]
|
23
|
+
- fix(tests): fix failing cypress tests [kreafox - [`cccf2c5`](https://github.com/eea/volto-eea-website-theme/commit/cccf2c561621e60ae76b1eab6a34a078f72b6bce)]
|
24
|
+
- fix(tests): fix failing cypress tests [kreafox - [`89f7572`](https://github.com/eea/volto-eea-website-theme/commit/89f7572850928501812b7cbaeea2db7346aeda82)]
|
25
|
+
- fix(tests): fix failing cypress tests [kreafox - [`fc4d65d`](https://github.com/eea/volto-eea-website-theme/commit/fc4d65de6b437cf699f70babb76de80be9b80681)]
|
26
|
+
|
27
|
+
#### :house: Internal changes
|
28
|
+
|
29
|
+
- style: lint-staged reorder in package.json [Alin Voinea - [`e9db5f2`](https://github.com/eea/volto-eea-website-theme/commit/e9db5f22d8d6b43383d40d3cb6415ee7ab4c9e70)]
|
30
|
+
|
31
|
+
#### :hammer_and_wrench: Others
|
32
|
+
|
33
|
+
- Release 1.22.0 [Alin Voinea - [`50f6493`](https://github.com/eea/volto-eea-website-theme/commit/50f649344153f7501f6e9f917fc0a44923271bd2)]
|
34
|
+
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`56b7442`](https://github.com/eea/volto-eea-website-theme/commit/56b744237da1f9ba688b7b2e06a20e1758364c31)]
|
7
35
|
### [1.21.0](https://github.com/eea/volto-eea-website-theme/compare/1.20.0...1.21.0) - 5 September 2023
|
8
36
|
|
9
37
|
#### :house: Internal changes
|
@@ -152,6 +180,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
152
180
|
|
153
181
|
#### :house: Internal changes
|
154
182
|
|
183
|
+
- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`370dcbf`](https://github.com/eea/volto-eea-website-theme/commit/370dcbfbf1a8135ce7b1b3b271b004552a631837)]
|
155
184
|
|
156
185
|
#### :hammer_and_wrench: Others
|
157
186
|
|
@@ -307,6 +336,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
307
336
|
|
308
337
|
#### :hammer_and_wrench: Others
|
309
338
|
|
339
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`6c5e2f8`](https://github.com/eea/volto-eea-website-theme/commit/6c5e2f80456e2061d9e9c15fd0a0b91b9ac70568)]
|
310
340
|
### [1.9.1](https://github.com/eea/volto-eea-website-theme/compare/1.9.0...1.9.1) - 28 February 2023
|
311
341
|
|
312
342
|
#### :bug: Bug Fixes
|
@@ -453,6 +483,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
453
483
|
|
454
484
|
- For some reasons types is a string [Alin Voinea - [`3769a09`](https://github.com/eea/volto-eea-website-theme/commit/3769a0981181d5b633f3498daebbe96be8b4b833)]
|
455
485
|
- Fix(redirect): o.filter - refs #157627 [Alin Voinea - [`deb23da`](https://github.com/eea/volto-eea-website-theme/commit/deb23da846444cc96539697fd798429ae0abe89e)]
|
486
|
+
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`f1fffc5`](https://github.com/eea/volto-eea-website-theme/commit/f1fffc5db96725440863d545580b4e76cce4b796)]
|
456
487
|
### [1.5.0](https://github.com/eea/volto-eea-website-theme/compare/1.4.2...1.5.0) - 9 January 2023
|
457
488
|
|
458
489
|
#### :hammer_and_wrench: Others
|
@@ -486,6 +517,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
486
517
|
|
487
518
|
- Release 1.4.0 [Alin Voinea - [`bd42a0d`](https://github.com/eea/volto-eea-website-theme/commit/bd42a0d26e928cac5d99933194755da3db06b341)]
|
488
519
|
- bump version to use as volto-eea-design-system [David Ichim - [`f4be047`](https://github.com/eea/volto-eea-website-theme/commit/f4be047328b46399b03b612d378b18aaf82e7dc1)]
|
520
|
+
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`9b7cfef`](https://github.com/eea/volto-eea-website-theme/commit/9b7cfefb4d34fc1c948015e491feb370f9795bd8)]
|
489
521
|
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`df252a9`](https://github.com/eea/volto-eea-website-theme/commit/df252a9bfed0bb86cadf53c59dd1603b1e2cd822)]
|
490
522
|
### [1.3.2](https://github.com/eea/volto-eea-website-theme/compare/1.3.1...1.3.2) - 16 December 2022
|
491
523
|
|
@@ -495,6 +527,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
495
527
|
|
496
528
|
#### :hammer_and_wrench: Others
|
497
529
|
|
530
|
+
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`a43c658`](https://github.com/eea/volto-eea-website-theme/commit/a43c658a7920c8df95e763b9a637f38ce77eba2c)]
|
498
531
|
- Better razzle.config [Tiberiu Ichim - [`81dbf48`](https://github.com/eea/volto-eea-website-theme/commit/81dbf48815fb27facb4f82c9b764540fdf188b2e)]
|
499
532
|
- Better razzle.config [Tiberiu Ichim - [`7bc9da2`](https://github.com/eea/volto-eea-website-theme/commit/7bc9da2cd837ab62a95cd29979cdd9b0055b7d67)]
|
500
533
|
### [1.3.1](https://github.com/eea/volto-eea-website-theme/compare/1.3.0...1.3.1) - 28 November 2022
|
@@ -505,6 +538,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
505
538
|
|
506
539
|
#### :hammer_and_wrench: Others
|
507
540
|
|
541
|
+
- yarn 3 [Alin Voinea - [`ea7a709`](https://github.com/eea/volto-eea-website-theme/commit/ea7a7094945312776e9b6f44e371178603e92139)]
|
508
542
|
### [1.3.0](https://github.com/eea/volto-eea-website-theme/compare/1.2.0...1.3.0) - 22 November 2022
|
509
543
|
|
510
544
|
#### :rocket: New Features
|
@@ -545,6 +579,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
545
579
|
- Add subsite class to body [Tiberiu Ichim - [`74d700f`](https://github.com/eea/volto-eea-website-theme/commit/74d700fbfd6249a8604762a7e4e49cce857db0f3)]
|
546
580
|
- Add subsite info to header [Tiberiu Ichim - [`47daf8b`](https://github.com/eea/volto-eea-website-theme/commit/47daf8bb6374a1222040626b19d4154df7ba1b83)]
|
547
581
|
- fix eslint [Miu Razvan - [`eb8d0a7`](https://github.com/eea/volto-eea-website-theme/commit/eb8d0a790bc70c0aae256c6ff35f63c4885f338e)]
|
582
|
+
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`cc578a4`](https://github.com/eea/volto-eea-website-theme/commit/cc578a413b205a8e61e091fab3a88f94cedefc89)]
|
548
583
|
### [1.1.0](https://github.com/eea/volto-eea-website-theme/compare/1.0.0...1.1.0) - 28 October 2022
|
549
584
|
|
550
585
|
#### :nail_care: Enhancements
|
@@ -592,6 +627,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
592
627
|
|
593
628
|
#### :hammer_and_wrench: Others
|
594
629
|
|
630
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`33b56ac`](https://github.com/eea/volto-eea-website-theme/commit/33b56acb13fbaf0c5b79e8fc6e13c4b699c79c90)]
|
595
631
|
### [0.7.3](https://github.com/eea/volto-eea-website-theme/compare/0.7.2...0.7.3) - 22 September 2022
|
596
632
|
|
597
633
|
#### :hammer_and_wrench: Others
|
@@ -859,6 +895,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
859
895
|
- Header refactor, add custom logo #5 [ichim-david - [`4950235`](https://github.com/eea/volto-eea-website-theme/commit/49502358105437cfeac3b144e6d301cb59aa2346)]
|
860
896
|
- Update footer.config with new publication card component [ichim-david - [`2e38e9a`](https://github.com/eea/volto-eea-website-theme/commit/2e38e9a417f835009d60c80d4eb4b30229f55e45)]
|
861
897
|
- feature(breadcrumbs): implement eea-design-system breadcrumb as Volto component #32 #7 [ichim-david - [`181af41`](https://github.com/eea/volto-eea-website-theme/commit/181af4125ce2b9ddac56dab4723cb11c26633221)]
|
898
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`da8ceb6`](https://github.com/eea/volto-eea-website-theme/commit/da8ceb68ea68bfbc9504e48ccd4d68277f11ab9a)]
|
862
899
|
- use breadcrumbs from eea-design-system [nileshgulia1 - [`db2f9e9`](https://github.com/eea/volto-eea-website-theme/commit/db2f9e9a4327420a3cce9a9903cd88549b129eab)]
|
863
900
|
- Update theme.config [ichim-david - [`8eca4f4`](https://github.com/eea/volto-eea-website-theme/commit/8eca4f40397a4aeca6d39029c92db78968d37064)]
|
864
901
|
- Added keyContent component to theme.config [ichim-david - [`d86f202`](https://github.com/eea/volto-eea-website-theme/commit/d86f202d0274d839487a88b51cae9a0e899beb23)]
|
@@ -900,4 +937,5 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
900
937
|
|
901
938
|
#### :hammer_and_wrench: Others
|
902
939
|
|
940
|
+
- yarn bootstrap [Alin Voinea - [`6995e9e`](https://github.com/eea/volto-eea-website-theme/commit/6995e9e091f21fdbbdffa8a44fc0e2c626f6d46a)]
|
903
941
|
- Initial commit [Alin Voinea - [`6a9c03a`](https://github.com/eea/volto-eea-website-theme/commit/6a9c03a7cebe71ca87e82cf58c42904063e9d8d3)]
|
package/DEVELOP.md
CHANGED
@@ -16,12 +16,14 @@
|
|
16
16
|
|
17
17
|
1. Go to http://localhost:3000
|
18
18
|
|
19
|
-
1.
|
19
|
+
1. Initialize git hooks
|
20
20
|
|
21
21
|
```Bash
|
22
|
-
|
22
|
+
yarn prepare
|
23
23
|
```
|
24
24
|
|
25
|
+
1. Happy hacking!
|
26
|
+
|
25
27
|
### Or add @eeacms/volto-eea-website-theme to your Volto project
|
26
28
|
|
27
29
|
Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
|
@@ -48,18 +50,15 @@ Before starting make sure your development environment is properly set. See [Vol
|
|
48
50
|
|
49
51
|
1. Install
|
50
52
|
|
51
|
-
|
53
|
+
make develop
|
52
54
|
yarn
|
53
55
|
|
54
56
|
1. Start backend
|
55
57
|
|
56
|
-
docker pull plone
|
57
|
-
docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
|
58
|
+
docker run --pull always -it --rm --name plone -p 8080:8080 -e SITE=Plone plone/plone-backend
|
58
59
|
|
59
60
|
...wait for backend to setup and start - `Ready to handle requests`:
|
60
61
|
|
61
|
-
docker logs -f plone
|
62
|
-
|
63
62
|
...you can also check http://localhost:8080/Plone
|
64
63
|
|
65
64
|
1. Start frontend
|
package/README.md
CHANGED
@@ -20,6 +20,11 @@ EEA Website [Volto](https://github.com/plone/volto) Theme
|
|
20
20
|
|
21
21
|
- https://www.eea.europa.eu
|
22
22
|
|
23
|
+
## Docusaurus and Storybook
|
24
|
+
|
25
|
+
See [Docusaurus](https://eea.github.io/).
|
26
|
+
See [Storybook](https://eea.github.io/eea-storybook/).
|
27
|
+
|
23
28
|
## Getting started
|
24
29
|
|
25
30
|
### Try volto-eea-website-theme with Docker
|
@@ -41,25 +46,25 @@ Go to http://localhost:3000
|
|
41
46
|
|
42
47
|
1. Start Volto frontend
|
43
48
|
|
44
|
-
|
49
|
+
* If you already have a volto project, just update `package.json`:
|
45
50
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
51
|
+
```JSON
|
52
|
+
"addons": [
|
53
|
+
"@eeacms/volto-eea-website-theme"
|
54
|
+
],
|
50
55
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
56
|
+
"dependencies": {
|
57
|
+
"@eeacms/volto-eea-website-theme": "*"
|
58
|
+
}
|
59
|
+
```
|
55
60
|
|
56
|
-
|
61
|
+
* If not, create one:
|
57
62
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
+
```
|
64
|
+
npm install -g yo @plone/generator-volto
|
65
|
+
yo @plone/volto my-volto-project --canary --addon @eeacms/volto-eea-website-theme
|
66
|
+
cd my-volto-project
|
67
|
+
```
|
63
68
|
|
64
69
|
1. Install new add-ons and restart Volto:
|
65
70
|
|
@@ -80,11 +85,6 @@ See [RELEASE.md](https://github.com/eea/volto-eea-website-theme/blob/master/RELE
|
|
80
85
|
|
81
86
|
See [DEVELOP.md](https://github.com/eea/volto-eea-website-theme/blob/master/DEVELOP.md).
|
82
87
|
|
83
|
-
## Docusaurus and Storybook
|
84
|
-
|
85
|
-
See [Docusaurus](https://eea.github.io/).
|
86
|
-
See [Storybook](https://eea.github.io/eea-storybook/).
|
87
|
-
|
88
88
|
## Copyright and license
|
89
89
|
|
90
90
|
The Initial Owner of the Original Code is European Environment Agency (EEA).
|
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.1",
|
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
|
+
});
|