@eeacms/volto-clms-theme 1.0.66 → 1.0.70

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 (108) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/jest-addon.config.js +1 -1
  3. package/package.json +3 -2
  4. package/src/actions/import_wms_layers/import_wms_layers.js +20 -0
  5. package/src/actions/import_wms_layers/import_wms_layers.test.js +15 -0
  6. package/src/actions/index.js +5 -0
  7. package/src/components/Blocks/CclButtonBlock/CclButtonBlockEdit.test.jsx +68 -16
  8. package/src/components/Blocks/CclCardBlock/CclCardBlockEdit.test.jsx +7 -8
  9. package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.jsx +1 -1
  10. package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.test.jsx +6 -6
  11. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/DoubleRangeFacet.jsx +74 -0
  12. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/FilterList.jsx +57 -0
  13. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/RightModalFacets.jsx +1 -2
  14. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/index.js +10 -1
  15. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/range.css +5 -0
  16. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/rewriteOptions.js +84 -0
  17. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalFaqTabsView.jsx +1 -1
  18. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/CclVerticalTabsView.jsx +1 -1
  19. package/src/components/Blocks/CustomTemplates/VoltoTabsBlock/RoutingHOC.jsx +1 -1
  20. package/src/components/Blocks/customBlocks.js +12 -0
  21. package/src/components/CLMSDatasetDetailView/BoundingBoxComponent.test.jsx +27 -0
  22. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.jsx +119 -12
  23. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.test.jsx +111 -18
  24. package/src/components/CLMSDatasetDetailView/ContactComponent.test.jsx +34 -0
  25. package/src/components/CLMSDatasetDetailView/DataSetInfoContent.jsx +143 -88
  26. package/src/components/CLMSDatasetDetailView/DataSetInfoContent.test.jsx +7 -5
  27. package/src/components/CLMSDatasetDetailView/DistributionInfoComponent.test.jsx +24 -0
  28. package/src/components/CLMSDatasetDetailView/DownloadDataSetContent.test.jsx +80 -0
  29. package/src/components/CLMSDatasetDetailView/index.js +0 -1
  30. package/src/components/CLMSDownloadCartView/CLMSCartContent.jsx +14 -6
  31. package/src/components/CLMSDownloadCartView/CLMSCartContent.test.jsx +5 -0
  32. package/src/components/CLMSDownloadCartView/CLMSDownloadCartView.test.jsx +5 -0
  33. package/src/components/CLMSDownloadCartView/cartUtils.test.js +5 -0
  34. package/src/components/CLMSDownloadCartView/conversion.test.js +5 -0
  35. package/src/components/CLMSDownloadableFileView/CLMSDownloadableFile.test.jsx +5 -0
  36. package/src/components/CLMSDownloadsView/CLMSDownloadTasks.test.jsx +5 -0
  37. package/src/components/CLMSDownloadsView/CLMSDownloadsView.test.jsx +5 -0
  38. package/src/components/CLMSDownloadsView/FileCard.test.jsx +5 -0
  39. package/src/components/CLMSMapViewerView/CLMSMapViewerView.test.jsx +5 -0
  40. package/src/components/CLMSMeetingView/CLMSMeetingEmailView.test.jsx +5 -0
  41. package/src/components/CLMSMeetingView/CLMSMeetingEmailsView.test.jsx +5 -0
  42. package/src/components/CLMSMeetingView/CLMSMeetingSubscriberVew.test.jsx +5 -0
  43. package/src/components/CLMSMeetingView/CLMSMeetingSubscriberView.test.jsx +5 -0
  44. package/src/components/CLMSMeetingView/CLMSMeetingSubscribersView.test.jsx +5 -0
  45. package/src/components/CLMSProfileView/CLMSApiTokensView.test.jsx +5 -0
  46. package/src/components/CLMSProfileView/CLMSNewsletterSubscriberView.test.jsx +5 -0
  47. package/src/components/CLMSProfileView/CLMSProfileView.test.jsx +5 -0
  48. package/src/components/CLMSProfileView/CLMSUserProfileView.test.jsx +5 -0
  49. package/src/components/CLMSSubscriptionView/ConfirmSubscriptionView.test.jsx +5 -0
  50. package/src/components/CLMSSubscriptionView/SubscriptionView.test.jsx +5 -0
  51. package/src/components/CLMSSubscriptionView/subscription_utils.test.js +5 -0
  52. package/src/components/CclCard/CclCard.jsx +26 -8
  53. package/src/components/CclCard/CclCard.test.jsx +1 -0
  54. package/src/components/CclCard/cards.less +2 -2
  55. package/src/components/CclDownloadTable/CclDownloadTable.jsx +160 -17
  56. package/src/components/CclDownloadTable/CclDownloadTable.test.jsx +5 -0
  57. package/src/components/CclDownloadTable/modkData.test.js +5 -0
  58. package/src/components/CclExpandableFilter/CclExpandableFilter.test.jsx +5 -6
  59. package/src/components/CclFiltersModal/CclFiltersModal.test.jsx +5 -0
  60. package/src/components/CclFooterColumn/CclFooterColumn.test.jsx +5 -0
  61. package/src/components/CclLanguageSelector/CclLanguageSelector.test.jsx +8 -9
  62. package/src/components/CclLoginModal/CclLoginModal.test.jsx +5 -0
  63. package/src/components/CclModal/CclModal.test.js +4 -4
  64. package/src/components/CclTab/CclTab.jsx +8 -3
  65. package/src/components/CclTab/CclTab.test.jsx +5 -4
  66. package/src/components/CclTab/CclTabs.jsx +10 -11
  67. package/src/components/CclTab/CclTabs.test.jsx +5 -0
  68. package/src/components/CclTopMainMenu/CclFooterMenu.test.jsx +5 -0
  69. package/src/components/CclTopMainMenu/CclTopMainMenu.test.jsx +5 -0
  70. package/src/components/CclTopMainMenu/multilingualPath.test.js +5 -0
  71. package/src/components/CclUtils/StringToHTML.test.jsx +5 -0
  72. package/src/components/Widgets/BoundingWidget.test.jsx +5 -0
  73. package/src/components/Widgets/ContactWidget.test.jsx +5 -0
  74. package/src/components/Widgets/DistributionInfoWidget.test.jsx +5 -0
  75. package/src/components/Widgets/DownloadableFilesWidget.test.jsx +5 -0
  76. package/src/components/Widgets/GeonetworkIdentifiersWidget.test.jsx +5 -0
  77. package/src/components/Widgets/MapLayersWidget.test.jsx +5 -0
  78. package/src/components/Widgets/TextLinkWidget.test.jsx +5 -0
  79. package/src/customizations/volto/components/manage/Toolbar/Toolbar.test.jsx +5 -0
  80. package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.test.jsx +5 -0
  81. package/src/customizations/volto/components/theme/Footer/Footer.test.jsx +5 -0
  82. package/src/customizations/volto/components/theme/Header/Header.test.jsx +5 -0
  83. package/src/customizations/volto/components/theme/Logo/Logo.test.jsx +5 -0
  84. package/src/customizations/volto/components/theme/Logout/Logout.test.jsx +5 -0
  85. package/src/customizations/volto/components/theme/Navigation/ContextNavigation.test.jsx +5 -0
  86. package/src/customizations/volto/components/theme/Navigation/Navigation.test.jsx +5 -0
  87. package/src/customizations/volto/components/theme/SearchWidget/SearchWidget.jsx +2 -2
  88. package/src/customizations/volto/components/theme/SearchWidget/SerachWidget.test.jsx +5 -0
  89. package/src/reducers/datasets_by_uid/datasets_by_uid.test.js +8 -9
  90. package/src/reducers/downloadtool/downloadtool_reducer.test.js +340 -0
  91. package/src/reducers/downloadtool/nutsnames_reducer.test.js +61 -0
  92. package/src/reducers/extra_breadcrumbs/extra_breadcrumb_reducer.test.js +4 -8
  93. package/src/reducers/geonetwork/import_geonetwork_reducer.test.js +1 -1
  94. package/src/reducers/import_wms_layers/import_wms_layers.test.js +60 -0
  95. package/src/reducers/import_wms_layers/import_wms_layers_reducer.js +44 -0
  96. package/src/reducers/index.js +2 -0
  97. package/src/reducers/meeting/meeting_register_reducer.test.js +82 -0
  98. package/src/reducers/meeting/meeting_subscribers_reducer.test.js +149 -0
  99. package/src/reducers/newsletter/get_newsletter_reducer.test.js +1 -1
  100. package/src/reducers/registry/registry.test.js +1 -1
  101. package/src/reducers/subscription/subscription_reducer.test.js +13 -2
  102. package/src/reducers/tokens/tokens.test.js +1 -1
  103. package/src/reducers/userschema/userschema.test.js +63 -0
  104. package/theme/clms/css/header.css +7 -0
  105. package/theme/clms/css/maps.css +9 -1
  106. package/theme/clms/css/maps.less +11 -1
  107. package/theme/clms/css/ownstyles.less +1 -1
  108. package/src/components/CLMSDatasetDetailView/MetadataContent.jsx +0 -256
package/CHANGELOG.md CHANGED
@@ -4,8 +4,66 @@ 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.70](https://github.com/eea/volto-clms-theme/compare/1.0.69...1.0.70)
8
+
9
+ - test [`030fee9`](https://github.com/eea/volto-clms-theme/commit/030fee91c17a03a5a3449500af23429d47c2b168)
10
+ - gemet inspire themes label renaming [`669643a`](https://github.com/eea/volto-clms-theme/commit/669643a41d16c84c044b564047fee161a10a1e80)
11
+ - fix te3st [`5b49612`](https://github.com/eea/volto-clms-theme/commit/5b49612b558765f326f14aaae8b195e21d02c461)
12
+ - fix test [`a0fade3`](https://github.com/eea/volto-clms-theme/commit/a0fade3fa8dfb9bcce669b73e6181d9fe32af1b8)
13
+ - fix routing on vertical tabs with search filters [`d5515a1`](https://github.com/eea/volto-clms-theme/commit/d5515a163fee044405070848b9b65c27b3cab34c)
14
+ - search widget modification [`79fd282`](https://github.com/eea/volto-clms-theme/commit/79fd282cd4daf6bfc3f974ce28e89b6aa69106b8)
15
+ - test [`0f4654a`](https://github.com/eea/volto-clms-theme/commit/0f4654a1b5b2b6c27cc403f4a4e15c447ce5e2df)
16
+ - test [`2797b10`](https://github.com/eea/volto-clms-theme/commit/2797b10c42dca21f31b898de8b4483d5f3bf39c3)
17
+ - test [`e0a1f29`](https://github.com/eea/volto-clms-theme/commit/e0a1f296b29abdb4aad93517171fc4f14218a6f0)
18
+ - test [`8bd1316`](https://github.com/eea/volto-clms-theme/commit/8bd1316153da80952c2db8188dd71bd10d0466eb)
19
+
20
+ #### [1.0.69](https://github.com/eea/volto-clms-theme/compare/1.0.68...1.0.69)
21
+
22
+ > 17 February 2022
23
+
24
+ - Develop [`#206`](https://github.com/eea/volto-clms-theme/pull/206)
25
+ - new set of action and reducers to import WMS layers from a new endpoint [`#204`](https://github.com/eea/volto-clms-theme/pull/204)
26
+ - Bugs n improvements [`#205`](https://github.com/eea/volto-clms-theme/pull/205)
27
+ - add react-input-range to transformIgnorePatterns [`e3c704d`](https://github.com/eea/volto-clms-theme/commit/e3c704d4e0569d55b1c5cf50a3bf3191452aea38)
28
+ - global search variation [`3599a89`](https://github.com/eea/volto-clms-theme/commit/3599a897c1cdbdb39041144d0b6610bb1debbe5a)
29
+ - prettier [`bc6f853`](https://github.com/eea/volto-clms-theme/commit/bc6f85356460b5e03f3bbda134318adc5950d30f)
30
+ - fix tests [`09cd0b9`](https://github.com/eea/volto-clms-theme/commit/09cd0b99706492f2a24e79ed6f280fe6e023e084)
31
+ - Map styles [`ed902d4`](https://github.com/eea/volto-clms-theme/commit/ed902d49b46341ebdc1d12ceb6a1ca49129a4cd7)
32
+ - elvis [`09886c4`](https://github.com/eea/volto-clms-theme/commit/09886c40b1cab893cc94aaed3ded237aadf1171b)
33
+ - fix test [`50c0e5a`](https://github.com/eea/volto-clms-theme/commit/50c0e5a4231833596ae738ef6a4d76f63eaf5c22)
34
+ - fix test [`1d2669f`](https://github.com/eea/volto-clms-theme/commit/1d2669ffb71c33ae692b4023a85ce4c6a76c0cec)
35
+ - double range facet for temporal extent filter [`118e622`](https://github.com/eea/volto-clms-theme/commit/118e622eca2486893e5993bfd89f1024a922a184)
36
+ - Header responsive [`872534f`](https://github.com/eea/volto-clms-theme/commit/872534fd9bf616447b60c4a87fe62e544cafdc1b)
37
+ - News/Event line color [`e144da8`](https://github.com/eea/volto-clms-theme/commit/e144da8845dece2098312af1fdcfa4901bbaeabe)
38
+
39
+ #### [1.0.68](https://github.com/eea/volto-clms-theme/compare/1.0.67...1.0.68)
40
+
41
+ > 14 February 2022
42
+
43
+ - Develop [`#203`](https://github.com/eea/volto-clms-theme/pull/203)
44
+ - fix underpanel [`d665279`](https://github.com/eea/volto-clms-theme/commit/d665279a8b2fefc450353af0121325c375d32cb5)
45
+ - Selected files information, option to clear selection and indeterminate checkbox at header [`b72f476`](https://github.com/eea/volto-clms-theme/commit/b72f476a2bd382fd2cce4ed8abc9134fb05ceb32)
46
+
47
+ #### [1.0.67](https://github.com/eea/volto-clms-theme/compare/1.0.66...1.0.67)
48
+
49
+ > 11 February 2022
50
+
51
+ - Downloadable files and some test improvements [`#202`](https://github.com/eea/volto-clms-theme/pull/202)
52
+ - code smells [`b07ed5d`](https://github.com/eea/volto-clms-theme/commit/b07ed5d8101981349d768e47553277d1f049eed5)
53
+ - small fix [`3fc4119`](https://github.com/eea/volto-clms-theme/commit/3fc4119394c6fc0782d41878e153bff79060605d)
54
+ - all initial test created [`240fc74`](https://github.com/eea/volto-clms-theme/commit/240fc74514051740098b026cc0ad834d3a3a1763)
55
+ - render loading component while libraries accordion is loading [`d7955ae`](https://github.com/eea/volto-clms-theme/commit/d7955aebabc3b969a7753a89e54e63f58799dd1e)
56
+ - fix test imports [`3c61991`](https://github.com/eea/volto-clms-theme/commit/3c61991b8559c508ec009d2a4ebdc8bdb704a985)
57
+ - hide searchbox when the results are less than 10 [`eedda03`](https://github.com/eea/volto-clms-theme/commit/eedda03b4d752f2c54714dbb97c624eba8332494)
58
+ - downloadable files modifications [`7bdf690`](https://github.com/eea/volto-clms-theme/commit/7bdf6909693640d33e4087281d49c8497cf65c02)
59
+ - downloadable files modifications [`16b86fd`](https://github.com/eea/volto-clms-theme/commit/16b86fd056cc2790335505f80fc67d37c674f260)
60
+ - redesign dataset view [`05b2688`](https://github.com/eea/volto-clms-theme/commit/05b2688d0d490c35fe65810e0a5497712948db24)
61
+
7
62
  #### [1.0.66](https://github.com/eea/volto-clms-theme/compare/1.0.65...1.0.66)
8
63
 
64
+ > 9 February 2022
65
+
66
+ - Add tests [`#201`](https://github.com/eea/volto-clms-theme/pull/201)
9
67
  - Setup testing [`#199`](https://github.com/eea/volto-clms-theme/pull/199)
10
68
  - Setup testing [`#200`](https://github.com/eea/volto-clms-theme/pull/200)
11
69
  - Bugs n improvements [`#198`](https://github.com/eea/volto-clms-theme/pull/198)
@@ -28,7 +28,7 @@ module.exports = {
28
28
  '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
29
29
  },
30
30
  transformIgnorePatterns: [
31
- 'node_modules/(?!(@eeacms/volto-clms-utils/|@plone/volto/|slick-carousel))',
31
+ 'node_modules/(?!(@eeacms/volto-clms-utils/|@plone/volto/|slick-carousel|react-input-range))',
32
32
  ],
33
33
  coverageThreshold: {
34
34
  global: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.66",
3
+ "version": "1.0.70",
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",
@@ -49,7 +49,8 @@
49
49
  "react-svg": "14.0.4",
50
50
  "slick-carousel": "1.8.1",
51
51
  "volto-dropdownmenu": "2.2.7",
52
- "volto-form-block": "2.2.2"
52
+ "volto-form-block": "2.2.2",
53
+ "react-input-range": "^1.3.0"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@cypress/code-coverage": "^3.9.5",
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Post meeting register actions.
3
+ * @module actions/postImportGeonetwork
4
+ */
5
+ export const POST_IMPORT_WMS_LAYERS = 'POST_IMPORT_WMS_LAYERS';
6
+
7
+ /**
8
+ * Post import geonetwork.
9
+ * @function postImportGeonetwork
10
+ * @returns {Object} Get extra items action.
11
+ */
12
+ export function postImportWMSLayers(url, id, type) {
13
+ return {
14
+ type: POST_IMPORT_WMS_LAYERS,
15
+ request: {
16
+ op: 'post',
17
+ path: `${url}/@import-wms-layers`,
18
+ },
19
+ };
20
+ }
@@ -0,0 +1,15 @@
1
+ import { postImportWMSLayers } from './import_wms_layers';
2
+ import { POST_IMPORT_WMS_LAYERS } from './import_wms_layers';
3
+
4
+ describe('Import geonetwork action', () => {
5
+ describe('postImportWMSLayers', () => {
6
+ it('should create an action to post geonetwork', () => {
7
+ const url = 'http://localhost';
8
+ const action = postImportWMSLayers(url);
9
+
10
+ expect(action.type).toEqual(POST_IMPORT_WMS_LAYERS);
11
+ expect(action.request.op).toEqual('post');
12
+ expect(action.request.path).toEqual(`${url}/@import-wms-layers`);
13
+ });
14
+ });
15
+ });
@@ -82,3 +82,8 @@ export {
82
82
  unsubscribeTo,
83
83
  confirmUnsubscribeTo,
84
84
  } from './subscription/post_subscription';
85
+
86
+ export {
87
+ POST_IMPORT_WMS_LAYERS,
88
+ postImportWMSLayers,
89
+ } from './import_wms_layers/import_wms_layers';
@@ -1,15 +1,12 @@
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 { MemoryRouter } from 'react-router-dom';
1
+ import Enzyme, { mount } from 'enzyme';
6
2
 
7
- import CclButtonBlockEdit from './CclButtonBlockEdit';
8
-
9
- import Enzyme from 'enzyme';
10
3
  import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
11
- // import { shallow } from 'enzyme';
12
- import { mount } from 'enzyme';
4
+ import CclButtonBlockEdit from './CclButtonBlockEdit';
5
+ import { MemoryRouter } from 'react-router-dom';
6
+ import { Provider } from 'react-intl-redux';
7
+ import React from 'react';
8
+ import configureStore from 'redux-mock-store';
9
+ import renderer from 'react-test-renderer';
13
10
 
14
11
  Enzyme.configure({ adapter: new Adapter() });
15
12
 
@@ -35,6 +32,7 @@ describe('CclButtonBlockEdit', () => {
35
32
  style: 'default',
36
33
  download: false,
37
34
  };
35
+
38
36
  // const component = shallow(
39
37
  const component = mount(
40
38
  <Provider store={store}>
@@ -43,8 +41,12 @@ describe('CclButtonBlockEdit', () => {
43
41
  data={data}
44
42
  selected={false}
45
43
  block="1234"
46
- onChangeBlock={() => {}}
47
- setSidebarTab={() => {}}
44
+ onChangeBlock={() => {
45
+ return 'test';
46
+ }}
47
+ setSidebarTab={() => {
48
+ return 'test';
49
+ }}
48
50
  />
49
51
  </MemoryRouter>
50
52
  </Provider>,
@@ -75,10 +77,18 @@ describe('CclButtonBlockEdit', () => {
75
77
  data={data}
76
78
  selected={false}
77
79
  block="1234"
78
- onChangeBlock={() => {}}
79
- onSelectBlock={() => {}}
80
- onChangeField={() => {}}
81
- setSidebarTab={() => {}}
80
+ onChangeBlock={() => {
81
+ return 'test';
82
+ }}
83
+ onSelectBlock={() => {
84
+ return 'test';
85
+ }}
86
+ onChangeField={() => {
87
+ return 'test';
88
+ }}
89
+ setSidebarTab={() => {
90
+ return 'test';
91
+ }}
82
92
  />
83
93
  </MemoryRouter>
84
94
  </Provider>,
@@ -87,4 +97,46 @@ describe('CclButtonBlockEdit', () => {
87
97
  const json = component.toJSON();
88
98
  expect(json).toMatchSnapshot();
89
99
  });
100
+ //jest test for CclButtonBlockEdit onChangeBlock statement
101
+ it('CclButtonBlockEdit onChangeBlock', () => {
102
+ const store = mockStore({
103
+ content: {
104
+ create: {},
105
+ data: {},
106
+ },
107
+ intl: {
108
+ locale: 'en',
109
+ messages: {},
110
+ },
111
+ });
112
+ const data = {
113
+ href: ['https://www.google.com', 'https://www.google.com'],
114
+ disabled: true,
115
+ };
116
+ const component = mount(
117
+ <Provider store={store}>
118
+ <MemoryRouter>
119
+ <CclButtonBlockEdit
120
+ data={data}
121
+ selected={false}
122
+ block="1234"
123
+ onChangeBlock={() => {
124
+ return 'test';
125
+ }}
126
+ onSelectBlock={() => {
127
+ return 'test';
128
+ }}
129
+ onChangeField={() => {
130
+ return 'test';
131
+ }}
132
+ setSidebarTab={() => {
133
+ return 'test';
134
+ }}
135
+ />
136
+ </MemoryRouter>
137
+ </Provider>,
138
+ );
139
+ const legend = component.find('.ccl-block-editor-header');
140
+ legend.simulate('click');
141
+ });
90
142
  });
@@ -1,15 +1,14 @@
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 { MemoryRouter } from 'react-router-dom';
1
+ import Enzyme, { mount } from 'enzyme';
6
2
 
3
+ import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
7
4
  import CclCardBlockEdit from './CclCardBlockEdit';
5
+ import { MemoryRouter } from 'react-router-dom';
6
+ import { Provider } from 'react-intl-redux';
7
+ import React from 'react';
8
+ import configureStore from 'redux-mock-store';
9
+ import renderer from 'react-test-renderer';
8
10
 
9
- import Enzyme from 'enzyme';
10
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
11
11
  // import { shallow } from 'enzyme';
12
- import { mount } from 'enzyme';
13
12
 
14
13
  Enzyme.configure({ adapter: new Adapter() });
15
14
 
@@ -25,7 +25,7 @@ const CclListingCards = (props) => {
25
25
  let containerClass = '';
26
26
  if (['news', 'event'].includes(variation)) {
27
27
  containerClass = 'ccl-container';
28
- } else if (!['line', 'doc'].includes(variation)) {
28
+ } else if (!['line', 'doc', 'globalSearch'].includes(variation)) {
29
29
  containerClass = 'card-container';
30
30
  }
31
31
  return (
@@ -1,12 +1,12 @@
1
- import CclListingCards from './CclListingCards';
2
- import React from 'react';
3
- import { MemoryRouter } from 'react-router-dom';
1
+ import Enzyme, { mount } from 'enzyme';
4
2
 
5
- import Enzyme from 'enzyme';
6
3
  import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
7
- import configureStore from 'redux-mock-store';
4
+ import CclListingCards from './CclListingCards';
5
+ import { MemoryRouter } from 'react-router-dom';
8
6
  import { Provider } from 'react-intl-redux';
9
- import { mount } from 'enzyme';
7
+ import React from 'react';
8
+ import configureStore from 'redux-mock-store';
9
+
10
10
  Enzyme.configure({ adapter: new Adapter() });
11
11
 
12
12
  const mockStore = configureStore();
@@ -0,0 +1,74 @@
1
+ import { Segment } from 'semantic-ui-react';
2
+ import React, { useState } from 'react';
3
+ import InputRange from 'react-input-range';
4
+ import 'react-input-range/lib/css/index.css';
5
+ import './range.css';
6
+
7
+ const DoubleRangeFacet = (props) => {
8
+ const { facet, choices, onChange, value } = props;
9
+ const facetValue = value;
10
+ var [open, setOpen] = React.useState(false);
11
+
12
+ const convertToRange = (values) => {
13
+ return {
14
+ min: Math.min.apply(
15
+ Math,
16
+ values.map(function (o) {
17
+ return o.value;
18
+ }),
19
+ ),
20
+ max: Math.max.apply(
21
+ Math,
22
+ values.map(function (o) {
23
+ return o.value;
24
+ }),
25
+ ),
26
+ };
27
+ };
28
+
29
+ const startingValues = convertToRange(choices);
30
+
31
+ const [rangeValues, setRangeValues] = useState(startingValues);
32
+
33
+ const onChangeRange = (rValue, onChange) => {
34
+ setRangeValues(rValue);
35
+ onChange(
36
+ facet.field.value,
37
+ [...Array(rValue.max - rValue.min + 1).keys()].map((i) =>
38
+ (i + rValue.min).toString(),
39
+ ),
40
+ );
41
+ };
42
+
43
+ return (
44
+ <fieldset className="ccl-fieldset">
45
+ <div
46
+ className="ccl-expandable__button"
47
+ aria-expanded={open}
48
+ onClick={() => setOpen(!open)}
49
+ onKeyDown={() => setOpen(!open)}
50
+ tabIndex={0}
51
+ role={'button'}
52
+ >
53
+ <legend className="ccl-form-legend">
54
+ {facet.title} {startingValues.min} - {startingValues.max}
55
+ </legend>
56
+ </div>
57
+ <div>
58
+ <Segment basic padded>
59
+ <InputRange
60
+ minValue={startingValues.min}
61
+ maxValue={startingValues.max}
62
+ value={
63
+ facetValue.length > 0 ? convertToRange(facetValue) : rangeValues
64
+ }
65
+ onChange={(value) => onChangeRange(value, onChange)}
66
+ />
67
+ </Segment>
68
+ <br />
69
+ </div>
70
+ </fieldset>
71
+ );
72
+ };
73
+
74
+ export default DoubleRangeFacet;
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { Button, Icon } from 'semantic-ui-react';
3
+ import { defineMessages, useIntl } from 'react-intl';
4
+
5
+ const messages = defineMessages({
6
+ currentFilters: {
7
+ id: 'Current filters applied',
8
+ defaultMessage: 'Current filters applied',
9
+ },
10
+ clearFilters: {
11
+ id: 'Clear filters',
12
+ defaultMessage: 'Clear filters',
13
+ },
14
+ });
15
+
16
+ const FilterList = (props) => {
17
+ const { facets, setFacets, isEditMode } = props;
18
+ const showFilterList = !Object.values(facets).every((facet) => !facet.length);
19
+
20
+ const currentFilters = Object.fromEntries(
21
+ Object.entries(facets).filter((v) => v[1] && v[0] !== 'SearchableText'),
22
+ );
23
+
24
+ const totalFilters = [].concat.apply([], Object.values(currentFilters))
25
+ .length;
26
+
27
+ const intl = useIntl();
28
+
29
+ return showFilterList && Object.keys(currentFilters).length ? (
30
+ <div className="accordion ui filter-listing">
31
+ <div
32
+ className="filter-list-header"
33
+ style={{ cursor: 'auto' }}
34
+ active={false}
35
+ >
36
+ <div className="filter-list-title">
37
+ {intl.formatMessage(messages.currentFilters)}: {totalFilters}
38
+ </div>
39
+ <Button
40
+ icon
41
+ basic
42
+ compact
43
+ size="small"
44
+ onClick={(e) => {
45
+ e.stopPropagation();
46
+ !isEditMode && setFacets({});
47
+ }}
48
+ >
49
+ <Icon name="trash" />
50
+ {intl.formatMessage(messages.clearFilters)}
51
+ </Button>
52
+ </div>
53
+ </div>
54
+ ) : null;
55
+ };
56
+
57
+ export default FilterList;
@@ -1,13 +1,13 @@
1
1
  import { Button, Grid, Segment } from 'semantic-ui-react';
2
2
  import {
3
3
  Facets,
4
- FilterList,
5
4
  SearchDetails,
6
5
  SearchInput,
7
6
  SortOn,
8
7
  } from '@plone/volto/components/manage/Blocks/Search/components';
9
8
  import { defineMessages, useIntl } from 'react-intl';
10
9
 
10
+ import FilterList from './FilterList';
11
11
  import CclFiltersModal from '@eeacms/volto-clms-theme/components/CclFiltersModal/CclFiltersModal';
12
12
  import { Icon } from '@plone/volto/components';
13
13
  import React from 'react';
@@ -59,7 +59,6 @@ const RightModalFacets = (props) => {
59
59
  const { showSearchButton } = data;
60
60
  const isLive = !showSearchButton;
61
61
  const intl = useIntl();
62
-
63
62
  return (
64
63
  <Grid className="searchBlock-facets right-column-facets" stackable>
65
64
  {data?.headline && (
@@ -1,5 +1,14 @@
1
+ import DoubleRangeFacet from './DoubleRangeFacet';
1
2
  import AccordionFacet from './AccordionFacet';
2
3
  import RightModalFacets from './RightModalFacets';
3
4
  import WithType from './WithType';
5
+ import rewriteOptions, { portal_types_labels } from './rewriteOptions';
4
6
 
5
- export { RightModalFacets, AccordionFacet, WithType };
7
+ export {
8
+ RightModalFacets,
9
+ AccordionFacet,
10
+ WithType,
11
+ DoubleRangeFacet,
12
+ rewriteOptions,
13
+ portal_types_labels,
14
+ };
@@ -0,0 +1,5 @@
1
+ .input-range__track--active,
2
+ .input-range__slider {
3
+ border: #a0b128;
4
+ background: #a0b128;
5
+ }
@@ -0,0 +1,84 @@
1
+ export const portal_types_labels = {
2
+ DataSet: 'Dataset',
3
+ Product: 'Product',
4
+ 'News Item': 'News',
5
+ 'eea.meeting': 'Event',
6
+ UseCase: 'Use case',
7
+ WorkOpportunity: 'Work opportunity',
8
+ Tender: 'Tender',
9
+ TechnicalLibrary: 'Product documentation',
10
+ };
11
+
12
+ export const category_labels = {
13
+ farming: 'Farming',
14
+ biota: 'Biota',
15
+ boundaries: 'Boundaries',
16
+ climatologyMeteorologyAtmosphere: 'Climatology / Meteorology / Atmosphere',
17
+ economy: 'Economy',
18
+ elevation: 'Elevation',
19
+ environment: 'Environment',
20
+ geoscientificInformation: 'Geoscientific Information',
21
+ health: 'Health',
22
+ imageryBaseMapsEarthCover: 'Imagery / Base Maps / Earth Cover',
23
+ intelligenceMilitary: 'Intelligence / Military',
24
+ inlandWaters: 'InlandWaters',
25
+ location: 'Location',
26
+ oceans: 'Oceans',
27
+ planningCadastre: 'Planning Cadastre',
28
+ society: 'Society',
29
+ structure: 'Structure',
30
+ transportation: 'Transportation',
31
+ utilitiesCommunication: 'Utilities / Communication',
32
+ };
33
+
34
+ const rewriteOptions = (name, choices) => {
35
+ var result = choices;
36
+ if (name === 'review_state') {
37
+ result = choices.map((opt) => ({
38
+ ...opt,
39
+ label: opt.label.replace(/\[.+\]/, '').trim(),
40
+ }));
41
+ }
42
+ const portal_types = [
43
+ 'DataSet',
44
+ 'Product',
45
+ 'News Item',
46
+ 'eea.meeting',
47
+ 'UseCase',
48
+ 'WorkOpportunity',
49
+ 'Tender',
50
+ 'TechnicalLibrary',
51
+ ];
52
+ if (name === 'portal_type') {
53
+ result = choices
54
+ .filter((opt) => portal_types.includes(opt.value))
55
+ .map((opt) => {
56
+ return { ...opt, label: portal_types_labels[opt.value] };
57
+ })
58
+ .sort((a, b) => {
59
+ if (a.label < b.label) {
60
+ return -1;
61
+ } else if (a.label > b.label) {
62
+ return 1;
63
+ }
64
+ return 0;
65
+ });
66
+ }
67
+ if (name === 'classificationTopicCategory') {
68
+ result = choices
69
+ .map((opt) => {
70
+ return { ...opt, label: category_labels[opt.value] };
71
+ })
72
+ .sort((a, b) => {
73
+ if (a.label < b.label) {
74
+ return -1;
75
+ } else if (a.label > b.label) {
76
+ return 1;
77
+ }
78
+ return 0;
79
+ });
80
+ }
81
+ return result;
82
+ };
83
+
84
+ export default rewriteOptions;
@@ -61,7 +61,7 @@ const CclVerticalFaqTabsView = (props) => {
61
61
  className={cx('card', tab === activeTab && 'active')}
62
62
  >
63
63
  <NavLink
64
- to={'#tab' + tabIndex}
64
+ to={'#tab=' + tabIndex}
65
65
  className="collapsed"
66
66
  onClick={(e) => {
67
67
  handleActive(activeTab, tab, setActiveTab);
@@ -80,7 +80,7 @@ const CclVerticalTabsView = (props) => {
80
80
  <span>{title || defaultTitle}</span>
81
81
  ) : (
82
82
  <NavLink
83
- to={'#tab' + tabIndex}
83
+ to={'#tab=' + tabIndex}
84
84
  className="collapsed"
85
85
  onClick={(e) => {
86
86
  handleClick(e, tab, activeTab, setActiveTab);
@@ -16,7 +16,7 @@ const RoutingHOC = (TabView) =>
16
16
  ) {
17
17
  return rTabsList[0];
18
18
  }
19
- return rTabsList[window.location.hash.substring(4) - 1];
19
+ return rTabsList[window.location.hash.match(/.*&?#?tab=(.*)/)[1] - 1];
20
20
  }
21
21
  React.useEffect(() => {
22
22
  const isReload =
@@ -2,6 +2,8 @@ import {
2
2
  AccordionFacet,
3
3
  RightModalFacets,
4
4
  WithType,
5
+ DoubleRangeFacet,
6
+ rewriteOptions,
5
7
  } from '@eeacms/volto-clms-theme/components/Blocks/CustomTemplates/VoltoSearchBlock';
6
8
  import {
7
9
  CclCarouselView,
@@ -118,6 +120,7 @@ const availableVariations = [
118
120
  'CloseTenders',
119
121
  true,
120
122
  ),
123
+ listingVariation('CclGlobalSearch', false, 'Global search', 'globalSearch'),
121
124
  ];
122
125
 
123
126
  const customBlocks = (config) => ({
@@ -310,6 +313,9 @@ const customBlocks = (config) => ({
310
313
  ...config.blocks.blocksConfig.search.extensions,
311
314
  facetWidgets: {
312
315
  ...config.blocks.blocksConfig.search.extensions.facetWidgets,
316
+ rewriteOptions: (name, choices) => {
317
+ return rewriteOptions(name, choices);
318
+ },
313
319
  types: [
314
320
  {
315
321
  id: 'accordionCheckboxFacet',
@@ -323,6 +329,12 @@ const customBlocks = (config) => ({
323
329
  view: WithType(AccordionFacet, 'label'),
324
330
  isDefault: false,
325
331
  },
332
+ {
333
+ id: 'doubleRangeFacet',
334
+ title: 'Double Range',
335
+ view: DoubleRangeFacet,
336
+ isDefault: false,
337
+ },
326
338
  ...config.blocks.blocksConfig.search.extensions.facetWidgets.types,
327
339
  ],
328
340
  },