@eeacms/volto-cca-policy 0.2.22 → 0.2.24

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 (52) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/locales/bg/LC_MESSAGES/volto.po +3461 -0
  3. package/locales/cs/LC_MESSAGES/volto.po +3428 -0
  4. package/locales/de/LC_MESSAGES/volto.po +251 -846
  5. package/locales/eea.climateadapt.frontpage.pot +0 -505
  6. package/locales/eea.climateadapt.observatory.frontpage.pot +0 -136
  7. package/locales/eea.climateadapt.pot +0 -112
  8. package/locales/en/LC_MESSAGES/volto.po +253 -848
  9. package/locales/es/LC_MESSAGES/volto.po +251 -846
  10. package/locales/et/LC_MESSAGES/volto.po +3421 -0
  11. package/locales/fi/LC_MESSAGES/volto.po +3445 -0
  12. package/locales/fr/LC_MESSAGES/volto.po +251 -846
  13. package/locales/ga/LC_MESSAGES/volto.po +3467 -0
  14. package/locales/hr/LC_MESSAGES/volto.po +3425 -0
  15. package/locales/hu/LC_MESSAGES/volto.po +3472 -0
  16. package/locales/it/LC_MESSAGES/volto.po +251 -846
  17. package/locales/lt/LC_MESSAGES/volto.po +3433 -0
  18. package/locales/nl/LC_MESSAGES/volto.po +3460 -0
  19. package/locales/pl/LC_MESSAGES/volto.po +251 -846
  20. package/locales/pt/LC_MESSAGES/volto.po +3447 -0
  21. package/locales/ro/LC_MESSAGES/volto.po +1119 -1545
  22. package/locales/sl/LC_MESSAGES/volto.po +3438 -0
  23. package/locales/tmx/Readme.md +24 -0
  24. package/locales/tmx/data/volto_BG.tmx +7091 -0
  25. package/locales/tmx/data/volto_CS.tmx +7091 -0
  26. package/locales/tmx/data/volto_ET.tmx +7091 -0
  27. package/locales/tmx/data/volto_FI.tmx +7091 -0
  28. package/locales/tmx/data/volto_GA.tmx +7091 -0
  29. package/locales/tmx/data/volto_HR.tmx +7091 -0
  30. package/locales/tmx/data/volto_HU.tmx +7091 -0
  31. package/locales/tmx/data/volto_LT.tmx +7091 -0
  32. package/locales/tmx/data/volto_NL.tmx +7091 -0
  33. package/locales/tmx/data/volto_PT.tmx +7091 -0
  34. package/locales/tmx/data/volto_RO.tmx +7091 -0
  35. package/locales/tmx/data/volto_SL.tmx +7091 -0
  36. package/locales/tmx/run.py +61 -0
  37. package/locales/volto.pot +75 -1
  38. package/package.json +9 -16
  39. package/src/components/manage/Blocks/ContentLinks/ContentLinksView.jsx +25 -8
  40. package/src/components/manage/Blocks/ContentLinks/ContentLinksView.test.jsx +20 -1
  41. package/src/components/manage/Blocks/ContentLinks/DropdownListView.jsx +48 -0
  42. package/src/components/manage/Blocks/ContentLinks/index.js +14 -0
  43. package/src/components/manage/Blocks/ContentLinks/style.less +18 -0
  44. package/src/components/manage/Blocks/CountryMapProfile/OLView.jsx +3 -3
  45. package/src/components/manage/Blocks/CountryMapProfile/styles.less +15 -1
  46. package/src/components/manage/Blocks/Listing/DropdownListingView.jsx +49 -0
  47. package/src/components/manage/Blocks/Listing/index.js +15 -0
  48. package/src/components/manage/Blocks/Listing/styles.less +18 -0
  49. package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentView.jsx +21 -41
  50. package/src/search/index.js +12 -16
  51. package/src/search/mission_funding/config-funding.js +44 -0
  52. package/src/search/mission_funding/facets-funding.js +28 -0
@@ -0,0 +1,61 @@
1
+ import xml.etree.ElementTree as ET
2
+ import json
3
+ import polib
4
+ import os
5
+ import shutil
6
+
7
+ currentPath = os.getcwd()
8
+
9
+ path = currentPath + "/data/"
10
+ tmxFiles = os.listdir(path)
11
+ tmxFiles = list(filter(lambda x: '.tmx' in x, tmxFiles))
12
+ print(tmxFiles)
13
+
14
+
15
+ poPath = currentPath+'/..'
16
+
17
+ def getData(fileName):
18
+ tree = ET.parse('./data/'+fileName)
19
+ root = tree.getroot()
20
+ response = {'language':[], 'data':{}}
21
+ for body in root.findall("body"):
22
+ for tu in body.findall("tu"):
23
+ temp = {}
24
+ for tuv in tu.findall("tuv"):
25
+ attributes = tuv.attrib
26
+ first_key = list(attributes)[0]
27
+ language = attributes[first_key][0:2]
28
+ key = tuv.find("seg").text
29
+ temp[language] = key
30
+ if language!='en' and language not in response['language']:
31
+ response['language'].append(language.lower())
32
+
33
+ en_key = temp['en']
34
+ del temp['en']
35
+ response['data'][en_key]=temp
36
+ return response
37
+
38
+
39
+ def translate(json, language):
40
+ if not os.path.isdir(poPath+'/'+language):
41
+ os.mkdir(poPath+'/'+language)
42
+ if not os.path.isdir(poPath+'/'+language+'/LC_MESSAGES'):
43
+ os.mkdir(poPath+'/'+language+'/LC_MESSAGES')
44
+
45
+ poFile = poPath+'/'+language+'/LC_MESSAGES/volto.po'
46
+ if not os.path.isfile(poFile):
47
+ shutil.copyfile(poPath+'/en/LC_MESSAGES/volto.po', poFile)
48
+
49
+ po = polib.pofile(poFile)
50
+ for entry in po:
51
+ if entry.msgid in json and language in json[entry.msgid]:
52
+ entry.msgstr = json[entry.msgid][language]
53
+ po.save(poFile)
54
+
55
+
56
+ for fileName in tmxFiles:
57
+ jsonData = getData(fileName)
58
+
59
+ for language in jsonData['language']:
60
+ print("LANGUAGE:"+language)
61
+ translate(jsonData['data'], language)
package/locales/volto.pot CHANGED
@@ -1,7 +1,7 @@
1
1
  msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Plone\n"
4
- "POT-Creation-Date: 2024-04-12T14:10:28.025Z\n"
4
+ "POT-Creation-Date: 2024-05-13T12:26:08.591Z\n"
5
5
  "Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
6
6
  "Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
7
7
  "Content-Type: text/plain; charset=utf-8\n"
@@ -85,6 +85,11 @@ msgstr ""
85
85
  msgid "Case Study illustrations"
86
86
  msgstr ""
87
87
 
88
+ #. Default: "Case studies collected at national level in Spain, provided by AdapteCCA.es"
89
+ #: components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters
90
+ msgid "Case studies collected at national level in Spain, provided by AdapteCCA.es"
91
+ msgstr ""
92
+
88
93
  #. Default: "Case studies related to this option:"
89
94
  #: components/theme/Views/AdaptationOptionView
90
95
  msgid "Case studies related to this option:"
@@ -100,6 +105,11 @@ msgstr ""
100
105
  msgid "Challenges"
101
106
  msgstr ""
102
107
 
108
+ #. Default: "Choices"
109
+ #: components/manage/Widgets/CreatableSelectWidget
110
+ msgid "Choices"
111
+ msgstr ""
112
+
103
113
  #. Default: "Choose a region"
104
114
  #: components/manage/Blocks/TransRegionSelect/TransRegionSelectView
105
115
  msgid "Choose a region"
@@ -116,6 +126,7 @@ msgid "City:"
116
126
  msgstr ""
117
127
 
118
128
  #. Default: "Climate impact"
129
+ #: components/manage/Blocks/FilterAceContent/FilterAceContentView copy
119
130
  #: components/manage/Blocks/FilterAceContent/FilterAceContentView
120
131
  msgid "Climate impact"
121
132
  msgstr ""
@@ -131,11 +142,21 @@ msgstr ""
131
142
  msgid "Climate impacts:"
132
143
  msgstr ""
133
144
 
145
+ #. Default: "Climate-ADAPT case studies"
146
+ #: components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters
147
+ msgid "Climate-ADAPT case studies"
148
+ msgstr ""
149
+
134
150
  #. Default: "Climate-ADAPT page for this event"
135
151
  #: components/manage/Blocks/Listing/EventCardsListingView
136
152
  msgid "Climate-ADAPT page for this event"
137
153
  msgstr ""
138
154
 
155
+ #. Default: "Close"
156
+ #: components/manage/Widgets/CreatableSelectWidget
157
+ msgid "Close"
158
+ msgstr ""
159
+
139
160
  #. Default: "Contact"
140
161
  #: components/theme/Views/CaseStudyView
141
162
  #: components/theme/Views/CcaEventView
@@ -183,7 +204,13 @@ msgstr ""
183
204
  msgid "Dec"
184
205
  msgstr ""
185
206
 
207
+ #. Default: "Default"
208
+ #: components/manage/Widgets/CreatableSelectWidget
209
+ msgid "Default"
210
+ msgstr ""
211
+
186
212
  #. Default: "Description"
213
+ #: components/manage/Widgets/CreatableSelectWidget
187
214
  #: helpers/Utils
188
215
  msgid "Description"
189
216
  msgstr ""
@@ -198,6 +225,16 @@ msgstr ""
198
225
  msgid "Documents"
199
226
  msgstr ""
200
227
 
228
+ #. Default: "Download Event"
229
+ #: components/theme/Views/EventView
230
+ msgid "Download Event"
231
+ msgstr ""
232
+
233
+ #. Default: "Download this event in iCal format"
234
+ #: components/theme/Views/EventView
235
+ msgid "Download this event in iCal format"
236
+ msgstr ""
237
+
201
238
  #. Default: "Duration:"
202
239
  #: helpers/ContentMetadata
203
240
  msgid "Duration:"
@@ -406,11 +443,21 @@ msgstr ""
406
443
  msgid "No information"
407
444
  msgstr ""
408
445
 
446
+ #. Default: "No options"
447
+ #: components/manage/Widgets/CreatableSelectWidget
448
+ msgid "No options"
449
+ msgstr ""
450
+
409
451
  #. Default: "No results"
410
452
  #: components/manage/Blocks/SearchAceContent/SearchAceContentView
411
453
  msgid "No results"
412
454
  msgstr ""
413
455
 
456
+ #. Default: "No value"
457
+ #: components/manage/Widgets/CreatableSelectWidget
458
+ msgid "No value"
459
+ msgstr ""
460
+
414
461
  #. Default: "Nov"
415
462
  #: components/manage/Blocks/Listing/EventCardsListingView
416
463
  msgid "Nov"
@@ -518,12 +565,18 @@ msgstr ""
518
565
  msgid "Relevance"
519
566
  msgstr ""
520
567
 
568
+ #. Default: "Required"
569
+ #: components/manage/Widgets/CreatableSelectWidget
570
+ msgid "Required"
571
+ msgstr ""
572
+
521
573
  #. Default: "Sa"
522
574
  #: components/manage/Blocks/Listing/EventCardsListingView
523
575
  msgid "Sa"
524
576
  msgstr ""
525
577
 
526
578
  #. Default: "Sector"
579
+ #: components/manage/Blocks/FilterAceContent/FilterAceContentView copy
527
580
  #: components/manage/Blocks/FilterAceContent/FilterAceContentView
528
581
  msgid "Sector"
529
582
  msgstr ""
@@ -548,6 +601,11 @@ msgstr ""
548
601
  msgid "See video outside Climate-ADAPT"
549
602
  msgstr ""
550
603
 
604
+ #. Default: "Select…"
605
+ #: components/manage/Widgets/CreatableSelectWidget
606
+ msgid "Select…"
607
+ msgstr ""
608
+
551
609
  #. Default: "Sep"
552
610
  #: components/manage/Blocks/Listing/EventCardsListingView
553
611
  msgid "Sep"
@@ -556,9 +614,15 @@ msgstr ""
556
614
  #. Default: "Share your information"
557
615
  #: components/manage/Blocks/SearchAceContent/SearchAceContentView
558
616
  #: components/theme/ShareInfoButton/ShareInfoButton
617
+ #: helpers/ShareInfo
559
618
  msgid "Share your information"
560
619
  msgstr ""
561
620
 
621
+ #. Default: "Short Name"
622
+ #: components/manage/Widgets/CreatableSelectWidget
623
+ msgid "Short Name"
624
+ msgstr ""
625
+
562
626
  #. Default: "Solutions"
563
627
  #: components/theme/Views/CaseStudyView
564
628
  msgid "Solutions"
@@ -628,11 +692,21 @@ msgstr ""
628
692
  msgid "The date refers to the moment in which the item has been prepared or updated by contributing experts to be submitted for the publication in Climate ADAPT"
629
693
  msgstr ""
630
694
 
695
+ #. Default: "Title"
696
+ #: components/manage/Widgets/CreatableSelectWidget
697
+ msgid "Title"
698
+ msgstr ""
699
+
631
700
  #. Default: "Tu"
632
701
  #: components/manage/Blocks/Listing/EventCardsListingView
633
702
  msgid "Tu"
634
703
  msgstr ""
635
704
 
705
+ #. Default: "Used for programmatic access to the fieldset."
706
+ #: components/manage/Widgets/CreatableSelectWidget
707
+ msgid "Used for programmatic access to the fieldset."
708
+ msgstr ""
709
+
636
710
  #. Default: "View all contributions in the resource catalogue"
637
711
  #: helpers/Utils
638
712
  msgid "View all contributions in the resource catalogue"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.2.22",
3
+ "version": "0.2.24",
4
4
  "description": "@eeacms/volto-cca-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -18,10 +18,6 @@
18
18
  },
19
19
  "addons": [
20
20
  "@eeacms/volto-openlayers-map",
21
- "@eeacms/volto-widget-temporal-coverage",
22
- "@eeacms/volto-widget-geolocation",
23
- "@eeacms/volto-widget-dataprovenance",
24
- "@eeacms/volto-accordion-block",
25
21
  "@eeacms/volto-slate-label",
26
22
  "@eeacms/volto-datablocks",
27
23
  "@eeacms/volto-eea-design-system",
@@ -30,29 +26,26 @@
30
26
  "@eeacms/volto-globalsearch"
31
27
  ],
32
28
  "dependencies": {
33
- "@eeacms/volto-accordion-block": "*",
34
- "@eeacms/volto-block-style": "*",
29
+ "@eeacms/volto-block-style": "github:eea/volto-block-style#6.x.x",
35
30
  "@eeacms/volto-datablocks": "*",
36
31
  "@eeacms/volto-eea-design-system": "*",
37
- "@eeacms/volto-eea-website-theme": "*",
38
- "@eeacms/volto-globalsearch": "*",
32
+ "@eeacms/volto-eea-website-theme": "^1.33.2",
33
+ "@eeacms/volto-globalsearch": "^1.1.0",
39
34
  "@eeacms/volto-openlayers-map": "*",
40
- "@eeacms/volto-searchlib": "*",
41
- "@eeacms/volto-slate-label": "*",
42
- "@eeacms/volto-tabs-block": "*",
43
- "@eeacms/volto-widget-dataprovenance": "*",
44
- "@eeacms/volto-widget-geolocation": "*",
45
- "@eeacms/volto-widget-temporal-coverage": "*",
35
+ "@eeacms/volto-searchlib": "^0.9.3",
36
+ "@eeacms/volto-slate-label": "^0.6.0",
37
+ "@eeacms/volto-tabs-block": "^7.5.1",
38
+ "@elastic/search-ui": "1.21.2",
46
39
  "d3-array": "^2.12.1",
47
40
  "jotai": "^1.6.0",
48
41
  "query-string": "7.1.0",
49
42
  "react-visibility-sensor": "5.1.1"
50
43
  },
51
44
  "devDependencies": {
52
- "cypress": "13.1.0",
53
45
  "@cypress/code-coverage": "^3.10.0",
54
46
  "@plone/scripts": "*",
55
47
  "babel-plugin-transform-class-properties": "^6.24.1",
48
+ "cypress": "13.1.0",
56
49
  "cypress-fail-fast": "^5.0.1",
57
50
  "dotenv": "^16.3.2",
58
51
  "husky": "^8.0.3",
@@ -1,19 +1,16 @@
1
1
  import React from 'react';
2
2
  import { List } from 'semantic-ui-react';
3
- import { Link } from 'react-router-dom';
4
- import { useLocation } from 'react-router-dom';
3
+ import { Link, useLocation } from 'react-router-dom';
5
4
  import { flattenToAppURL } from '@plone/volto/helpers';
5
+ import config from '@plone/volto/registry';
6
6
  import cx from 'classnames';
7
7
 
8
8
  import './style.less';
9
9
 
10
- const ContentLinksView = (props) => {
10
+ const DefaultBody = (props) => {
11
11
  const location = useLocation();
12
- const { data, mode = 'view' } = props;
13
- const { title, items = [], variation } = data;
14
- const isEdit = mode === 'edit';
15
-
16
- return items && items.length > 0 ? (
12
+ const { title, items = [], variation } = props;
13
+ return (
17
14
  <div className={`block content-links ${variation}-view`}>
18
15
  {title && <h4>{title}</h4>}
19
16
 
@@ -34,6 +31,26 @@ const ContentLinksView = (props) => {
34
31
  })}
35
32
  </List>
36
33
  </div>
34
+ );
35
+ };
36
+
37
+ const ContentLinksView = (props) => {
38
+ const { data, mode = 'view' } = props;
39
+ const { title, items = [], variation, placeholder_text } = data;
40
+ const isEdit = mode === 'edit';
41
+ const activeTemplate = config.blocks.blocksConfig[
42
+ 'contentLinks'
43
+ ].variations.filter((v, _i) => v.id === variation);
44
+
45
+ const BodyComponent = activeTemplate?.[0]?.view || DefaultBody;
46
+
47
+ return items && items.length > 0 ? (
48
+ <BodyComponent
49
+ title={title}
50
+ variation={variation}
51
+ items={items}
52
+ placeholder_text={placeholder_text}
53
+ />
37
54
  ) : (
38
55
  <>{isEdit && <div>No items</div>}</>
39
56
  );
@@ -2,10 +2,29 @@ import React from 'react';
2
2
  import { MemoryRouter } from 'react-router-dom';
3
3
  import configureStore from 'redux-mock-store';
4
4
  import renderer from 'react-test-renderer';
5
-
6
5
  import '@testing-library/jest-dom/extend-expect';
7
6
  import { Provider } from 'react-intl-redux';
8
7
  import ContentLinksView from './ContentLinksView';
8
+ import config from '@plone/volto/registry';
9
+
10
+ config.blocks = {
11
+ blocksConfig: {
12
+ contentLinks: {
13
+ variations: [
14
+ {
15
+ id: 'default',
16
+ title: 'Simple list (default)',
17
+ isDefault: true,
18
+ },
19
+ {
20
+ id: 'navigationList',
21
+ title: 'Navigation list',
22
+ isDefault: false,
23
+ },
24
+ ],
25
+ },
26
+ },
27
+ };
9
28
 
10
29
  const mockStore = configureStore();
11
30
 
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import { Link } from 'react-router-dom';
3
+ import { Dropdown } from 'semantic-ui-react';
4
+ import { useIntl, defineMessages } from 'react-intl';
5
+ import { flattenToAppURL } from '@plone/volto/helpers';
6
+
7
+ const messages = defineMessages({
8
+ select: {
9
+ id: 'Select',
10
+ defaultMessage: 'Select',
11
+ },
12
+ });
13
+
14
+ const getDropdownOptions = (items) => {
15
+ const options = items?.map((item) => {
16
+ const source = item?.source?.[0];
17
+ return {
18
+ key: source?.id,
19
+ value: source?.id,
20
+ text: item.item_title,
21
+ as: Link,
22
+ to: flattenToAppURL(source?.['@id']),
23
+ };
24
+ });
25
+ return options;
26
+ };
27
+
28
+ const DropdownListView = (props) => {
29
+ const intl = useIntl();
30
+ const { title, items = [], variation, placeholder_text } = props;
31
+ const options = getDropdownOptions(items);
32
+
33
+ return (
34
+ items &&
35
+ items.length > 0 && (
36
+ <div className={`block content-links ${variation}-view`}>
37
+ {title && <h4>{title}</h4>}
38
+ <Dropdown
39
+ selection
40
+ placeholder={placeholder_text || intl.formatMessage(messages.select)}
41
+ options={options}
42
+ />
43
+ </div>
44
+ )
45
+ );
46
+ };
47
+
48
+ export default DropdownListView;
@@ -1,6 +1,7 @@
1
1
  import listSVG from '@plone/volto/icons/list-bullet.svg';
2
2
  import ContentLinksEdit from './ContentLinksEdit';
3
3
  import ContentLinksView from './ContentLinksView';
4
+ import DropdownListView from './DropdownListView';
4
5
 
5
6
  export default function installBlock(config) {
6
7
  config.blocks.blocksConfig.contentLinks = {
@@ -27,6 +28,19 @@ export default function installBlock(config) {
27
28
  isDefault: false,
28
29
  fullobjects: true,
29
30
  },
31
+ {
32
+ id: 'dropdown',
33
+ title: 'Dropdown',
34
+ view: DropdownListView,
35
+ isDefault: false,
36
+ schemaEnhancer: ({ schema }) => {
37
+ schema.properties.placeholder_text = {
38
+ title: 'Placeholder text',
39
+ };
40
+ schema.fieldsets[0].fields.push('placeholder_text');
41
+ return schema;
42
+ },
43
+ },
30
44
  ],
31
45
  restricted: false,
32
46
  };
@@ -17,6 +17,24 @@
17
17
  }
18
18
  }
19
19
 
20
+ .dropdown-view {
21
+ .ui.selection.dropdown:not(.multiple) {
22
+ display: inline-flex;
23
+ width: auto;
24
+ min-width: 180px;
25
+ align-items: center;
26
+ justify-content: space-between;
27
+
28
+ > .dropdown.icon {
29
+ position: relative;
30
+ top: 0;
31
+ right: -15px;
32
+ padding: 0;
33
+ font-size: 1rem;
34
+ }
35
+ }
36
+ }
37
+
20
38
  .navigationList-view {
21
39
  .item {
22
40
  padding: 0.75rem 0 0.75rem 0.75rem !important;
@@ -139,7 +139,7 @@ const View = (props) => {
139
139
  return (
140
140
  <div>
141
141
  <Grid columns="12">
142
- <Grid.Column mobile={9} tablet={9} computer={10} className="col-left">
142
+ <Grid.Column mobile={12} tablet={12} computer={10} className="col-left">
143
143
  {tileWMSSources ? (
144
144
  <Map
145
145
  view={{
@@ -180,8 +180,8 @@ const View = (props) => {
180
180
  ) : null}
181
181
  </Grid.Column>
182
182
  <Grid.Column
183
- mobile={3}
184
- tablet={3}
183
+ mobile={12}
184
+ tablet={12}
185
185
  computer={2}
186
186
  className="col-left"
187
187
  id="country-map-filter"
@@ -1,7 +1,8 @@
1
1
  .countryMapProfile {
2
2
  &.sized-wrapper {
3
3
  width: 100%;
4
- height: 80vh;
4
+ height: 100%;
5
+ margin-bottom: 2em;
5
6
  }
6
7
 
7
8
  p.title {
@@ -9,6 +10,10 @@
9
10
  font-weight: bold;
10
11
  }
11
12
 
13
+ .ui.radio.checkbox {
14
+ margin-right: 0.5em;
15
+ }
16
+
12
17
  #country_map {
13
18
  position: relative;
14
19
  margin: 50px;
@@ -68,6 +73,7 @@
68
73
  .legend-box {
69
74
  width: 40px;
70
75
  height: 19px;
76
+ margin-top: 3px;
71
77
  margin-right: 0.5em;
72
78
  }
73
79
 
@@ -269,4 +275,12 @@
269
275
  padding-top: 1em;
270
276
  border-top: 2px solid #005c96;
271
277
  }
278
+
279
+ @media only screen and (max-width: 768px) {
280
+ .legend.nasnap-legend {
281
+ display: flex;
282
+ flex-wrap: wrap;
283
+ gap: 1em;
284
+ }
285
+ }
272
286
  }
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Link } from 'react-router-dom';
4
+ import { Dropdown } from 'semantic-ui-react';
5
+ import { flattenToAppURL } from '@plone/volto/helpers';
6
+ import { useIntl, defineMessages } from 'react-intl';
7
+
8
+ import './styles.less';
9
+
10
+ const messages = defineMessages({
11
+ select: {
12
+ id: 'Select',
13
+ defaultMessage: 'Select',
14
+ },
15
+ });
16
+
17
+ const getDropdownOptions = (items) => {
18
+ const options = items?.map((item) => {
19
+ return {
20
+ key: item.id,
21
+ value: item.id,
22
+ text: item.title,
23
+ as: Link,
24
+ to: flattenToAppURL(item['@id']),
25
+ };
26
+ });
27
+ return options;
28
+ };
29
+
30
+ const DropdownListingView = (data) => {
31
+ const intl = useIntl();
32
+ const { items = [], placeholder_text } = data;
33
+ const options = getDropdownOptions(items);
34
+
35
+ return (
36
+ <Dropdown
37
+ selection
38
+ placeholder={placeholder_text || intl.formatMessage(messages.select)}
39
+ options={options}
40
+ />
41
+ );
42
+ };
43
+
44
+ DropdownListingView.propTypes = {
45
+ items: PropTypes.arrayOf(PropTypes.any).isRequired,
46
+ isEditMode: PropTypes.bool,
47
+ };
48
+
49
+ export default DropdownListingView;
@@ -1,12 +1,27 @@
1
1
  import OrganisationCardsListingView from './OrganisationCardsListingView';
2
2
  import IndicatorCardsListingView from './IndicatorCardsListingView';
3
3
  import EventCardsListingView from './EventCardsListingView';
4
+ import DropdownListingView from './DropdownListingView';
4
5
 
5
6
  export default function installListing(config) {
6
7
  config.blocks.blocksConfig.listing = {
7
8
  ...config.blocks.blocksConfig.listing,
8
9
  variations: [
9
10
  ...config.blocks.blocksConfig.listing.variations,
11
+ {
12
+ id: 'dropdown',
13
+ title: 'Dropdown',
14
+ template: DropdownListingView,
15
+ isDefault: false,
16
+ fullobjects: true,
17
+ schemaEnhancer: ({ schema }) => {
18
+ schema.properties.placeholder_text = {
19
+ title: 'Placeholder text',
20
+ };
21
+ schema.fieldsets[0].fields.push('placeholder_text');
22
+ return schema;
23
+ },
24
+ },
10
25
  {
11
26
  id: 'organisationCards',
12
27
  title: 'Organisation Cards',
@@ -99,3 +99,21 @@ div.eventCards {
99
99
  }
100
100
  }
101
101
  }
102
+
103
+ .dropdown.listing {
104
+ .ui.selection.dropdown:not(.multiple) {
105
+ display: inline-flex;
106
+ width: auto;
107
+ min-width: 180px;
108
+ align-items: center;
109
+ justify-content: space-between;
110
+
111
+ > .dropdown.icon {
112
+ position: relative;
113
+ top: 0;
114
+ right: -15px;
115
+ padding: 0;
116
+ font-size: 1rem;
117
+ }
118
+ }
119
+ }