@eeacms/volto-eea-website-theme 2.2.2 → 2.4.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.
Files changed (31) hide show
  1. package/CHANGELOG.md +26 -22
  2. package/package.json +3 -1
  3. package/src/components/manage/Blocks/ContextNavigation/ContextNavigationEdit.jsx +45 -0
  4. package/src/components/manage/Blocks/ContextNavigation/ContextNavigationEdit.test.jsx +88 -0
  5. package/src/components/manage/Blocks/ContextNavigation/ContextNavigationView.jsx +14 -0
  6. package/src/components/manage/Blocks/ContextNavigation/ContextNavigationView.test.jsx +71 -0
  7. package/src/components/manage/Blocks/ContextNavigation/index.js +30 -0
  8. package/src/components/manage/Blocks/ContextNavigation/schema.js +88 -0
  9. package/src/components/manage/Blocks/ContextNavigation/variations/Accordion.jsx +179 -0
  10. package/src/components/manage/Blocks/ContextNavigation/variations/Default.jsx +9 -0
  11. package/src/components/manage/Blocks/ContextNavigation/variations/index.js +18 -0
  12. package/src/components/manage/Blocks/Title/Edit.jsx +7 -4
  13. package/src/components/manage/Blocks/Title/View.jsx +14 -24
  14. package/src/components/manage/Blocks/Title/index.js +52 -0
  15. package/src/components/manage/Blocks/Title/variations/Default.jsx +43 -0
  16. package/src/components/manage/Blocks/Title/variations/WebReport.jsx +69 -0
  17. package/src/components/manage/Blocks/Title/variations/WebReportPage.jsx +59 -0
  18. package/src/components/manage/Blocks/Title/variations/styles.less +28 -0
  19. package/src/components/theme/Banner/View.jsx +5 -1
  20. package/src/components/theme/SubsiteClass.jsx +3 -1
  21. package/src/components/theme/WebReport/WebReportSectionView.jsx +49 -0
  22. package/src/components/theme/Widgets/DateWidget.jsx +32 -0
  23. package/src/components/theme/Widgets/DateWidget.test.js +67 -0
  24. package/src/components/theme/Widgets/DatetimeWidget.jsx +45 -0
  25. package/src/components/theme/Widgets/DatetimeWidget.test.js +63 -0
  26. package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.jsx +20 -2
  27. package/src/customizations/volto/components/theme/Header/Header.jsx +3 -3
  28. package/src/customizations/volto/components/theme/View/DefaultView.jsx +190 -0
  29. package/src/hocs/withDeviceSize.test.jsx +79 -0
  30. package/src/index.js +37 -14
  31. package/src/index.test.js +2 -0
package/CHANGELOG.md CHANGED
@@ -4,11 +4,35 @@ 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
- ### [2.2.2](https://github.com/eea/volto-eea-website-theme/compare/2.2.1...2.2.2) - 29 August 2024
7
+ ### [2.4.0](https://github.com/eea/volto-eea-website-theme/compare/2.3.0...2.4.0) - 11 October 2024
8
8
 
9
9
  #### :bug: Bug Fixes
10
10
 
11
- - fix: Handle footer button action when on informatiion-system page [Alin Voinea - [`2100779`](https://github.com/eea/volto-eea-website-theme/commit/210077975e1e32858959785098231dac08fb8619)]
11
+ - fix: add subsite_css class when not undefined [nileshgulia1 - [`db3f80f`](https://github.com/eea/volto-eea-website-theme/commit/db3f80f9dac34f528030d1d2a2f858555059879e)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - Increase test coverage [dobri1408 - [`e2d46a9`](https://github.com/eea/volto-eea-website-theme/commit/e2d46a981c6f50980f0b0bf1f35b2d03121f3c88)]
16
+ - Update package.json [Ichim David - [`24ea8f0`](https://github.com/eea/volto-eea-website-theme/commit/24ea8f0ef7c474bcf171f4720465e12a0d600b46)]
17
+ ### [2.3.0](https://github.com/eea/volto-eea-website-theme/compare/2.2.2...2.3.0) - 13 September 2024
18
+
19
+ #### :house: Internal changes
20
+
21
+ - style: Automated code fix [eea-jenkins - [`df350bf`](https://github.com/eea/volto-eea-website-theme/commit/df350bfff7b6e0ca4227a29d4fd6108293a55b04)]
22
+
23
+ #### :hammer_and_wrench: Others
24
+
25
+ - Bump package.json version to 2.3.0 [ichim-david - [`c81b67e`](https://github.com/eea/volto-eea-website-theme/commit/c81b67e70a826af43b3876d531778c4320f64add)]
26
+ - fix conflicts with develop [Teodor - [`801f4fc`](https://github.com/eea/volto-eea-website-theme/commit/801f4fc45fb9a3e985a7351bb8998dcb53e8fa19)]
27
+ - update both widgets and tests [Teodor - [`8d295f7`](https://github.com/eea/volto-eea-website-theme/commit/8d295f7bb736b48c02ad0aa1ea1f6071752ecf1c)]
28
+ - code cleanup [Teodor - [`8e27f48`](https://github.com/eea/volto-eea-website-theme/commit/8e27f48c6fde1f66e76d01e03e7001c620c4c585)]
29
+ - update test and add DateWidget in config too [Teodor - [`f14f9e4`](https://github.com/eea/volto-eea-website-theme/commit/f14f9e44c3779e40cf8d7bcc42efc5768a919250)]
30
+ - Fix test [Tiberiu Ichim - [`42012c6`](https://github.com/eea/volto-eea-website-theme/commit/42012c6bce80d0d6f13ae9d2a9c0deea8fa19eb0)]
31
+ - remake snapshots and fix import [Teodor - [`5bb47d6`](https://github.com/eea/volto-eea-website-theme/commit/5bb47d6e7bdb0cad7f1fd4c7055c7d8f7b06d9e6)]
32
+ - Fix test [Tiberiu Ichim - [`f73cf32`](https://github.com/eea/volto-eea-website-theme/commit/f73cf32ae50cd768d56a991d7c9177e89ae53599)]
33
+ - add test for the widget [Teodor - [`543c5bc`](https://github.com/eea/volto-eea-website-theme/commit/543c5bcf1246953e06ee79c5b559d0ba9e3307cf)]
34
+ - use formatDate from Volto [Teodor - [`24114b3`](https://github.com/eea/volto-eea-website-theme/commit/24114b3dac79418293d271bff06afd8d985d380d)]
35
+ ### [2.2.2](https://github.com/eea/volto-eea-website-theme/compare/2.2.1...2.2.2) - 29 August 2024
12
36
 
13
37
  ### [2.2.1](https://github.com/eea/volto-eea-website-theme/compare/2.2.0...2.2.1) - 28 August 2024
14
38
 
@@ -52,7 +76,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
52
76
  - Refs #269520 - other_organisation test [Tripon Eugen - [`7558b27`](https://github.com/eea/volto-eea-website-theme/commit/7558b27a9d1cd6d3480a32b296c7325c796006c9)]
53
77
  - Refs #269520 - other_organisation token widget edit mode [Tripon Eugen - [`b6df127`](https://github.com/eea/volto-eea-website-theme/commit/b6df127bd91b6f55dda8f468e1107037d43752ff)]
54
78
  - Refs #269520 - other_organisation token widget [Tripon Eugen - [`6fd7543`](https://github.com/eea/volto-eea-website-theme/commit/6fd7543894bd2c593a1729116befd95c82ea3c8f)]
55
- - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`cbc36c7`](https://github.com/eea/volto-eea-website-theme/commit/cbc36c74dfcd5f7cb1013a4c673d9c02e0023766)]
56
79
  ### [2.1.1](https://github.com/eea/volto-eea-website-theme/compare/2.1.0...2.1.1) - 28 May 2024
57
80
 
58
81
  #### :bug: Bug Fixes
@@ -125,7 +148,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
125
148
 
126
149
  #### :hammer_and_wrench: Others
127
150
 
128
- - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`adc6730`](https://github.com/eea/volto-eea-website-theme/commit/adc6730e21a37afb865b842182624401de6a29f5)]
129
151
  ### [1.33.1](https://github.com/eea/volto-eea-website-theme/compare/1.33.0...1.33.1) - 4 April 2024
130
152
 
131
153
  #### :bug: Bug Fixes
@@ -259,8 +281,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
259
281
 
260
282
  - bump version [Razvan - [`721e939`](https://github.com/eea/volto-eea-website-theme/commit/721e939d12e324b459ebfa78a2e656ee7142a3d6)]
261
283
  - merge master into this branch [Razvan - [`586c8f9`](https://github.com/eea/volto-eea-website-theme/commit/586c8f910bac55a043bd8dda60e9444bd2ae1663)]
262
- - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`fd90044`](https://github.com/eea/volto-eea-website-theme/commit/fd9004442a9d1d465f7601ecdefe3e23c61e6a9c)]
263
- - Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`4bc3dd3`](https://github.com/eea/volto-eea-website-theme/commit/4bc3dd3ae412a66befd04b5b80fab3716c929240)]
264
284
  - test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`c4dbd28`](https://github.com/eea/volto-eea-website-theme/commit/c4dbd289358205bc2d849aab7edb11ccf3b89cee)]
265
285
  - fix tests [Razvan - [`042330b`](https://github.com/eea/volto-eea-website-theme/commit/042330bc97d32ffe7ba769b4f2453f71cffed706)]
266
286
  - remove RemoveSchema logic [Razvan - [`08d10f8`](https://github.com/eea/volto-eea-website-theme/commit/08d10f8bf6f75478260e4e4c66d7316ba87b907a)]
@@ -355,11 +375,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
355
375
  - test: Add real image to cypress test [Alin Voinea - [`4ff591a`](https://github.com/eea/volto-eea-website-theme/commit/4ff591ae3318c9588b4e2114582c0fa6cfdf31ae)]
356
376
  - test: Add cypress tests for Image block styling position and align [Alin Voinea - [`7341ef7`](https://github.com/eea/volto-eea-website-theme/commit/7341ef7b92714fc0cc3ab0c31c39033e7b3e19e7)]
357
377
  - Revert "change(tests): commented out rss test since title block config is missing" [Alin Voinea - [`fb61191`](https://github.com/eea/volto-eea-website-theme/commit/fb611918d6ca380b89b594f283dcf9f685a4b294)]
358
- - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`6a3be30`](https://github.com/eea/volto-eea-website-theme/commit/6a3be3092589411af7808a235f76de5222fd3868)]
359
- - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`c3978f2`](https://github.com/eea/volto-eea-website-theme/commit/c3978f23375ef066e9fd6f6c2e34ba6c1c058f69)]
360
- - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`f672779`](https://github.com/eea/volto-eea-website-theme/commit/f672779e845bec9240ccc901e9f53ec80c5a1819)]
361
- - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`ae5d8e3`](https://github.com/eea/volto-eea-website-theme/commit/ae5d8e3f4e04dc2808d47ce2ee886e1b23b528da)]
362
- - test: [JENKINS] Improve cypress time [valentinab25 - [`170ff0c`](https://github.com/eea/volto-eea-website-theme/commit/170ff0c8e3b30e69479bdf1117e811fea94f1027)]
363
378
  ### [1.23.0](https://github.com/eea/volto-eea-website-theme/compare/1.22.1...1.23.0) - 2 November 2023
364
379
 
365
380
  #### :rocket: New Features
@@ -372,7 +387,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
372
387
 
373
388
  #### :house: Internal changes
374
389
 
375
- - chore: [JENKINS] Refactor automated testing [valentinab25 - [`f28fce3`](https://github.com/eea/volto-eea-website-theme/commit/f28fce3d1eb815f95fb9aa40de42b10b7e8e30c5)]
376
390
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`6d15088`](https://github.com/eea/volto-eea-website-theme/commit/6d150886c5aeb2ca0b569270486e60f7cc274e2c)]
377
391
  - chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`20c0323`](https://github.com/eea/volto-eea-website-theme/commit/20c032380b33c0077c869a05136f93e2fb68e5d4)]
378
392
 
@@ -558,7 +572,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
558
572
 
559
573
  #### :house: Internal changes
560
574
 
561
- - chore: [JENKINS] Deprecate circularity website [valentinab25 - [`370dcbf`](https://github.com/eea/volto-eea-website-theme/commit/370dcbfbf1a8135ce7b1b3b271b004552a631837)]
562
575
 
563
576
  #### :hammer_and_wrench: Others
564
577
 
@@ -714,7 +727,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
714
727
 
715
728
  #### :hammer_and_wrench: Others
716
729
 
717
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`6c5e2f8`](https://github.com/eea/volto-eea-website-theme/commit/6c5e2f80456e2061d9e9c15fd0a0b91b9ac70568)]
718
730
  ### [1.9.1](https://github.com/eea/volto-eea-website-theme/compare/1.9.0...1.9.1) - 28 February 2023
719
731
 
720
732
  #### :bug: Bug Fixes
@@ -861,7 +873,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
861
873
 
862
874
  - For some reasons types is a string [Alin Voinea - [`3769a09`](https://github.com/eea/volto-eea-website-theme/commit/3769a0981181d5b633f3498daebbe96be8b4b833)]
863
875
  - Fix(redirect): o.filter - refs #157627 [Alin Voinea - [`deb23da`](https://github.com/eea/volto-eea-website-theme/commit/deb23da846444cc96539697fd798429ae0abe89e)]
864
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`f1fffc5`](https://github.com/eea/volto-eea-website-theme/commit/f1fffc5db96725440863d545580b4e76cce4b796)]
865
876
  ### [1.5.0](https://github.com/eea/volto-eea-website-theme/compare/1.4.2...1.5.0) - 9 January 2023
866
877
 
867
878
  #### :hammer_and_wrench: Others
@@ -895,7 +906,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
895
906
 
896
907
  - Release 1.4.0 [Alin Voinea - [`bd42a0d`](https://github.com/eea/volto-eea-website-theme/commit/bd42a0d26e928cac5d99933194755da3db06b341)]
897
908
  - bump version to use as volto-eea-design-system [David Ichim - [`f4be047`](https://github.com/eea/volto-eea-website-theme/commit/f4be047328b46399b03b612d378b18aaf82e7dc1)]
898
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`9b7cfef`](https://github.com/eea/volto-eea-website-theme/commit/9b7cfefb4d34fc1c948015e491feb370f9795bd8)]
899
909
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`df252a9`](https://github.com/eea/volto-eea-website-theme/commit/df252a9bfed0bb86cadf53c59dd1603b1e2cd822)]
900
910
  ### [1.3.2](https://github.com/eea/volto-eea-website-theme/compare/1.3.1...1.3.2) - 16 December 2022
901
911
 
@@ -905,7 +915,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
905
915
 
906
916
  #### :hammer_and_wrench: Others
907
917
 
908
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`a43c658`](https://github.com/eea/volto-eea-website-theme/commit/a43c658a7920c8df95e763b9a637f38ce77eba2c)]
909
918
  - Better razzle.config [Tiberiu Ichim - [`81dbf48`](https://github.com/eea/volto-eea-website-theme/commit/81dbf48815fb27facb4f82c9b764540fdf188b2e)]
910
919
  - Better razzle.config [Tiberiu Ichim - [`7bc9da2`](https://github.com/eea/volto-eea-website-theme/commit/7bc9da2cd837ab62a95cd29979cdd9b0055b7d67)]
911
920
  ### [1.3.1](https://github.com/eea/volto-eea-website-theme/compare/1.3.0...1.3.1) - 28 November 2022
@@ -916,7 +925,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
916
925
 
917
926
  #### :hammer_and_wrench: Others
918
927
 
919
- - yarn 3 [Alin Voinea - [`ea7a709`](https://github.com/eea/volto-eea-website-theme/commit/ea7a7094945312776e9b6f44e371178603e92139)]
920
928
  ### [1.3.0](https://github.com/eea/volto-eea-website-theme/compare/1.2.0...1.3.0) - 22 November 2022
921
929
 
922
930
  #### :rocket: New Features
@@ -957,7 +965,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
957
965
  - Add subsite class to body [Tiberiu Ichim - [`74d700f`](https://github.com/eea/volto-eea-website-theme/commit/74d700fbfd6249a8604762a7e4e49cce857db0f3)]
958
966
  - Add subsite info to header [Tiberiu Ichim - [`47daf8b`](https://github.com/eea/volto-eea-website-theme/commit/47daf8bb6374a1222040626b19d4154df7ba1b83)]
959
967
  - fix eslint [Miu Razvan - [`eb8d0a7`](https://github.com/eea/volto-eea-website-theme/commit/eb8d0a790bc70c0aae256c6ff35f63c4885f338e)]
960
- - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`cc578a4`](https://github.com/eea/volto-eea-website-theme/commit/cc578a413b205a8e61e091fab3a88f94cedefc89)]
961
968
  ### [1.1.0](https://github.com/eea/volto-eea-website-theme/compare/1.0.0...1.1.0) - 28 October 2022
962
969
 
963
970
  #### :nail_care: Enhancements
@@ -1005,7 +1012,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1005
1012
 
1006
1013
  #### :hammer_and_wrench: Others
1007
1014
 
1008
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`33b56ac`](https://github.com/eea/volto-eea-website-theme/commit/33b56acb13fbaf0c5b79e8fc6e13c4b699c79c90)]
1009
1015
  ### [0.7.3](https://github.com/eea/volto-eea-website-theme/compare/0.7.2...0.7.3) - 22 September 2022
1010
1016
 
1011
1017
  #### :hammer_and_wrench: Others
@@ -1273,7 +1279,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1273
1279
  - Header refactor, add custom logo #5 [ichim-david - [`4950235`](https://github.com/eea/volto-eea-website-theme/commit/49502358105437cfeac3b144e6d301cb59aa2346)]
1274
1280
  - Update footer.config with new publication card component [ichim-david - [`2e38e9a`](https://github.com/eea/volto-eea-website-theme/commit/2e38e9a417f835009d60c80d4eb4b30229f55e45)]
1275
1281
  - 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)]
1276
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`da8ceb6`](https://github.com/eea/volto-eea-website-theme/commit/da8ceb68ea68bfbc9504e48ccd4d68277f11ab9a)]
1277
1282
  - use breadcrumbs from eea-design-system [nileshgulia1 - [`db2f9e9`](https://github.com/eea/volto-eea-website-theme/commit/db2f9e9a4327420a3cce9a9903cd88549b129eab)]
1278
1283
  - Update theme.config [ichim-david - [`8eca4f4`](https://github.com/eea/volto-eea-website-theme/commit/8eca4f40397a4aeca6d39029c92db78968d37064)]
1279
1284
  - Added keyContent component to theme.config [ichim-david - [`d86f202`](https://github.com/eea/volto-eea-website-theme/commit/d86f202d0274d839487a88b51cae9a0e899beb23)]
@@ -1315,5 +1320,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1315
1320
 
1316
1321
  #### :hammer_and_wrench: Others
1317
1322
 
1318
- - yarn bootstrap [Alin Voinea - [`6995e9e`](https://github.com/eea/volto-eea-website-theme/commit/6995e9e091f21fdbbdffa8a44fc0e2c626f6d46a)]
1319
1323
  - Initial commit [Alin Voinea - [`6a9c03a`](https://github.com/eea/volto-eea-website-theme/commit/6a9c03a7cebe71ca87e82cf58c42904063e9d8d3)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "2.2.2",
3
+ "version": "2.4.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",
@@ -14,6 +14,7 @@
14
14
  "react"
15
15
  ],
16
16
  "addons": [
17
+ "@eeacms/volto-block-toc",
17
18
  "@eeacms/volto-group-block",
18
19
  "@eeacms/volto-eea-design-system",
19
20
  "volto-subsites"
@@ -23,6 +24,7 @@
23
24
  "url": "git@github.com:eea/volto-eea-website-theme.git"
24
25
  },
25
26
  "dependencies": {
27
+ "@eeacms/volto-block-toc": "*",
26
28
  "@eeacms/volto-block-style": "*",
27
29
  "@eeacms/volto-eea-design-system": "*",
28
30
  "@eeacms/volto-group-block": "*",
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { EditSchema } from './schema';
3
+ import { SidebarPortal } from '@plone/volto/components';
4
+ import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
5
+
6
+ import ContextNavigationView from './ContextNavigationView';
7
+
8
+ const ContextNavigationFillEdit = (props) => {
9
+ const contentTypes = props.properties?.['@components']?.types;
10
+ const availableTypes = React.useMemo(
11
+ () => contentTypes?.map((type) => [type.id, type.title || type.name]),
12
+ [contentTypes],
13
+ );
14
+
15
+ const schema = React.useMemo(
16
+ () => EditSchema({ availableTypes }),
17
+ [availableTypes],
18
+ );
19
+
20
+ return (
21
+ <>
22
+ <h3>Context navigation</h3>
23
+ <ContextNavigationView {...props} mode="edit" />{' '}
24
+ <SidebarPortal selected={props.selected}>
25
+ <BlockDataForm
26
+ schema={schema}
27
+ title={schema.title}
28
+ onChangeField={(id, value) => {
29
+ props.onChangeBlock(props.block, {
30
+ ...props.data,
31
+ [id]: value,
32
+ });
33
+ }}
34
+ onChangeBlock={props.onChangeBlock}
35
+ formData={props.data}
36
+ block={props.block}
37
+ navRoot={props.navRoot}
38
+ contentType={props.contentType}
39
+ />
40
+ </SidebarPortal>
41
+ </>
42
+ );
43
+ };
44
+
45
+ export default ContextNavigationFillEdit;
@@ -0,0 +1,88 @@
1
+ import React from 'react';
2
+ import { render, fireEvent } from '@testing-library/react';
3
+ import ContextNavigationEdit from './ContextNavigationEdit';
4
+ import { Router } from 'react-router-dom';
5
+ import { Provider } from 'react-intl-redux';
6
+ import configureStore from 'redux-mock-store';
7
+ import { createMemoryHistory } from 'history';
8
+ import '@testing-library/jest-dom/extend-expect';
9
+
10
+ jest.mock('@plone/volto/components', () => ({
11
+ InlineForm: ({ onChangeField }) => (
12
+ <div>
13
+ <p>InlineForm</p>
14
+ <input id="test" onChange={onChangeField} />
15
+ </div>
16
+ ),
17
+ SidebarPortal: ({ children, selected }) =>
18
+ selected ? (
19
+ <div>
20
+ <div>SidebarPortal</div>
21
+ {children}
22
+ </div>
23
+ ) : null,
24
+ }));
25
+
26
+ jest.mock('@plone/volto/components/theme/Navigation/ContextNavigation', () => {
27
+ return {
28
+ __esModule: true,
29
+ default: ({ params }) => {
30
+ return <div>ConnectedContextNavigation {params.root_path}</div>;
31
+ },
32
+ };
33
+ });
34
+
35
+ jest.mock('@plone/volto/helpers', () => ({
36
+ withBlockExtensions: jest.fn((Component) => Component),
37
+ emptyBlocksForm: jest.fn(),
38
+ getBlocksLayoutFieldname: () => 'blocks_layout',
39
+ withVariationSchemaEnhancer: jest.fn((Component) => Component),
40
+ }));
41
+
42
+ const mockStore = configureStore();
43
+ const store = mockStore({
44
+ intl: {
45
+ locale: 'en',
46
+ messages: {},
47
+ },
48
+ });
49
+
50
+ describe('ContextNavigationEdit', () => {
51
+ it('renders corectly', () => {
52
+ const history = createMemoryHistory();
53
+ const { getByText, queryByText } = render(
54
+ <Provider store={store}>
55
+ <Router history={history}>
56
+ <ContextNavigationEdit selected={false} />
57
+ </Router>
58
+ ,
59
+ </Provider>,
60
+ );
61
+
62
+ expect(getByText('Context navigation')).toBeInTheDocument();
63
+ expect(getByText('ConnectedContextNavigation')).toBeInTheDocument();
64
+ expect(queryByText('InlineForm')).toBeNull();
65
+ expect(queryByText('SidebarPortal')).toBeNull();
66
+ });
67
+
68
+ it('renders corectly', () => {
69
+ const history = createMemoryHistory();
70
+ const { container, getByText } = render(
71
+ <Provider store={store}>
72
+ <Router history={history}>
73
+ <ContextNavigationEdit selected={true} onChangeBlock={() => {}} />
74
+ </Router>
75
+ ,
76
+ </Provider>,
77
+ );
78
+
79
+ expect(getByText('Context navigation')).toBeInTheDocument();
80
+ expect(getByText('ConnectedContextNavigation')).toBeInTheDocument();
81
+ expect(getByText('InlineForm')).toBeInTheDocument();
82
+ expect(getByText('SidebarPortal')).toBeInTheDocument();
83
+
84
+ fireEvent.change(container.querySelector('#test'), {
85
+ target: { value: 'test' },
86
+ });
87
+ });
88
+ });
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { flattenToAppURL, withBlockExtensions } from '@plone/volto/helpers';
3
+ import DefaultTemplate from './variations/Default';
4
+
5
+ const ContextNavigationView = (props = {}) => {
6
+ const { variation, data = {} } = props;
7
+ const navProps = { ...data };
8
+ const root_path = data?.root_node?.[0]?.['@id'];
9
+ if (root_path) navProps['root_path'] = flattenToAppURL(root_path);
10
+ const Renderer = variation?.view ?? DefaultTemplate;
11
+ return <Renderer params={navProps} mode={props.mode} />;
12
+ };
13
+
14
+ export default withBlockExtensions(ContextNavigationView);
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import ContextNavigationView from './ContextNavigationView';
4
+ import { Router } from 'react-router-dom';
5
+ import { Provider } from 'react-intl-redux';
6
+ import configureStore from 'redux-mock-store';
7
+ import { createMemoryHistory } from 'history';
8
+ import '@testing-library/jest-dom/extend-expect';
9
+
10
+ jest.mock('@plone/volto/components/theme/Navigation/ContextNavigation', () => {
11
+ return {
12
+ __esModule: true,
13
+ default: ({ params }) => {
14
+ return <div>ConnectedContextNavigation {params.root_path}</div>;
15
+ },
16
+ };
17
+ });
18
+
19
+ jest.mock('@plone/volto/helpers', () => ({
20
+ withBlockExtensions: jest.fn((Component) => Component),
21
+ emptyBlocksForm: jest.fn(),
22
+ getBlocksLayoutFieldname: () => 'blocks_layout',
23
+ flattenToAppURL: () => '',
24
+ }));
25
+
26
+ const mockStore = configureStore();
27
+ const store = mockStore({
28
+ intl: {
29
+ locale: 'en',
30
+ messages: {},
31
+ },
32
+ });
33
+
34
+ describe('ContextNavigationView', () => {
35
+ let history;
36
+ beforeEach(() => {
37
+ history = createMemoryHistory();
38
+ });
39
+
40
+ it('renders corectly', () => {
41
+ const { container } = render(
42
+ <Provider store={store}>
43
+ <Router history={history}>
44
+ <ContextNavigationView />
45
+ </Router>
46
+ </Provider>,
47
+ );
48
+
49
+ expect(container.firstChild).toHaveTextContent(
50
+ 'ConnectedContextNavigation',
51
+ );
52
+ });
53
+
54
+ it('renders corectly', () => {
55
+ const { container } = render(
56
+ <Provider store={store}>
57
+ <Router history={history}>
58
+ <ContextNavigationView
59
+ data={{
60
+ navProps: { root_path: 'https://localhost:3000/test' },
61
+ root_node: [{ '@id': 'root_node' }],
62
+ }}
63
+ />
64
+ </Router>
65
+ </Provider>,
66
+ );
67
+ expect(container.firstChild).toHaveTextContent(
68
+ 'ConnectedContextNavigation',
69
+ );
70
+ });
71
+ });
@@ -0,0 +1,30 @@
1
+ import codeSVG from '@plone/volto/icons/code.svg';
2
+ import ContextNavigationEdit from './ContextNavigationEdit';
3
+ import ContextNavigationView from './ContextNavigationView';
4
+ import BlockSettingsSchema from '@plone/volto/components/manage/Blocks/Block/Schema';
5
+ import variations from './variations';
6
+
7
+ const applyConfig = (config) => {
8
+ config.blocks.blocksConfig.contextNavigation = {
9
+ id: 'contextNavigation',
10
+ title: 'Navigation',
11
+ icon: codeSVG,
12
+ group: 'common',
13
+ view: ContextNavigationView,
14
+ edit: ContextNavigationEdit,
15
+ schema: BlockSettingsSchema,
16
+ restricted: false,
17
+ variations,
18
+ mostUsed: false,
19
+ blockHasOwnFocusManagement: true,
20
+ sidebarTab: 1,
21
+ security: {
22
+ addPermission: [],
23
+ view: [],
24
+ },
25
+ };
26
+
27
+ return config;
28
+ };
29
+
30
+ export default applyConfig;
@@ -0,0 +1,88 @@
1
+ export const EditSchema = ({ availableTypes }) => {
2
+ return {
3
+ title: 'Navigation',
4
+ fieldsets: [
5
+ {
6
+ id: 'default',
7
+ title: 'Default',
8
+ fields: [
9
+ 'name',
10
+ 'root_node',
11
+ 'portal_type',
12
+ 'includeTop',
13
+ 'currentFolderOnly',
14
+ 'topLevel',
15
+ 'bottomLevel',
16
+ 'no_icons',
17
+ 'thumb_scale',
18
+ 'no_thumbs',
19
+ ],
20
+ },
21
+ ],
22
+ required: [],
23
+ properties: {
24
+ name: {
25
+ title: 'Title',
26
+ description: 'The title of the navigation tree',
27
+ },
28
+ root_node: {
29
+ title: 'Root node',
30
+ description:
31
+ 'You may search for and choose a folder to act as the root of the navigation tree. Leave blank to use the Plone site root.',
32
+ widget: 'object_browser',
33
+ // TODO: these don't work. Why?
34
+ mode: 'link',
35
+ selectedItemAttrs: ['Title', 'Description'],
36
+ },
37
+ portal_type: {
38
+ title: 'Filter children',
39
+ description: 'Only show child items of this content type',
40
+ choices: availableTypes,
41
+ isMulti: true,
42
+ },
43
+ includeTop: {
44
+ title: 'Include top node',
45
+ description:
46
+ "Whether or not to show the top, or 'root', node in the navigation tree. This is affected by the 'Start level' setting.",
47
+ type: 'boolean',
48
+ },
49
+ currentFolderOnly: {
50
+ title: 'Only show the contents of the current folder',
51
+ description:
52
+ 'If selected, the navigation tree will only show the current folder and its children at all times.',
53
+ type: 'boolean',
54
+ },
55
+
56
+ topLevel: {
57
+ title: 'Start level',
58
+ description:
59
+ 'An integer value that specifies the number of folder levels below the site root that must be exceeded before the navigation tree will display. 0 means that the navigation tree should be displayed everywhere including pages in the root of the site. 1 means the tree only shows up inside folders located in the root and downwards, never showing at the top level.',
60
+ type: 'number',
61
+ default: 1,
62
+ },
63
+ bottomLevel: {
64
+ title: 'Navigation tree depth',
65
+ description:
66
+ 'How many folders should be included before the navigation tree stops. 0 means no limit. 1 only includes the root folder.',
67
+ type: 'number',
68
+ default: 0,
69
+ },
70
+ no_icons: {
71
+ title: 'Suppress icons',
72
+ description:
73
+ 'If enabled, the portlet will not show document type icons.',
74
+ type: 'boolean',
75
+ },
76
+ thumb_scale: {
77
+ title: 'Override thumb scale',
78
+ description:
79
+ "Enter a valid scale name (see 'Image Handling' control panel) to override (e.g. icon, tile, thumb, mini, preview, ... ). Leave empty to use default (see 'Site' control panel).",
80
+ },
81
+ no_thumbs: {
82
+ title: 'Suppress thumbs',
83
+ type: 'boolean',
84
+ description: 'If enabled, the portlet will not show thumbs.',
85
+ },
86
+ },
87
+ };
88
+ };