From 204f28e21ea13a3381c3315c37b3e6ca91b3e7e3 Mon Sep 17 00:00:00 2001 From: Adrian Schulz Date: Mon, 13 May 2024 15:49:35 +0200 Subject: [PATCH 1/2] Introduce start and enddate within SummaryView for Listings including events --- .../manage/Blocks/Listing/SummaryTemplate.jsx | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/SummaryTemplate.jsx diff --git a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/SummaryTemplate.jsx b/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/SummaryTemplate.jsx new file mode 100644 index 0000000..a9de0cf --- /dev/null +++ b/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/SummaryTemplate.jsx @@ -0,0 +1,54 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { ConditionalLink, Component, FormattedDate } from '@plone/volto/components'; +import { flattenToAppURL } from '@plone/volto/helpers'; + +import { isInternalURL } from '@plone/volto/helpers/Url/Url'; + +const SummaryTemplate = ({ items, linkTitle, linkHref, isEditMode }) => { + let link = null; + let href = linkHref?.[0]?.['@id'] || ''; + + if (isInternalURL(href)) { + link = ( + + {linkTitle || href} + + ); + } else if (href) { + link = {linkTitle || href}; + } + + return ( + <> +
+ {items.map((item) => ( +
+ + +
+

{item.title || item.id}

+ { + item.start && item.end && ( +

-

+ ) + } +

{item.description}

+
+
+
+ ))} +
+ + {link &&
{link}
} + + ); +}; + +SummaryTemplate.propTypes = { + items: PropTypes.arrayOf(PropTypes.any).isRequired, + linkMore: PropTypes.any, + isEditMode: PropTypes.bool, +}; + +export default SummaryTemplate; From a772a6561fc9388fe109160c1f46deb74ee88605 Mon Sep 17 00:00:00 2001 From: Adrian Schulz Date: Mon, 13 May 2024 16:00:40 +0200 Subject: [PATCH 2/2] formatted shadowed summarytemplate --- .../manage/Blocks/Listing/SummaryTemplate.jsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/SummaryTemplate.jsx b/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/SummaryTemplate.jsx index a9de0cf..6f8fcae 100644 --- a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/SummaryTemplate.jsx +++ b/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/SummaryTemplate.jsx @@ -1,6 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { ConditionalLink, Component, FormattedDate } from '@plone/volto/components'; +import { + ConditionalLink, + Component, + FormattedDate, +} from '@plone/volto/components'; import { flattenToAppURL } from '@plone/volto/helpers'; import { isInternalURL } from '@plone/volto/helpers/Url/Url'; @@ -28,11 +32,12 @@ const SummaryTemplate = ({ items, linkTitle, linkHref, isEditMode }) => {

{item.title || item.id}

- { - item.start && item.end && ( -

-

- ) - } + {item.start && item.end && ( +

+ -{' '} + +

+ )}

{item.description}