Skip to content

Commit

Permalink
Merge branch 'main' into bug_48229_sovrapposizione_etichetta_card_nastro
Browse files Browse the repository at this point in the history
  • Loading branch information
pnicolli authored Mar 27, 2024
2 parents 6dd65fb + 26ae362 commit c0773d4
Show file tree
Hide file tree
Showing 19 changed files with 273 additions and 18 deletions.
14 changes: 10 additions & 4 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,20 @@

## Versione X.X.X (dd/mm/yyyy)

### Fix

- L'etichetta della Card con Nastro (Blocco Elenco) non si sovrappone più all'immagine del nastro.

### Migliorie

- Migliorata l'accessibilità del bottone "Ricerca".
- Migliorata l'accessibilità del blocco Icone.

### Novità

- Aggiunto una nuova variazione del blocco elenco "Allegati" che permette di scaricare oggetti di tipo File o aprire l'anteprima di file PDF.

### Fix

- L'etichetta della Card con Nastro (Blocco Elenco) non si sovrappone più all'immagine del nastro.
- Aggiustato il layout della card per il CT persone quando è impostata un'immagine.

## Versione 11.8.0 (19/03/2024)

### Migliorie
Expand Down
12 changes: 12 additions & 0 deletions locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ msgstr ""
msgid "assessore_riferimento"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate
#: components/ItaliaTheme/View/Commons/Attachment
# defaultMessage: Allegato
msgid "attachment"
Expand Down Expand Up @@ -2300,6 +2301,7 @@ msgstr ""
msgid "legend_required"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate
#: components/ItaliaTheme/Blocks/SearchSections/SideBar
# defaultMessage: Collegamento
msgid "link"
Expand Down Expand Up @@ -3599,6 +3601,16 @@ msgstr ""
msgid "show_only_first_ribbon"
msgstr ""

#: config/Blocks/ListingOptions/attachmentCardTemplate
# defaultMessage: Permette di aprire l'anteprima di tutti i PDF di questo elenco in una tab separata altrimenti vengono scaricati.
msgid "show_pdf_desc"
msgstr ""

#: config/Blocks/ListingOptions/attachmentCardTemplate
# defaultMessage: Mostra i PDF in anteprima
msgid "show_pdf_preview"
msgstr ""

#: config/Blocks/ListingOptions/simpleListTemplate
# defaultMessage: Mostra elenco puntato
msgid "show_pointer_list"
Expand Down
12 changes: 12 additions & 0 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ msgstr "Councilor of"
msgid "assessore_riferimento"
msgstr "Reference councilor"

#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate
#: components/ItaliaTheme/View/Commons/Attachment
# defaultMessage: Allegato
msgid "attachment"
Expand Down Expand Up @@ -2285,6 +2286,7 @@ msgstr "Internal services or offices"
msgid "legend_required"
msgstr "Fields marked with (*) are required."

#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate
#: components/ItaliaTheme/Blocks/SearchSections/SideBar
# defaultMessage: Collegamento
msgid "link"
Expand Down Expand Up @@ -3584,6 +3586,16 @@ msgstr ""
msgid "show_only_first_ribbon"
msgstr ""

#: config/Blocks/ListingOptions/attachmentCardTemplate
# defaultMessage: Permette di aprire l'anteprima di tutti i PDF di questo elenco in una tab separata altrimenti vengono scaricati.
msgid "show_pdf_desc"
msgstr "Allows you to open the preview of all the PDFs in this list in a separate tab otherwise they will be downloaded."

#: config/Blocks/ListingOptions/attachmentCardTemplate
# defaultMessage: Mostra i PDF in anteprima
msgid "show_pdf_preview"
msgstr "Show PDFs in preview"

#: config/Blocks/ListingOptions/simpleListTemplate
# defaultMessage: Mostra elenco puntato
msgid "show_pointer_list"
Expand Down
12 changes: 12 additions & 0 deletions locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ msgstr "Concejal de"
msgid "assessore_riferimento"
msgstr "Concejal de referencia"

#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate
#: components/ItaliaTheme/View/Commons/Attachment
# defaultMessage: Allegato
msgid "attachment"
Expand Down Expand Up @@ -2294,6 +2295,7 @@ msgstr "Servicios internos u oficinas"
msgid "legend_required"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate
#: components/ItaliaTheme/Blocks/SearchSections/SideBar
# defaultMessage: Collegamento
msgid "link"
Expand Down Expand Up @@ -3593,6 +3595,16 @@ msgstr "Mostrar el mapa en ancho completo"
msgid "show_only_first_ribbon"
msgstr "Mostrar la cinta solo en la primera tarjeta"

#: config/Blocks/ListingOptions/attachmentCardTemplate
# defaultMessage: Permette di aprire l'anteprima di tutti i PDF di questo elenco in una tab separata altrimenti vengono scaricati.
msgid "show_pdf_desc"
msgstr "Le permite abrir la vista previa de todos los archivos PDF en esta lista en una pestaña separada, de lo contrario, se descargarán."

#: config/Blocks/ListingOptions/attachmentCardTemplate
# defaultMessage: Mostra i PDF in anteprima
msgid "show_pdf_preview"
msgstr "Mostrar archivos PDF en vista previa"

#: config/Blocks/ListingOptions/simpleListTemplate
# defaultMessage: Mostra elenco puntato
msgid "show_pointer_list"
Expand Down
12 changes: 12 additions & 0 deletions locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ msgstr "Conseiller de"
msgid "assessore_riferimento"
msgstr "Référence du conseiller"

#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate
#: components/ItaliaTheme/View/Commons/Attachment
# defaultMessage: Allegato
msgid "attachment"
Expand Down Expand Up @@ -2302,6 +2303,7 @@ msgstr ""
msgid "legend_required"
msgstr "Les champs marqués d'une (*) sont obligatoires."

#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate
#: components/ItaliaTheme/Blocks/SearchSections/SideBar
# defaultMessage: Collegamento
msgid "link"
Expand Down Expand Up @@ -3601,6 +3603,16 @@ msgstr ""
msgid "show_only_first_ribbon"
msgstr ""

#: config/Blocks/ListingOptions/attachmentCardTemplate
# defaultMessage: Permette di aprire l'anteprima di tutti i PDF di questo elenco in una tab separata altrimenti vengono scaricati.
msgid "show_pdf_desc"
msgstr "Permet d'ouvrir l'aperçu de tous les PDF de cette liste dans un onglet séparé sinon ils seront téléchargés."

#: config/Blocks/ListingOptions/attachmentCardTemplate
# defaultMessage: Mostra i PDF in anteprima
msgid "show_pdf_preview"
msgstr "Afficher les PDF en aperçu"

#: config/Blocks/ListingOptions/simpleListTemplate
# defaultMessage: Mostra elenco puntato
msgid "show_pointer_list"
Expand Down
12 changes: 12 additions & 0 deletions locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ msgstr "Assessore di"
msgid "assessore_riferimento"
msgstr "Assessore di riferimento"

#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate
#: components/ItaliaTheme/View/Commons/Attachment
# defaultMessage: Allegato
msgid "attachment"
Expand Down Expand Up @@ -2285,6 +2286,7 @@ msgstr "Servizi o uffici interni"
msgid "legend_required"
msgstr "I campi contrassegnati da (*) sono obbligatori."

#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate
#: components/ItaliaTheme/Blocks/SearchSections/SideBar
# defaultMessage: Collegamento
msgid "link"
Expand Down Expand Up @@ -3584,6 +3586,16 @@ msgstr "Mostra la mappa a tutta larghezza"
msgid "show_only_first_ribbon"
msgstr "Mostra il nastro solo sulla prima card"

#: config/Blocks/ListingOptions/attachmentCardTemplate
# defaultMessage: Permette di aprire l'anteprima di tutti i PDF di questo elenco in una tab separata altrimenti vengono scaricati.
msgid "show_pdf_desc"
msgstr "Permette di aprire l'anteprima di tutti i PDF di questo elenco in una tab separata altrimenti vengono scaricati."

#: config/Blocks/ListingOptions/attachmentCardTemplate
# defaultMessage: Mostra i PDF in anteprima
msgid "show_pdf_preview"
msgstr "Mostra i PDF in anteprima"

#: config/Blocks/ListingOptions/simpleListTemplate
# defaultMessage: Mostra elenco puntato
msgid "show_pointer_list"
Expand Down
14 changes: 13 additions & 1 deletion locales/volto.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plone\n"
"POT-Creation-Date: 2024-03-07T15:23:38.346Z\n"
"POT-Creation-Date: 2024-03-27T08:54:22.652Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -846,6 +846,7 @@ msgstr ""
msgid "assessore_riferimento"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate
#: components/ItaliaTheme/View/Commons/Attachment
# defaultMessage: Allegato
msgid "attachment"
Expand Down Expand Up @@ -2287,6 +2288,7 @@ msgstr ""
msgid "legend_required"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate
#: components/ItaliaTheme/Blocks/SearchSections/SideBar
# defaultMessage: Collegamento
msgid "link"
Expand Down Expand Up @@ -3586,6 +3588,16 @@ msgstr ""
msgid "show_only_first_ribbon"
msgstr ""

#: config/Blocks/ListingOptions/attachmentCardTemplate
# defaultMessage: Permette di aprire l'anteprima di tutti i PDF di questo elenco in una tab separata altrimenti vengono scaricati.
msgid "show_pdf_desc"
msgstr ""

#: config/Blocks/ListingOptions/attachmentCardTemplate
# defaultMessage: Mostra i PDF in anteprima
msgid "show_pdf_preview"
msgstr ""

#: config/Blocks/ListingOptions/simpleListTemplate
# defaultMessage: Mostra elenco puntato
msgid "show_pointer_list"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"volto-dropdownmenu": "4.1.1",
"volto-editablefooter": "5.1.0",
"volto-feedback": "0.3.0",
"volto-form-block": "3.7.1",
"volto-form-block": "3.7.2",
"volto-gdpr-privacy": "2.1.1",
"volto-google-analytics": "2.0.0",
"volto-multilingual-widget": "3.0.0",
Expand Down
116 changes: 116 additions & 0 deletions src/components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { defineMessages, useIntl } from 'react-intl';
import { UniversalLink } from '@plone/volto/components';
import { Container, Card, CardBody, CardTitle } from 'design-react-kit';
import {
Icon,
ListingLinkMore,
} from 'design-comuni-plone-theme/components/ItaliaTheme';

const messages = defineMessages({
link: {
id: 'link',
defaultMessage: 'Collegamento',
},
attachment: {
id: 'attachment',
defaultMessage: 'Allegato',
},
});

const AttachmentCardTemplate = ({
items,
isEditMode,
linkTitle,
linkHref,
show_pdf_preview,
show_block_bg,
title,
id_lighthouse,
linkAlign,
titleLine,
linkmore_id_lighthouse,
}) => {
const intl = useIntl();

return (
<Container className="px-4">
<div className="simple-card-compact-template">
{title && (
<h2
className={cx('mb-4', {
'mt-5': !show_block_bg,
'title-bottom-line': titleLine,
})}
>
{title}
</h2>
)}
<div className="card-wrapper card-teaser-wrapper card-teaser-wrapper-equal card-teaser-block-3 mb-3">
{items.map((item, index) => {
let itemUrl = { ...item };
if (item['@type'] === 'File') {
itemUrl = {
...item,
file: item,
'@id':
show_pdf_preview && item?.mime_type === 'application/pdf'
? item?.['@id'] + '/@@display-file/file'
: item?.['@id'] + '/@@download/file',
};
}

return (
<Card
className="card card-teaser shadow p-4 mt-3 rounded attachment"
noWrapper={true}
tag="div"
>
{item['@type'] === 'File' ? (
<Icon
icon="it-clip"
alt={intl.formatMessage(messages.attachment)}
/>
) : (
<Icon
icon="it-link"
alt={intl.formatMessage(messages.link)}
/>
)}
<CardBody tag="div">
<CardTitle tag="h5" className="mb-0">
<UniversalLink
item={!isEditMode ? itemUrl : null}
href={isEditMode ? '#' : null}
data-element={id_lighthouse}
>
{item.title || item.id}
</UniversalLink>
</CardTitle>
</CardBody>
</Card>
);
})}
</div>

<ListingLinkMore
title={linkTitle}
href={linkHref}
className="my-4"
linkAlign={linkAlign}
linkmoreIdLighthouse={linkmore_id_lighthouse}
/>
</div>
</Container>
);
};

AttachmentCardTemplate.propTypes = {
items: PropTypes.arrayOf(PropTypes.any).isRequired,
isEditMode: PropTypes.bool,
linkTitle: PropTypes.any,
};

export default AttachmentCardTemplate;
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ListingImage = ({
let commonImageProps = {
item,
'aria-hidden': true,
alt: '',
alt: imageProps.alt ?? '',
role: 'presentation',
className,
loading,
Expand All @@ -29,7 +29,6 @@ const ListingImage = ({
// photogallery needs to check for null image
// https://stackoverflow.com/questions/33136399/is-there-a-way-to-tell-if-reactelement-renders-null
const image = Image(commonImageProps);

if (image === null)
return showDefault ? <img src={DefaultImageSVG} alt="" /> : null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const CompleteBlockLinksTemplate = (props) => {
className: '',
sizes: '60px',
showTitleAttr: false,
alt: item.title,
});

const BlockExtraTags = getComponentWithFallback({
Expand Down
8 changes: 4 additions & 4 deletions src/components/ItaliaTheme/BrandText/BrandText.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ const BrandText = ({ mobile = false, subsite }) => {
const intl = useIntl();
return (
<div className="it-brand-text">
<h2 className="no_toc">
<p className="no_toc h2">
{subsite?.title || getSiteProperty('siteTitle', intl.locale)}
</h2>
<h3 className={cx('no_toc', { 'd-none d-md-block': !mobile })}>
</p>
<p className={cx('no_toc h3', { 'd-none d-md-block': !mobile })}>
{subsite?.description || getSiteProperty('siteSubtitle', intl.locale)}
</h3>
</p>
</div>
);
};
Expand Down
Loading

0 comments on commit c0773d4

Please sign in to comment.