forked from italia/design-comuni-plone-theme
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into bug_48229_sovrapposizione_etichetta_card_nastro
- Loading branch information
Showing
19 changed files
with
273 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
@@ -846,6 +846,7 @@ msgstr "" | |
msgid "assessore_riferimento" | ||
msgstr "" | ||
|
||
#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate | ||
#: components/ItaliaTheme/View/Commons/Attachment | ||
# defaultMessage: Allegato | ||
msgid "attachment" | ||
|
@@ -2287,6 +2288,7 @@ msgstr "" | |
msgid "legend_required" | ||
msgstr "" | ||
|
||
#: components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate | ||
#: components/ItaliaTheme/Blocks/SearchSections/SideBar | ||
# defaultMessage: Collegamento | ||
msgid "link" | ||
|
@@ -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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
src/components/ItaliaTheme/Blocks/Listing/AttachmentCardTemplate.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.