@eeacms/volto-cca-policy 0.2.98 → 0.2.99

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/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: 2025-01-21T10:42:44.543Z\n"
4
+ "POT-Creation-Date: 2025-01-31T08:25:40.802Z\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"
@@ -110,6 +110,11 @@ msgstr ""
110
110
  msgid "Challenges"
111
111
  msgstr ""
112
112
 
113
+ #. Default: "Choose a file"
114
+ #: components/theme/Widgets/PromotionalImageWidget
115
+ msgid "Choose a file"
116
+ msgstr ""
117
+
113
118
  #. Default: "Choose a region"
114
119
  #: components/manage/Blocks/TransRegionSelect/TransRegionSelectView
115
120
  msgid "Choose a region"
@@ -228,6 +233,21 @@ msgstr ""
228
233
  msgid "Download this event in iCal format"
229
234
  msgstr ""
230
235
 
236
+ #. Default: "Drop file here to replace the existing file"
237
+ #: components/theme/Widgets/PromotionalImageWidget
238
+ msgid "Drop file here to replace the existing file"
239
+ msgstr ""
240
+
241
+ #. Default: "Drop file here to upload a new file"
242
+ #: components/theme/Widgets/PromotionalImageWidget
243
+ msgid "Drop file here to upload a new file"
244
+ msgstr ""
245
+
246
+ #. Default: "Drop files here ..."
247
+ #: components/theme/Widgets/PromotionalImageWidget
248
+ msgid "Drop files here ..."
249
+ msgstr ""
250
+
231
251
  #. Default: "Duration:"
232
252
  #: helpers/ContentMetadata
233
253
  msgid "Duration:"
@@ -389,11 +409,6 @@ msgstr ""
389
409
  msgid "Language of the conference"
390
410
  msgstr ""
391
411
 
392
- #. Default: "Last Modified in Climate-ADAPT"
393
- #: helpers/Utils
394
- msgid "Last Modified in Climate-ADAPT"
395
- msgstr ""
396
-
397
412
  #. Default: "Lead"
398
413
  #: components/theme/Views/ProjectView
399
414
  msgid "Lead"
@@ -511,6 +526,11 @@ msgstr ""
511
526
  msgid "Policy and legal background"
512
527
  msgstr ""
513
528
 
529
+ #. Default: "Policy context of the adaptation measure"
530
+ #: components/theme/Views/CaseStudyView
531
+ msgid "Policy context of the adaptation measure"
532
+ msgstr ""
533
+
514
534
  #. Default: "Practical information"
515
535
  #: components/theme/Views/CcaEventView
516
536
  msgid "Practical information"
@@ -568,9 +588,9 @@ msgstr ""
568
588
  msgid "Related documents and presentations"
569
589
  msgstr ""
570
590
 
571
- #. Default: "Relevance"
572
- #: components/theme/Views/CaseStudyView
573
- msgid "Relevance"
591
+ #. Default: "Replace existing file"
592
+ #: components/theme/Widgets/PromotionalImageWidget
593
+ msgid "Replace existing file"
574
594
  msgstr ""
575
595
 
576
596
  #. Default: "Sa"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.2.98",
3
+ "version": "0.2.99",
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",
@@ -56,7 +56,10 @@ const messages = defineMessages({
56
56
  id: 'Costs and benefits',
57
57
  defaultMessage: 'Costs and benefits',
58
58
  },
59
- Relevance: { id: 'Relevance', defaultMessage: 'Relevance' },
59
+ 'Policy context of the adaptation measure': {
60
+ id: 'Policy context of the adaptation measure',
61
+ defaultMessage: 'Policy context of the adaptation measure',
62
+ },
60
63
  'Legal Aspects': { id: 'Legal aspects', defaultMessage: 'Legal aspects' },
61
64
  'Implementation Time': {
62
65
  id: 'Implementation time',
@@ -88,7 +91,7 @@ const messages = defineMessages({
88
91
  const PrimaryPhoto = ({ content }) => {
89
92
  const { primary_photo, primary_photo_copyright, title } = content;
90
93
 
91
- return primary_photo !== null ? (
94
+ return primary_photo ? (
92
95
  <div className="case-studies-review-image-wrapper">
93
96
  <Image src={primary_photo?.scales?.mini?.download} alt={title} />
94
97
  <p>{primary_photo_copyright}</p>
@@ -111,6 +114,13 @@ const dataDisplay = [
111
114
  title: 'Policy and legal background',
112
115
  group: 1,
113
116
  },
117
+ {
118
+ type: 'RelevanceItems',
119
+ field: 'relevance',
120
+ section: 'relevance_anchor',
121
+ title: 'Policy context of the adaptation measure',
122
+ group: 1,
123
+ },
114
124
  {
115
125
  type: 'HTMLField',
116
126
  field: 'objectives',
@@ -132,14 +142,6 @@ const dataDisplay = [
132
142
  title: 'Solutions',
133
143
  group: 1,
134
144
  },
135
- {
136
- type: 'RelevanceItems',
137
- field: 'relevance',
138
- section: 'relevance_anchor',
139
- title: 'Importance and Relevance of Adaptation',
140
- contentTitle: 'Relevance', // override the title in content section
141
- group: 1,
142
- },
143
145
  {
144
146
  type: 'HTMLField',
145
147
  field: 'stakeholder_participation',
@@ -212,21 +214,10 @@ const groups = {
212
214
  3: 'Reference Information',
213
215
  };
214
216
 
215
- const findSection = (title) => {
216
- const found = dataDisplay.filter((item) => item.title === title);
217
- if (found.length > 0) {
218
- return found[0];
219
- }
220
- return null;
221
- };
217
+ export const findSection = (title) =>
218
+ dataDisplay.find((item) => item.title === title) || null;
222
219
 
223
- const sectionID = (title) => {
224
- const found = findSection(title);
225
- if (found === null) {
226
- return title;
227
- }
228
- return found.section;
229
- };
220
+ export const sectionID = (title) => findSection(title)?.section || title;
230
221
 
231
222
  const PhotoGallery = ({ content }) => {
232
223
  const { cca_gallery } = content;
@@ -325,29 +316,20 @@ function CaseStudyView(props) {
325
316
  const { long_description, updating_notes, logo, title } = content;
326
317
 
327
318
  const hasValue = (field) => {
328
- if (!content.hasOwnProperty(field)) {
329
- return false;
330
- }
331
- if (content[field] === undefined || content[field] === null) {
332
- return false;
333
- }
334
- if (Array.isArray(content[field]) && content[field].length === 0) {
335
- return false;
336
- }
319
+ const fieldValue = content[field];
320
+ if (!content.hasOwnProperty(field) || fieldValue == null) return false;
321
+ if (Array.isArray(fieldValue) && fieldValue.length === 0) return false;
337
322
  if (
338
- typeof content[field]?.data === 'string' &&
339
- content[field]?.data.replace('<p></p>', '').length === 0
340
- ) {
323
+ typeof fieldValue?.data === 'string' &&
324
+ fieldValue?.data.replace('<p></p>', '').length === 0
325
+ )
341
326
  return false;
342
- }
327
+
343
328
  return true;
344
329
  };
345
330
 
346
- const usedSections = (group) => {
347
- return dataDisplay.filter(
348
- (data) => data.group === group && hasValue(data.field),
349
- );
350
- };
331
+ const usedSections = (group) =>
332
+ dataDisplay.filter((data) => data.group === group && hasValue(data.field));
351
333
 
352
334
  return (
353
335
  <div className="db-item-view case-study-view">
@@ -397,43 +379,39 @@ function CaseStudyView(props) {
397
379
  <Divider />
398
380
  <div className="adaptation-details">
399
381
  <Grid columns="12">
400
- <Grid.Column mobile={12} tablet={12} computer={4}>
401
- <SectionsMenu
402
- sections={usedSections(1)}
403
- title={groups['1']}
404
- />
405
- </Grid.Column>
406
- <Grid.Column mobile={12} tablet={12} computer={4}>
407
- <SectionsMenu
408
- sections={usedSections(2)}
409
- title={groups['2']}
410
- />
411
- </Grid.Column>
412
- <Grid.Column mobile={12} tablet={12} computer={4}>
413
- <SectionsMenu
414
- sections={usedSections(3)}
415
- title={groups['3']}
416
- />
417
- </Grid.Column>
382
+ {[1, 2, 3].map((groupID) => (
383
+ <Grid.Column
384
+ key={groupID}
385
+ mobile={12}
386
+ tablet={12}
387
+ computer={4}
388
+ >
389
+ <SectionsMenu
390
+ sections={usedSections(groupID)}
391
+ title={groups[groupID]}
392
+ />
393
+ </Grid.Column>
394
+ ))}
418
395
  </Grid>
419
396
  </div>
420
397
  <Divider />
421
- {[1, 2, 3].map(
422
- (groupID, index) =>
423
- usedSections(groupID).length > 0 && (
424
- <Fragment key={index}>
425
- <h2>{intl.formatMessage(messages[groups[groupID]])}</h2>
426
- {usedSections(groupID).map((data, index) => (
427
- <SectionContent
428
- sectionData={data}
429
- content={content}
430
- key={index}
431
- />
432
- ))}
433
- {groupID !== 3 ? <Divider /> : null}
434
- </Fragment>
435
- ),
436
- )}
398
+ {[1, 2, 3].map((groupID) => {
399
+ const sections = usedSections(groupID);
400
+ if (sections.length === 0) return null;
401
+ return (
402
+ <Fragment key={groupID}>
403
+ <h2>{intl.formatMessage(messages[groups[groupID]])}</h2>
404
+ {sections.map((data, index) => (
405
+ <SectionContent
406
+ key={index}
407
+ sectionData={data}
408
+ content={content}
409
+ />
410
+ ))}
411
+ {groupID !== 3 && <Divider />}
412
+ </Fragment>
413
+ );
414
+ })}
437
415
  <PublishedModifiedInfo {...props} />
438
416
  <Divider />
439
417
  <p>