design-comuni-plone-theme 11.26.3 → 11.26.5

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 (55) hide show
  1. package/.github/workflows/main.yml +1 -1
  2. package/.github/workflows/prs.yml +1 -1
  3. package/.github/workflows/release.yml +1 -1
  4. package/.yarn/cache/{volto-venue-npm-4.1.0-481d5ba425-64ca36bc93.zip → volto-venue-npm-4.1.1-d5be247928-f796d519ad.zip} +0 -0
  5. package/.yarn/install-state.gz +0 -0
  6. package/CHANGELOG.md +41 -0
  7. package/Makefile +1 -1
  8. package/RELEASE.md +22 -0
  9. package/locales/de/LC_MESSAGES/volto.po +38 -7
  10. package/locales/en/LC_MESSAGES/volto.po +39 -8
  11. package/locales/es/LC_MESSAGES/volto.po +38 -7
  12. package/locales/fr/LC_MESSAGES/volto.po +38 -7
  13. package/locales/it/LC_MESSAGES/volto.po +39 -8
  14. package/locales/volto.pot +39 -8
  15. package/package.json +3 -3
  16. package/publiccode.yml +2 -2
  17. package/src/components/ImageWithErrors/ImageWithErrors.jsx +0 -1
  18. package/src/components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate.jsx +13 -10
  19. package/src/components/ItaliaTheme/Blocks/Listing/CardWithImage/CardWithImageDefault.jsx +7 -7
  20. package/src/components/ItaliaTheme/Blocks/Listing/Commons/ListingImage.jsx +35 -13
  21. package/src/components/ItaliaTheme/Blocks/Listing/CompleteBlockLinksTemplate.jsx +16 -10
  22. package/src/components/ItaliaTheme/Blocks/Listing/ContentInEvidenceTemplate.jsx +12 -9
  23. package/src/components/ItaliaTheme/Blocks/Listing/GridGalleryTemplate.jsx +7 -7
  24. package/src/components/ItaliaTheme/Blocks/Listing/InEvidenceTemplate.jsx +9 -8
  25. package/src/components/ItaliaTheme/Blocks/Listing/PhotogalleryTemplate.jsx +7 -6
  26. package/src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx +9 -6
  27. package/src/components/ItaliaTheme/Blocks/Listing/SmallBlockLinksTemplate.jsx +19 -23
  28. package/src/components/ItaliaTheme/Cards/CardPersona.jsx +5 -8
  29. package/src/components/ItaliaTheme/View/Commons/GenericCard.jsx +14 -13
  30. package/src/components/ItaliaTheme/View/Commons/LocationItem.jsx +15 -9
  31. package/src/components/ItaliaTheme/View/Commons/OfficeCard.jsx +7 -3
  32. package/src/components/ItaliaTheme/View/Commons/Sponsors.jsx +14 -10
  33. package/src/components/ItaliaTheme/View/Commons/VenuesSmall.jsx +13 -6
  34. package/src/components/ItaliaTheme/View/EventoView/EventoContatti.jsx +8 -7
  35. package/src/components/ItaliaTheme/View/EventoView/EventoContattiOrganizzatoreEsterno.jsx +1 -12
  36. package/src/components/ItaliaTheme/View/EventoView/EventoContattiOrganizzatoreInterno.jsx +1 -12
  37. package/src/components/ItaliaTheme/View/EventoView/EventoOrganizzatoDa.jsx +38 -0
  38. package/src/components/ItaliaTheme/View/EventoView/EventoPatrocinatoDa.jsx +38 -0
  39. package/src/components/ItaliaTheme/View/EventoView/EventoUlterioriInformazioni.jsx +0 -18
  40. package/src/components/ItaliaTheme/View/NewsItemView/NewsItemText.jsx +1 -0
  41. package/src/components/SelectInput/SelectInput.jsx +9 -4
  42. package/src/config/Blocks/ListingOptions/attachmentCardTemplate.js +1 -1
  43. package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.jsx +15 -11
  44. package/src/customizations/volto/components/theme/View/ListingView.jsx +3 -3
  45. package/src/helpers/images.js +25 -1
  46. package/src/helpers/index.js +4 -1
  47. package/src/overrideTranslations.jsx +25 -0
  48. package/src/theme/ItaliaTheme/Blocks/_cardWithImage.scss +4 -0
  49. package/src/theme/ItaliaTheme/Blocks/_gridBlock.scss +9 -0
  50. package/src/theme/ItaliaTheme/Components/_cardLocationItem.scss +12 -0
  51. package/src/theme/ItaliaTheme/Components/_cardPersona.scss +19 -1
  52. package/src/theme/ItaliaTheme/Widgets/_blocksWidget.scss +36 -0
  53. package/src/theme/_cms-ui.scss +21 -0
  54. package/src/theme/bootstrap-override/_bootstrap-italia-site.scss +1 -0
  55. package/src/theme/bootstrap-override/bootstrap-italia/_avatar.scss +28 -0
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-12-12T10:58:07.184Z\n"
4
+ "POT-Creation-Date: 2025-02-06T14:26:38.454Z\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
  "MIME-Version: 1.0\n"
@@ -195,6 +195,11 @@ msgstr ""
195
195
  msgid "Dimensione della mappa"
196
196
  msgstr ""
197
197
 
198
+ #: overrideTranslations
199
+ # defaultMessage: Add border to inner columns
200
+ msgid "Divide each row into separate cells"
201
+ msgstr ""
202
+
198
203
  #: components/ItaliaTheme/View/Commons/TrasparenzaFields
199
204
  # defaultMessage: Download
200
205
  msgid "Download"
@@ -252,6 +257,11 @@ msgstr ""
252
257
  msgid "Hide all content types"
253
258
  msgstr ""
254
259
 
260
+ #: overrideTranslations
261
+ # defaultMessage: Hide headers
262
+ msgid "Hide headers"
263
+ msgstr ""
264
+
255
265
  #: components/ItaliaTheme/Breadcrumbs/Breadcrumbs
256
266
  # defaultMessage: Home
257
267
  msgid "Home"
@@ -366,6 +376,11 @@ msgstr ""
366
376
  msgid "Luogo location filter"
367
377
  msgstr ""
368
378
 
379
+ #: overrideTranslations
380
+ # defaultMessage: Make the table sortable
381
+ msgid "Make the table sortable"
382
+ msgstr ""
383
+
369
384
  #: components/ItaliaTheme/Blocks/TextCard/CardWithImage/Sidebar
370
385
  # defaultMessage: Medio
371
386
  msgid "Medio"
@@ -540,6 +555,11 @@ msgstr ""
540
555
  msgid "Select all or none"
541
556
  msgstr ""
542
557
 
558
+ #: components/SelectInput/SelectInput
559
+ # defaultMessage: Seleziona un'opzione
560
+ msgid "SelectInput_default_label"
561
+ msgstr ""
562
+
543
563
  #: components/ItaliaTheme/manage/Widgets/FileWidget
544
564
  # defaultMessage: Seleziona un file
545
565
  msgid "Seleziona un file"
@@ -571,6 +591,16 @@ msgstr ""
571
591
  msgid "Subscribe"
572
592
  msgstr ""
573
593
 
594
+ #: overrideTranslations
595
+ # defaultMessage: Table block
596
+ msgid "Table block"
597
+ msgstr ""
598
+
599
+ #: overrideTranslations
600
+ # defaultMessage: Table color inverted
601
+ msgid "Table color inverted"
602
+ msgstr ""
603
+
574
604
  #: components/ItaliaTheme/Blocks/Accordion/Block/EditBlock
575
605
  #: components/ItaliaTheme/Blocks/ContactsBlock/Block/EditBlock
576
606
  #: components/ItaliaTheme/Blocks/IconBlocks/Block/EditBlock
@@ -705,6 +735,11 @@ msgstr ""
705
735
  msgid "VideoGalleryBlock"
706
736
  msgstr ""
707
737
 
738
+ #: overrideTranslations
739
+ # defaultMessage: Visible only in view mode
740
+ msgid "Visible only in view mode"
741
+ msgstr ""
742
+
708
743
  #: components/ItaliaTheme/Unauthorized/Unauthorized
709
744
  # defaultMessage: You are trying to access a protected resource, please {login} first.
710
745
  msgid "You are trying to access a protected resource, please {login} first."
@@ -2814,16 +2849,11 @@ msgstr ""
2814
2849
  msgid "order_by"
2815
2850
  msgstr ""
2816
2851
 
2817
- #: components/ItaliaTheme/View/EventoView/EventoContattiOrganizzatoreInterno
2852
+ #: components/ItaliaTheme/View/EventoView/EventoOrganizzatoDa
2818
2853
  # defaultMessage: Organizzato da
2819
2854
  msgid "organizzato_da"
2820
2855
  msgstr ""
2821
2856
 
2822
- #: components/ItaliaTheme/View/EventoView/EventoContattiOrganizzatoreEsterno
2823
- # defaultMessage: Organizzatore
2824
- msgid "organizzatore"
2825
- msgstr ""
2826
-
2827
2857
  #: components/ItaliaTheme/View/Commons/TrasparenzaFields
2828
2858
  #: components/ItaliaTheme/View/TrasparenzaView/DettagliProcedimentiView
2829
2859
  # defaultMessage: Organo competente adozione provvedimento finale
@@ -2871,6 +2901,7 @@ msgstr ""
2871
2901
  msgid "parteciperanno"
2872
2902
  msgstr ""
2873
2903
 
2904
+ #: components/ItaliaTheme/View/EventoView/EventoPatrocinatoDa
2874
2905
  #: components/ItaliaTheme/View/EventoView/EventoUlterioriInformazioni
2875
2906
  # defaultMessage: Patrocinato da
2876
2907
  msgid "patrocinato_da"
@@ -3709,7 +3740,7 @@ msgid "show_only_first_ribbon"
3709
3740
  msgstr ""
3710
3741
 
3711
3742
  #: config/Blocks/ListingOptions/attachmentCardTemplate
3712
- # defaultMessage: Permette di aprire l'anteprima di tutti i PDF di questo elenco in una tab separata altrimenti vengono scaricati.
3743
+ # defaultMessage: Permette di aprire l'anteprima di tutti i PDF di questo elenco in una tab separata. Se non impostato, i PDF vengono scaricati.
3713
3744
  msgid "show_pdf_desc"
3714
3745
  msgstr ""
3715
3746
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "design-comuni-plone-theme",
3
3
  "description": "Volto Theme for Italia design guidelines",
4
4
  "license": "GPL-v3",
5
- "version": "11.26.3",
5
+ "version": "11.26.5",
6
6
  "main": "src/index.js",
7
7
  "repository": {
8
8
  "type": "git",
@@ -165,7 +165,7 @@
165
165
  "volto-subblocks": "2.1.0",
166
166
  "volto-subfooter": "3.1.1",
167
167
  "volto-subsites": "4.0.2",
168
- "volto-venue": "4.1.0",
168
+ "volto-venue": "4.1.1",
169
169
  "webpack-image-resize-loader": "^5.0.0"
170
170
  },
171
171
  "devDependencies": {
@@ -200,7 +200,7 @@
200
200
  "stylelint-prettier": "4.0.2"
201
201
  },
202
202
  "peerDependencies": {
203
- "@plone/volto": "17.20.3"
203
+ "@plone/volto": "17.20.4"
204
204
  },
205
205
  "packageManager": "yarn@3.2.3"
206
206
  }
package/publiccode.yml CHANGED
@@ -227,9 +227,9 @@ maintenance:
227
227
  name: io-Comune - Il sito AgID per Comuni ed Enti Pubblici
228
228
  platforms:
229
229
  - web
230
- releaseDate: '2025-01-15'
230
+ releaseDate: '2025-02-06'
231
231
  softwareType: standalone/web
232
- softwareVersion: 11.26.3
232
+ softwareVersion: 11.26.5
233
233
  url: 'https://github.com/italia/design-comuni-plone-theme'
234
234
  usedBy:
235
235
  - ASP Comuni Modenesi Area Nord
@@ -11,7 +11,6 @@ const ImageWithErrors = ({ src, fallbackSrc = '', ...rest }) => {
11
11
  className,
12
12
  sizes,
13
13
  });
14
-
15
14
  let commonProps = { ...rest };
16
15
  const fallbackStyle = getFallbackImageStyle({
17
16
  src,
@@ -52,16 +52,18 @@ const AttachmentCardTemplate = ({
52
52
  {items.map((item, index) => {
53
53
  let itemUrl = { ...item };
54
54
  //la parte qui sotto commentata non serve perchè gestisce gia tutto UniversalLink e in view si vedrebbe /@@download/file duplicato nell url
55
- // if (item['@type'] === 'File') {
56
- // itemUrl = {
57
- // ...item,
58
- // file: item,
59
- // '@id':
60
- // show_pdf_preview && item?.mime_type === 'application/pdf'
61
- // ? item?.['@id'] + '/@@display-file/file'
62
- // : item?.['@id'] + '/@@download/file',
63
- // };
64
- // }
55
+ if (
56
+ item['@type'] === 'File' &&
57
+ item?.mime_type === 'application/pdf'
58
+ ) {
59
+ itemUrl = {
60
+ ...item,
61
+ file: item,
62
+ '@id': show_pdf_preview
63
+ ? item?.['@id'] + '/@@display-file/file'
64
+ : item?.['@id'] + '/@@download/file',
65
+ };
66
+ }
65
67
 
66
68
  return (
67
69
  <Card
@@ -86,6 +88,7 @@ const AttachmentCardTemplate = ({
86
88
  item={!isEditMode ? itemUrl : null}
87
89
  href={isEditMode ? '#' : null}
88
90
  data-element={id_lighthouse}
91
+ download={!show_pdf_preview}
89
92
  >
90
93
  {item.title || item.id}
91
94
  </UniversalLink>
@@ -21,6 +21,7 @@ import {
21
21
  getCalendarDate,
22
22
  getEventRecurrenceMore,
23
23
  getComponentWithFallback,
24
+ contentHasImage,
24
25
  } from 'design-comuni-plone-theme/helpers';
25
26
  import { getCategory } from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/Listing/Commons/utils';
26
27
 
@@ -61,10 +62,10 @@ const CardWithImageDefault = (props) => {
61
62
  : getEventRecurrenceMore(item, isEditMode);
62
63
  const listingText = show_description ? <ListingText item={item} /> : null;
63
64
 
64
- const image = ListingImage({ item, showTitleAttr: false });
65
-
66
- const showImage =
67
- (index < imagesToShow || always_show_image) && image != null;
65
+ const showImage = contentHasImage(
66
+ item,
67
+ index < imagesToShow || always_show_image,
68
+ );
68
69
  const category = getCategory(item, show_type, show_section, props);
69
70
  const topics = show_topics ? item.tassonomia_argomenti : null;
70
71
 
@@ -72,7 +73,6 @@ const CardWithImageDefault = (props) => {
72
73
  name: 'BlockExtraTags',
73
74
  dependencies: ['CardWithImageDefault', item['@type']],
74
75
  }).component;
75
-
76
76
  const isEventAppointment =
77
77
  item?.parent?.['@type'] === 'Event' && item?.['@type'] === 'Event';
78
78
 
@@ -106,7 +106,7 @@ const CardWithImageDefault = (props) => {
106
106
  })}
107
107
  >
108
108
  <div className="img-responsive img-responsive-panoramic">
109
- {image}
109
+ <ListingImage item={item} showTitleAttr={false} />
110
110
  {item['@type'] === 'Event' && (
111
111
  <CardCalendar
112
112
  start={item.start}
@@ -151,7 +151,7 @@ const CardWithImageDefault = (props) => {
151
151
  <BlockExtraTags {...props} item={item} itemIndex={index} />
152
152
  {topics?.length > 0 && (
153
153
  <div
154
- className={cx('', {
154
+ className={cx('card-with-image-additional-links', {
155
155
  'mb-3': eventRecurrenceMore,
156
156
  })}
157
157
  >
@@ -1,8 +1,19 @@
1
1
  import { UniversalLink } from '@plone/volto/components';
2
2
  import DefaultImageSVG from '@plone/volto/components/manage/Blocks/Listing/default-image.svg';
3
3
  import { flattenToAppURL } from '@plone/volto/helpers';
4
+ import { contentHasImage } from 'design-comuni-plone-theme/helpers';
4
5
  import config from '@plone/volto/registry';
5
6
 
7
+ const ListingImageWrapper = ({ children, item, noWrapLink }) => {
8
+ return noWrapLink ? (
9
+ children
10
+ ) : (
11
+ <UniversalLink item={item} className="img-wrapper">
12
+ {children}
13
+ </UniversalLink>
14
+ );
15
+ };
16
+
6
17
  const ListingImage = ({
7
18
  item = {},
8
19
  loading = 'lazy',
@@ -14,6 +25,26 @@ const ListingImage = ({
14
25
  noWrapLink = false,
15
26
  ...imageProps
16
27
  }) => {
28
+ if (!contentHasImage(item) && !imageProps?.image_field) {
29
+ if (showDefault) {
30
+ return (
31
+ <ListingImageWrapper item={item} noWrapLink={noWrapLink}>
32
+ <img
33
+ src={DefaultImageSVG}
34
+ alt=""
35
+ sizes={sizes}
36
+ aria-hidden={true}
37
+ role="presentation"
38
+ className="listing-image responsive"
39
+ style={{
40
+ minHeight: 'unset',
41
+ height: '100%',
42
+ }}
43
+ />
44
+ </ListingImageWrapper>
45
+ );
46
+ } else return null;
47
+ }
17
48
  const Image = config.getComponent({ name: 'Image' }).component;
18
49
  let commonImageProps = {
19
50
  item,
@@ -28,20 +59,11 @@ const ListingImage = ({
28
59
  };
29
60
  if (showTitleAttr)
30
61
  commonImageProps = { ...commonImageProps, title: item.title };
31
- // photogallery needs to check for null image
32
- // https://stackoverflow.com/questions/33136399/is-there-a-way-to-tell-if-reactelement-renders-null
33
-
34
- const image = Image(commonImageProps);
35
- const defaultImage = <img src={DefaultImageSVG} alt="" />;
36
-
37
- if (image === null && !showDefault) return null;
38
62
 
39
- return !noWrapLink ? (
40
- <UniversalLink item={item} className="img-wrapper">
41
- {image ?? defaultImage}
42
- </UniversalLink>
43
- ) : (
44
- image ?? defaultImage
63
+ return (
64
+ <ListingImageWrapper item={item} noWrapLink={noWrapLink}>
65
+ <Image {...commonImageProps} />
66
+ </ListingImageWrapper>
45
67
  );
46
68
  };
47
69
 
@@ -19,7 +19,10 @@ import {
19
19
  ListingImage,
20
20
  } from 'design-comuni-plone-theme/components/ItaliaTheme';
21
21
  import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
22
- import { getComponentWithFallback } from 'design-comuni-plone-theme/helpers';
22
+ import {
23
+ getComponentWithFallback,
24
+ contentHasImage,
25
+ } from 'design-comuni-plone-theme/helpers';
23
26
  import { isInternalURL } from '@plone/volto/helpers/Url/Url';
24
27
 
25
28
  import config from '@plone/volto/registry';
@@ -56,14 +59,7 @@ const CompleteBlockLinksTemplate = (props) => {
56
59
  )}
57
60
  <Row className="items">
58
61
  {items.map((item, index) => {
59
- const image = ListingImage({
60
- item,
61
- className: '',
62
- sizes: '60px',
63
- showTitleAttr: false,
64
- alt: item.title,
65
- });
66
-
62
+ const hasImage = contentHasImage(item);
67
63
  const BlockExtraTags = getComponentWithFallback({
68
64
  name: 'BlockExtraTags',
69
65
  dependencies: ['CompleteBlockLinksTemplate', item['@type']],
@@ -84,7 +80,17 @@ const CompleteBlockLinksTemplate = (props) => {
84
80
  className={'no-external-if-link'}
85
81
  >
86
82
  <div className="d-flex">
87
- {image && <div className="image-container">{image}</div>}
83
+ {hasImage && (
84
+ <div className="image-container">
85
+ <ListingImage
86
+ item={item}
87
+ className=""
88
+ sizes="60px"
89
+ showTitleAttr={false}
90
+ alt={item.title}
91
+ />
92
+ </div>
93
+ )}
88
94
  <div>
89
95
  <CardBody>
90
96
  <CardTitle tag="h3" className="text-secondary">
@@ -23,6 +23,7 @@ import {
23
23
  getCalendarDate,
24
24
  getEventRecurrenceMore,
25
25
  getComponentWithFallback,
26
+ contentHasImage,
26
27
  } from 'design-comuni-plone-theme/helpers';
27
28
  import {
28
29
  ListingCategory,
@@ -66,13 +67,7 @@ const ContentInEvidenceTemplate = (props) => {
66
67
  const date = getCalendarDate(item, rrule.rrulestr);
67
68
  const eventRecurrenceMore = getEventRecurrenceMore(item, isEditMode);
68
69
  const listingText = <ListingText item={item} />;
69
- const image = ListingImage({
70
- item,
71
- className: 'item-image',
72
- loading: 'eager',
73
- sizes: '(max-width:425px) 400px, (max-width:767px) 520px, 650px',
74
- showTitleAttr: false,
75
- });
70
+ const hasImage = contentHasImage(item);
76
71
  const icon = getItemIcon(item);
77
72
  const BlockExtraTags = getComponentWithFallback({
78
73
  name: 'BlockExtraTags',
@@ -84,8 +79,16 @@ const ContentInEvidenceTemplate = (props) => {
84
79
 
85
80
  return (
86
81
  <Row key={item['@id']} className="content-in-evidence">
87
- {image && (
88
- <Col lg={{ size: 6, offset: 1, order: 2 }}>{image}</Col>
82
+ {hasImage && (
83
+ <Col lg={{ size: 6, offset: 1, order: 2 }}>
84
+ <ListingImage
85
+ item={item}
86
+ className="item-image"
87
+ loading="eager"
88
+ sizes="(max-width:425px) 400px, (max-width:767px) 520px, 650px"
89
+ showTitleAttr={false}
90
+ />
91
+ </Col>
89
92
  )}
90
93
  <Col lg={{ size: 5, order: 1 }}>
91
94
  <Card>
@@ -7,7 +7,7 @@ import {
7
7
  ListingLinkMore,
8
8
  } from 'design-comuni-plone-theme/components/ItaliaTheme';
9
9
  import { defineMessages, useIntl } from 'react-intl';
10
-
10
+ import { contentHasImage } from 'design-comuni-plone-theme/helpers';
11
11
  import PropTypes from 'prop-types';
12
12
  import React from 'react';
13
13
  import { UniversalLink } from '@plone/volto/components';
@@ -55,12 +55,11 @@ const GridGalleryTemplate = ({
55
55
  )}
56
56
  <div className="grid-gallery-grid">
57
57
  {items.map((item, index) => {
58
- let image = ListingImage({
59
- item,
60
- className: '',
61
- showTitleAttr: false,
62
- });
58
+ let image = (
59
+ <ListingImage item={item} className="" showTitleAttr={false} />
60
+ );
63
61
  let scale = null;
62
+ let hasImage = contentHasImage(item);
64
63
  if (index % 7 === 0 || index % 7 === 6 || index % 7 === 3) {
65
64
  scale = 'great';
66
65
  }
@@ -83,6 +82,7 @@ const GridGalleryTemplate = ({
83
82
  loading={critical ? 'eager' : 'lazy'}
84
83
  />
85
84
  );
85
+ hasImage = true;
86
86
  }
87
87
 
88
88
  return (
@@ -94,7 +94,7 @@ const GridGalleryTemplate = ({
94
94
  item={!isEditMode ? item : null}
95
95
  href={isEditMode ? '#' : null}
96
96
  >
97
- {image && (
97
+ {hasImage && (
98
98
  <picture className="volto-image responsive">
99
99
  {image}
100
100
  </picture>
@@ -23,6 +23,7 @@ import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
23
23
  import {
24
24
  getCalendarDate,
25
25
  getEventRecurrenceMore,
26
+ contentHasImage,
26
27
  } from 'design-comuni-plone-theme/helpers';
27
28
  import {
28
29
  CardCalendar,
@@ -87,11 +88,7 @@ const InEvidenceTemplate = (props) => {
87
88
  const listingText = show_description ? (
88
89
  <ListingText item={item} />
89
90
  ) : null;
90
- const image = ListingImage({
91
- item,
92
- sizes: '(max-width:320px) 200px, 300px',
93
- showTitleAttr: false,
94
- });
91
+ const hasImage = contentHasImage(item);
95
92
  const category = getCategory(item, show_type, show_section, props);
96
93
  const topics = show_topics ? item.tassonomia_argomenti : null;
97
94
 
@@ -103,7 +100,7 @@ const InEvidenceTemplate = (props) => {
103
100
  <CardPersona
104
101
  item={item}
105
102
  className="listing-item card-bg"
106
- showImage={image ? true : false}
103
+ showImage={hasImage}
107
104
  show_description={show_description}
108
105
  icon={icon}
109
106
  isEditMode={isEditMode}
@@ -111,10 +108,14 @@ const InEvidenceTemplate = (props) => {
111
108
  />
112
109
  ) : (
113
110
  <Card key={index} className={cx('listing-item card-bg')}>
114
- {index === 0 && image && (
111
+ {index === 0 && hasImage && (
115
112
  <div className="img-responsive-wrapper">
116
113
  <div className="img-responsive">
117
- {image}
114
+ <ListingImage
115
+ item={item}
116
+ sizes="(max-width:320px) 200px, 300px"
117
+ showTitleAttr={false}
118
+ />
118
119
  {item['@type'] === 'Event' && (
119
120
  <CardCalendar start={item.start} end={item.end} />
120
121
  )}
@@ -127,10 +127,10 @@ const PhotogalleryTemplate = ({
127
127
 
128
128
  const getCaption = (item) => item.description ?? item.rights ?? null;
129
129
 
130
- const figure = (image, item) => {
130
+ const figure = (imageProps, item) => {
131
131
  return (
132
132
  <figure className="img-wrapper volto-image responsive">
133
- {image}
133
+ <ListingImage {...imageProps} />
134
134
  {getCaption(item) && <figcaption>{getCaption(item)}</figcaption>}
135
135
  </figure>
136
136
  );
@@ -152,7 +152,7 @@ const PhotogalleryTemplate = ({
152
152
  <CarouselWrapper className="it-card-bg">
153
153
  <Slider {...settings} ref={slider}>
154
154
  {items.map((item, i) => {
155
- const image = ListingImage({
155
+ const imageProps = {
156
156
  item,
157
157
  sizes: `(max-width:600px) 450px, (max-width:1024px) ${
158
158
  items.length < 2 ? '1000' : '500'
@@ -164,7 +164,8 @@ const PhotogalleryTemplate = ({
164
164
  : '450'
165
165
  }px`,
166
166
  noWrapLink: true,
167
- });
167
+ showDefault: true,
168
+ };
168
169
  return (
169
170
  <SingleSlideWrapper
170
171
  className={cx('', {
@@ -179,7 +180,7 @@ const PhotogalleryTemplate = ({
179
180
  openLinkInNewTab={true}
180
181
  title={intl.formatMessage(messages.viewImage)}
181
182
  >
182
- {figure(image, item)}
183
+ {figure(imageProps, item)}
183
184
  </UniversalLink>
184
185
  ) : (
185
186
  <a
@@ -204,7 +205,7 @@ const PhotogalleryTemplate = ({
204
205
  messages.viewPreview,
205
206
  )} ${item.title}`}
206
207
  >
207
- {figure(image, item)}
208
+ {figure(imageProps, item)}
208
209
  </a>
209
210
  )}
210
211
  </SingleSlideWrapper>
@@ -218,12 +218,15 @@ const SliderTemplate = ({
218
218
 
219
219
  <Slider {...settings} ref={slider}>
220
220
  {items.map((item, index) => {
221
- const image = ListingImage({
222
- item,
223
- loading: index === 0 ? 'eager' : 'lazy',
224
- sizes: `max-width(991px) 620px, ${1300 / nSlidesToShow}px`,
225
- critical: true,
226
- });
221
+ const image = (
222
+ <ListingImage
223
+ item={item}
224
+ loading={index === 0 ? 'eager' : 'lazy'}
225
+ sizes={`max-width(991px) 620px, ${1300 / nSlidesToShow}px`}
226
+ critical
227
+ showDefault
228
+ />
229
+ );
227
230
  const nextIndex = index < items.length - 1 ? index + 1 : null;
228
231
  const prevIndex = index > 0 ? index - 1 : null;
229
232
  return (
@@ -6,7 +6,6 @@ import PropTypes from 'prop-types';
6
6
  import { Container, Row, Col } from 'design-react-kit';
7
7
  import { UniversalLink } from '@plone/volto/components';
8
8
  import cx from 'classnames';
9
-
10
9
  import {
11
10
  ListingLinkMore,
12
11
  ListingImage,
@@ -38,34 +37,31 @@ const SmallBlockLinksTemplate = ({
38
37
  )}
39
38
  <Row className="items">
40
39
  {items.map((item, index) => {
41
- const image = ListingImage({
42
- item,
43
- sizes: '(max-width:575px) 520px, 200px',
44
- style: {},
45
- alt: item.title,
46
- noWrapLink: true,
47
- });
48
-
49
40
  return (
50
41
  <Col
51
42
  md="3"
52
43
  key={item['@id']}
53
44
  className="col-item col-sm-4 col-lg-2"
54
45
  >
55
- {image && (
56
- <div className="center-image-card">
57
- <UniversalLink
58
- item={!isEditMode ? item : null}
59
- href={isEditMode ? '#' : ''}
60
- className="img-link"
61
- overrideMarkSpecialLinks={
62
- override_links_accessibility_marker
63
- }
64
- >
65
- {image}
66
- </UniversalLink>
67
- </div>
68
- )}
46
+ <div className="center-image-card">
47
+ <UniversalLink
48
+ item={!isEditMode ? item : null}
49
+ href={isEditMode ? '#' : ''}
50
+ className="img-link"
51
+ overrideMarkSpecialLinks={
52
+ override_links_accessibility_marker
53
+ }
54
+ >
55
+ <ListingImage
56
+ item={item}
57
+ sizes="(max-width:575px) 520px, 200px"
58
+ style={{}}
59
+ alt={item.title}
60
+ noWrapLink
61
+ showDefault
62
+ />
63
+ </UniversalLink>
64
+ </div>
69
65
  </Col>
70
66
  );
71
67
  })}
@@ -8,6 +8,7 @@ import {
8
8
  ListingCategory,
9
9
  ListingImage,
10
10
  } from 'design-comuni-plone-theme/components/ItaliaTheme';
11
+ import { contentHasImage } from 'design-comuni-plone-theme/helpers';
11
12
 
12
13
  export const CardPersona = ({
13
14
  item,
@@ -20,13 +21,7 @@ export const CardPersona = ({
20
21
  type,
21
22
  isEditMode,
22
23
  }) => {
23
- const image = ListingImage({
24
- item,
25
- sizes: '130px',
26
- showTitleAttr: false,
27
- });
28
-
29
- const hasImage = image !== null && showImage;
24
+ const hasImage = contentHasImage(item) && showImage;
30
25
 
31
26
  return (
32
27
  <Card
@@ -58,7 +53,9 @@ export const CardPersona = ({
58
53
  )}
59
54
  </CardBody>
60
55
  {hasImage && (
61
- <div className="card-image card-image-rounded">{image}</div>
56
+ <div className="card-image card-image-rounded">
57
+ <ListingImage item={item} sizes="130px" showTitleAttr={false} />
58
+ </div>
62
59
  )}
63
60
  </div>
64
61
  </Card>