From 0450e508fda15da90e02f164e09c04a69f48c7cf Mon Sep 17 00:00:00 2001 From: David Glick Date: Wed, 18 Dec 2024 14:29:12 -0800 Subject: [PATCH 1/2] Update links to kitconcept.com --- README.md | 16 ++++++++-------- packages/volto/README.md | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 9327b2f737..edc11c888f 100644 --- a/README.md +++ b/README.md @@ -142,12 +142,12 @@ To ensure your website gets the greatest exposure, add it both to [Awesome Volto - [Debako Udala / Ayuntamiento de Deba](https://www.deba.eus/eu) (Website of the municipality of Deba, developed by [CodeSyntax](https://www.codesyntax.com/en), 2022) - [European Environment Agency](https://www.eea.europa.eu/en) (Website of the European Environment Agency. Developed by [Eau de Web](https://eaudeweb.ro), 2023) - [Energy Climate Union portal for Europe](https://climate-energy.eea.europa.eu/) (Thematic website focusing on European strides towards mitigating climate change, developed by [Eau de Web](https://eaudeweb.ro/), 2020) -- [Excellence at Humboldt-Universität zu Berlin](https://www.alles-beginnt-mit-einer-frage.de) (Website for the excellence initiative of the [Humboldt University Berlin](https://www.hu-berlin.de/de), developed by [kitconcept GmbH](https://kitconcept.com), 2019) +- [Excellence at Humboldt-Universität zu Berlin](https://www.alles-beginnt-mit-einer-frage.de) (Website for the excellence initiative of the [Humboldt University Berlin](https://www.hu-berlin.de/de), developed by [kitconcept GmbH](https://kitconcept.com/en), 2019) - [Forest Information System for Europe](https://forest.eea.europa.eu) (Thematic website focusing on European forests, developed by [Eau de Web](https://eaudeweb.ro/), 2019) -- [Forschungszentrum Jülich](https://www.fz-juelich.de/de) (Website for Forschungzentrum Jülich, which is one of the largest research institutions in Europe, developed by [kitconcept GmbH](https://kitconcept.com), 2022) -- [German Aerospace Center (DLR)](https://www.dlr.de/de) (The German Aerospace Center (DLR) is the Federal Republic of Germany's research center for aeronautics. With more than 10.000 employees and a yearly budget of more than 1 billion euros, it is one of the largest research institutions in Germany, developed by [kitconcept GmbH](https://kitconcept.com), 2023) -- [Helmholtz-Institut Erlangen-Nürnberg für Erneuerbare Energien (HI-ERN)](https://www.hi-ern.de/de) (Website for HI ERN, a research institution for renewable energies, developed by [kitconcept GmbH](https://kitconcept.com), 2022) -- [Humboldt Labor](https://www.humboldtforum.org/de/programm/dauerangebot/ausstellung/nach-der-natur-14144/) (The Humboldt Lab is a website where the Humboldt University Berlin presents its latest research projects and findings. Developed by [WLDX](https://wldx.de/) and [kitconcept GmbH](https://kitconcept.com), 2020) +- [Forschungszentrum Jülich](https://www.fz-juelich.de/de) (Website for Forschungzentrum Jülich, which is one of the largest research institutions in Europe, developed by [kitconcept GmbH](https://kitconcept.com/en), 2022) +- [German Aerospace Center (DLR)](https://www.dlr.de/de) (The German Aerospace Center (DLR) is the Federal Republic of Germany's research center for aeronautics. With more than 10.000 employees and a yearly budget of more than 1 billion euros, it is one of the largest research institutions in Germany, developed by [kitconcept GmbH](https://kitconcept.com/en), 2023) +- [Helmholtz-Institut Erlangen-Nürnberg für Erneuerbare Energien (HI-ERN)](https://www.hi-ern.de/de) (Website for HI ERN, a research institution for renewable energies, developed by [kitconcept GmbH](https://kitconcept.com/en), 2022) +- [Humboldt Labor](https://www.humboldtforum.org/de/programm/dauerangebot/ausstellung/nach-der-natur-14144/) (The Humboldt Lab is a website where the Humboldt University Berlin presents its latest research projects and findings. Developed by [WLDX](https://wldx.de/) and [kitconcept GmbH](https://kitconcept.com/en), 2020) - [ILPO](https://ilpo.jyu.fi/) (the registration portal of continuous learning at the University of Jyväskylä. Developed by University of Jyväskylä, 2022) - [Industrial Emissions portal for Europe](https://industry.eea.europa.eu) (Thematic website focusing on European industrial emissions, developed by [Eau de Web](https://eaudeweb.ro/), 2020) - [Jobfamilie MEDICE](https://jobfamilie.medice.de/de) (Carrer website for MEDICE Arzneimittel Pütter GmbH & Co. KG), developed by [Werkbank GmbH](https://werkbank.de/), 2020) @@ -159,13 +159,13 @@ To ensure your website gets the greatest exposure, add it both to [Awesome Volto - [ResOU](https://resou.osaka-u.ac.jp/ja) (ResOU is introducing official researched releases by the University of Osaka, Japan. Developed by [CMScom](https://www.cmscom.jp), 2020) - [Stradanove](https://www.stradanove.it/) (Website of the Department of Youth Policies of the Municipality of Modena, developed by [RedTurtle](https://www.redturtle.it), 2020) - [Study guide at University of Jyväskylä](https://studyguide.jyu.fi/2020/en/) (Static website where [Volto is used as a headless CMS for authoring additional content](https://tech.blog.jyu.fi/2020/06/plone-volto-hasura-gatsbyjs-mashup/), 2020) -- [Talke Carrer Website](https://karriere.talke.com/) (Carrer website for [Talke](https://www.talke.com), one of the leading a chemical and petrochemical logistics companies in Germany, developed by [kitconcept GmbH](https://kitconcept.com), 2020) +- [Talke Carrer Website](https://karriere.talke.com/) (Carrer website for [Talke](https://www.talke.com), one of the leading a chemical and petrochemical logistics companies in Germany, developed by [kitconcept GmbH](https://kitconcept.com/en), 2020) - [UEU](https://www.ueu.eus) (Website for Udako Euskal Unibertsitatea, a non-profit University offering all its service only in Basque: courses, publications, ... developed by [CodeSyntax](https://www.codesyntax.com/en), 2023) - [Unione dei Comuni della Val Bisenzio](https://www.bisenzio.it/) (Website of the Municipality union of Val Bisenzio. Developed by [RedTurtle](https://www.redturtle.it), 2021) -- [VHS Ehrenamtsportal](https://vhs-ehrenamtsportal.de) (Website to help volunteers that help refugees for the [German Adult Education Association](https://www.volkshochschule.de/), developed by [kitconcept GmbH](https://kitconcept.com), 2018) +- [VHS Ehrenamtsportal](https://vhs-ehrenamtsportal.de) (Website to help volunteers that help refugees for the [German Adult Education Association](https://www.volkshochschule.de/), developed by [kitconcept GmbH](https://kitconcept.com/en), 2018) - [VisitModena](https://www.visitmodena.it/it) (Tourist website of the Municipality of Modena, developed by [RedTurtle](https://www.redturtle.it), 2020) - [WISE-Freshwater](https://water.europa.eu/freshwater) (WISE-Freshwater, the Freshwater Information System for Europe. Developed by [Eau de web](https://eaudeweb.ro) for the European Environmental Agency, 2021) -- [Zeelandia](https://www.zeelandia.de/) (Corporate website for one of the leading bakery ingredients manufacturers in Germany, developed by [kitconcept GmbH](https://kitconcept.com), 2019) +- [Zeelandia](https://www.zeelandia.de/) (Corporate website for one of the leading bakery ingredients manufacturers in Germany, developed by [kitconcept GmbH](https://kitconcept.com/en), 2019) ### Open-source websites built with Volto diff --git a/packages/volto/README.md b/packages/volto/README.md index 9327b2f737..edc11c888f 100644 --- a/packages/volto/README.md +++ b/packages/volto/README.md @@ -142,12 +142,12 @@ To ensure your website gets the greatest exposure, add it both to [Awesome Volto - [Debako Udala / Ayuntamiento de Deba](https://www.deba.eus/eu) (Website of the municipality of Deba, developed by [CodeSyntax](https://www.codesyntax.com/en), 2022) - [European Environment Agency](https://www.eea.europa.eu/en) (Website of the European Environment Agency. Developed by [Eau de Web](https://eaudeweb.ro), 2023) - [Energy Climate Union portal for Europe](https://climate-energy.eea.europa.eu/) (Thematic website focusing on European strides towards mitigating climate change, developed by [Eau de Web](https://eaudeweb.ro/), 2020) -- [Excellence at Humboldt-Universität zu Berlin](https://www.alles-beginnt-mit-einer-frage.de) (Website for the excellence initiative of the [Humboldt University Berlin](https://www.hu-berlin.de/de), developed by [kitconcept GmbH](https://kitconcept.com), 2019) +- [Excellence at Humboldt-Universität zu Berlin](https://www.alles-beginnt-mit-einer-frage.de) (Website for the excellence initiative of the [Humboldt University Berlin](https://www.hu-berlin.de/de), developed by [kitconcept GmbH](https://kitconcept.com/en), 2019) - [Forest Information System for Europe](https://forest.eea.europa.eu) (Thematic website focusing on European forests, developed by [Eau de Web](https://eaudeweb.ro/), 2019) -- [Forschungszentrum Jülich](https://www.fz-juelich.de/de) (Website for Forschungzentrum Jülich, which is one of the largest research institutions in Europe, developed by [kitconcept GmbH](https://kitconcept.com), 2022) -- [German Aerospace Center (DLR)](https://www.dlr.de/de) (The German Aerospace Center (DLR) is the Federal Republic of Germany's research center for aeronautics. With more than 10.000 employees and a yearly budget of more than 1 billion euros, it is one of the largest research institutions in Germany, developed by [kitconcept GmbH](https://kitconcept.com), 2023) -- [Helmholtz-Institut Erlangen-Nürnberg für Erneuerbare Energien (HI-ERN)](https://www.hi-ern.de/de) (Website for HI ERN, a research institution for renewable energies, developed by [kitconcept GmbH](https://kitconcept.com), 2022) -- [Humboldt Labor](https://www.humboldtforum.org/de/programm/dauerangebot/ausstellung/nach-der-natur-14144/) (The Humboldt Lab is a website where the Humboldt University Berlin presents its latest research projects and findings. Developed by [WLDX](https://wldx.de/) and [kitconcept GmbH](https://kitconcept.com), 2020) +- [Forschungszentrum Jülich](https://www.fz-juelich.de/de) (Website for Forschungzentrum Jülich, which is one of the largest research institutions in Europe, developed by [kitconcept GmbH](https://kitconcept.com/en), 2022) +- [German Aerospace Center (DLR)](https://www.dlr.de/de) (The German Aerospace Center (DLR) is the Federal Republic of Germany's research center for aeronautics. With more than 10.000 employees and a yearly budget of more than 1 billion euros, it is one of the largest research institutions in Germany, developed by [kitconcept GmbH](https://kitconcept.com/en), 2023) +- [Helmholtz-Institut Erlangen-Nürnberg für Erneuerbare Energien (HI-ERN)](https://www.hi-ern.de/de) (Website for HI ERN, a research institution for renewable energies, developed by [kitconcept GmbH](https://kitconcept.com/en), 2022) +- [Humboldt Labor](https://www.humboldtforum.org/de/programm/dauerangebot/ausstellung/nach-der-natur-14144/) (The Humboldt Lab is a website where the Humboldt University Berlin presents its latest research projects and findings. Developed by [WLDX](https://wldx.de/) and [kitconcept GmbH](https://kitconcept.com/en), 2020) - [ILPO](https://ilpo.jyu.fi/) (the registration portal of continuous learning at the University of Jyväskylä. Developed by University of Jyväskylä, 2022) - [Industrial Emissions portal for Europe](https://industry.eea.europa.eu) (Thematic website focusing on European industrial emissions, developed by [Eau de Web](https://eaudeweb.ro/), 2020) - [Jobfamilie MEDICE](https://jobfamilie.medice.de/de) (Carrer website for MEDICE Arzneimittel Pütter GmbH & Co. KG), developed by [Werkbank GmbH](https://werkbank.de/), 2020) @@ -159,13 +159,13 @@ To ensure your website gets the greatest exposure, add it both to [Awesome Volto - [ResOU](https://resou.osaka-u.ac.jp/ja) (ResOU is introducing official researched releases by the University of Osaka, Japan. Developed by [CMScom](https://www.cmscom.jp), 2020) - [Stradanove](https://www.stradanove.it/) (Website of the Department of Youth Policies of the Municipality of Modena, developed by [RedTurtle](https://www.redturtle.it), 2020) - [Study guide at University of Jyväskylä](https://studyguide.jyu.fi/2020/en/) (Static website where [Volto is used as a headless CMS for authoring additional content](https://tech.blog.jyu.fi/2020/06/plone-volto-hasura-gatsbyjs-mashup/), 2020) -- [Talke Carrer Website](https://karriere.talke.com/) (Carrer website for [Talke](https://www.talke.com), one of the leading a chemical and petrochemical logistics companies in Germany, developed by [kitconcept GmbH](https://kitconcept.com), 2020) +- [Talke Carrer Website](https://karriere.talke.com/) (Carrer website for [Talke](https://www.talke.com), one of the leading a chemical and petrochemical logistics companies in Germany, developed by [kitconcept GmbH](https://kitconcept.com/en), 2020) - [UEU](https://www.ueu.eus) (Website for Udako Euskal Unibertsitatea, a non-profit University offering all its service only in Basque: courses, publications, ... developed by [CodeSyntax](https://www.codesyntax.com/en), 2023) - [Unione dei Comuni della Val Bisenzio](https://www.bisenzio.it/) (Website of the Municipality union of Val Bisenzio. Developed by [RedTurtle](https://www.redturtle.it), 2021) -- [VHS Ehrenamtsportal](https://vhs-ehrenamtsportal.de) (Website to help volunteers that help refugees for the [German Adult Education Association](https://www.volkshochschule.de/), developed by [kitconcept GmbH](https://kitconcept.com), 2018) +- [VHS Ehrenamtsportal](https://vhs-ehrenamtsportal.de) (Website to help volunteers that help refugees for the [German Adult Education Association](https://www.volkshochschule.de/), developed by [kitconcept GmbH](https://kitconcept.com/en), 2018) - [VisitModena](https://www.visitmodena.it/it) (Tourist website of the Municipality of Modena, developed by [RedTurtle](https://www.redturtle.it), 2020) - [WISE-Freshwater](https://water.europa.eu/freshwater) (WISE-Freshwater, the Freshwater Information System for Europe. Developed by [Eau de web](https://eaudeweb.ro) for the European Environmental Agency, 2021) -- [Zeelandia](https://www.zeelandia.de/) (Corporate website for one of the leading bakery ingredients manufacturers in Germany, developed by [kitconcept GmbH](https://kitconcept.com), 2019) +- [Zeelandia](https://www.zeelandia.de/) (Corporate website for one of the leading bakery ingredients manufacturers in Germany, developed by [kitconcept GmbH](https://kitconcept.com/en), 2019) ### Open-source websites built with Volto From 928afbd1cb992ab833156f6a3bf52012b0f0ef25 Mon Sep 17 00:00:00 2001 From: Wesley Barroso Lopes Date: Wed, 18 Dec 2024 19:51:58 -0300 Subject: [PATCH 2/2] Show related items (#4381) Co-authored-by: Ichim David Co-authored-by: David Glick --- .../configuration/settings-reference.md | 12 ++- packages/types/src/config/Settings.d.ts | 1 + .../volto/locales/ca/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/de/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/en/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/es/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/eu/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/fi/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/fr/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/hi/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/it/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/ja/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/nl/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/pt/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/pt_BR/LC_MESSAGES/volto.po | 5 ++ .../volto/locales/ro/LC_MESSAGES/volto.po | 5 ++ packages/volto/locales/volto.pot | 5 ++ .../volto/locales/zh_CN/LC_MESSAGES/volto.po | 5 ++ packages/volto/news/3740.feature | 1 + .../theme/RelatedItems/RelatedItems.jsx | 70 ++++++++++++++++ .../theme/RelatedItems/RelatedItems.test.jsx | 83 +++++++++++++++++++ .../__snapshots__/RelatedItems.test.jsx.snap | 60 ++++++++++++++ packages/volto/src/config/index.js | 1 + packages/volto/src/config/slots.js | 5 ++ packages/volto/test-setup-config.jsx | 1 + .../theme/themes/pastanaga/extras/main.less | 5 ++ 26 files changed, 318 insertions(+), 1 deletion(-) create mode 100644 packages/volto/news/3740.feature create mode 100644 packages/volto/src/components/theme/RelatedItems/RelatedItems.jsx create mode 100644 packages/volto/src/components/theme/RelatedItems/RelatedItems.test.jsx create mode 100644 packages/volto/src/components/theme/RelatedItems/__snapshots__/RelatedItems.test.jsx.snap diff --git a/docs/source/configuration/settings-reference.md b/docs/source/configuration/settings-reference.md index 0f156cf8a9..b8601cffef 100644 --- a/docs/source/configuration/settings-reference.md +++ b/docs/source/configuration/settings-reference.md @@ -464,12 +464,22 @@ querystringSearchGet Please test this setting properly before enabling in a production site. cssLayers - To use CSS layers when styling Volto, you can define and apply them at the very top level of the page, where they appear in the `` tag. + To use CSS layers when styling Volto, you can define and apply them at the very top level of the page, where they appear in the `` tag. By using this configuration, you can pass the layer list definition as an array: ```js config.settings.cssLayers = ['reset', 'plone-components', 'layout', 'addons', 'theme']; ``` + +showRelatedItems + If true, the `RelatedItems` component will show items from the `relatedItems` field. Default: false. + + ```{versionadded} 18.5.0 + ``` + + +showTags + If true, the `Tags` component will show tags from the `subjects` field. Default: true. ``` ## Views settings diff --git a/packages/types/src/config/Settings.d.ts b/packages/types/src/config/Settings.d.ts index 61e87a8955..2053fde0f5 100644 --- a/packages/types/src/config/Settings.d.ts +++ b/packages/types/src/config/Settings.d.ts @@ -76,6 +76,7 @@ export interface SettingsConfig { serverConfig: unknown; storeExtenders: unknown[]; showTags: boolean; + showRelatedItems: boolean; controlpanels: unknown[]; controlPanelsIcons: Record; filterControlPanels: unknown; diff --git a/packages/volto/locales/ca/LC_MESSAGES/volto.po b/packages/volto/locales/ca/LC_MESSAGES/volto.po index f004a71968..3e7b0dfe67 100644 --- a/packages/volto/locales/ca/LC_MESSAGES/volto.po +++ b/packages/volto/locales/ca/LC_MESSAGES/volto.po @@ -2872,6 +2872,11 @@ msgstr "Registrar-se" msgid "Registration form" msgstr "Formulari d'inscripció" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/de/LC_MESSAGES/volto.po b/packages/volto/locales/de/LC_MESSAGES/volto.po index 688a7886f2..043109a013 100644 --- a/packages/volto/locales/de/LC_MESSAGES/volto.po +++ b/packages/volto/locales/de/LC_MESSAGES/volto.po @@ -2871,6 +2871,11 @@ msgstr "Registrieren" msgid "Registration form" msgstr "Registrierungsformular" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/en/LC_MESSAGES/volto.po b/packages/volto/locales/en/LC_MESSAGES/volto.po index 3ed645594c..9ad7a604aa 100644 --- a/packages/volto/locales/en/LC_MESSAGES/volto.po +++ b/packages/volto/locales/en/LC_MESSAGES/volto.po @@ -2866,6 +2866,11 @@ msgstr "" msgid "Registration form" msgstr "" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/es/LC_MESSAGES/volto.po b/packages/volto/locales/es/LC_MESSAGES/volto.po index 095307a2a0..ff5b8c2299 100644 --- a/packages/volto/locales/es/LC_MESSAGES/volto.po +++ b/packages/volto/locales/es/LC_MESSAGES/volto.po @@ -2873,6 +2873,11 @@ msgstr "Registro" msgid "Registration form" msgstr "Formulario de registro" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/eu/LC_MESSAGES/volto.po b/packages/volto/locales/eu/LC_MESSAGES/volto.po index a67988bc0c..aa260e34fa 100644 --- a/packages/volto/locales/eu/LC_MESSAGES/volto.po +++ b/packages/volto/locales/eu/LC_MESSAGES/volto.po @@ -2873,6 +2873,11 @@ msgstr "Izena eman" msgid "Registration form" msgstr "Erregistro formularioa" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/fi/LC_MESSAGES/volto.po b/packages/volto/locales/fi/LC_MESSAGES/volto.po index 595f3076a2..99c1f6ff04 100644 --- a/packages/volto/locales/fi/LC_MESSAGES/volto.po +++ b/packages/volto/locales/fi/LC_MESSAGES/volto.po @@ -2871,6 +2871,11 @@ msgstr "Rekisteröidy" msgid "Registration form" msgstr "Rekisteröitymislomake" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/fr/LC_MESSAGES/volto.po b/packages/volto/locales/fr/LC_MESSAGES/volto.po index ebc33cfdec..120eda4ebe 100644 --- a/packages/volto/locales/fr/LC_MESSAGES/volto.po +++ b/packages/volto/locales/fr/LC_MESSAGES/volto.po @@ -2873,6 +2873,11 @@ msgstr "S'enregistrer" msgid "Registration form" msgstr "Formulaire d'enregistrement" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/hi/LC_MESSAGES/volto.po b/packages/volto/locales/hi/LC_MESSAGES/volto.po index 3a381829f0..0219651642 100644 --- a/packages/volto/locales/hi/LC_MESSAGES/volto.po +++ b/packages/volto/locales/hi/LC_MESSAGES/volto.po @@ -2866,6 +2866,11 @@ msgstr "रजिस्टर करें" msgid "Registration form" msgstr "रजिस्ट्रेशन फ़ॉर्म" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/it/LC_MESSAGES/volto.po b/packages/volto/locales/it/LC_MESSAGES/volto.po index d5ae249f68..6cccb3d46b 100644 --- a/packages/volto/locales/it/LC_MESSAGES/volto.po +++ b/packages/volto/locales/it/LC_MESSAGES/volto.po @@ -2866,6 +2866,11 @@ msgstr "Registrati" msgid "Registration form" msgstr "Form di iscrizione" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/ja/LC_MESSAGES/volto.po b/packages/volto/locales/ja/LC_MESSAGES/volto.po index 6d51320e2d..e4c74c3188 100644 --- a/packages/volto/locales/ja/LC_MESSAGES/volto.po +++ b/packages/volto/locales/ja/LC_MESSAGES/volto.po @@ -2871,6 +2871,11 @@ msgstr "登録" msgid "Registration form" msgstr "登録フォーム" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/nl/LC_MESSAGES/volto.po b/packages/volto/locales/nl/LC_MESSAGES/volto.po index 2b038800b5..281135a55c 100644 --- a/packages/volto/locales/nl/LC_MESSAGES/volto.po +++ b/packages/volto/locales/nl/LC_MESSAGES/volto.po @@ -2870,6 +2870,11 @@ msgstr "Registreer" msgid "Registration form" msgstr "Registratie formulier" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/pt/LC_MESSAGES/volto.po b/packages/volto/locales/pt/LC_MESSAGES/volto.po index 61736fb8a3..8f4040495a 100644 --- a/packages/volto/locales/pt/LC_MESSAGES/volto.po +++ b/packages/volto/locales/pt/LC_MESSAGES/volto.po @@ -2871,6 +2871,11 @@ msgstr "Registar" msgid "Registration form" msgstr "Formulário de registo" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/pt_BR/LC_MESSAGES/volto.po b/packages/volto/locales/pt_BR/LC_MESSAGES/volto.po index aa504377c5..76a25c310c 100644 --- a/packages/volto/locales/pt_BR/LC_MESSAGES/volto.po +++ b/packages/volto/locales/pt_BR/LC_MESSAGES/volto.po @@ -2872,6 +2872,11 @@ msgstr "Cadastro" msgid "Registration form" msgstr "Formulário de cadastro" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "Itens relacionados" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/ro/LC_MESSAGES/volto.po b/packages/volto/locales/ro/LC_MESSAGES/volto.po index 58314bb461..9199570724 100644 --- a/packages/volto/locales/ro/LC_MESSAGES/volto.po +++ b/packages/volto/locales/ro/LC_MESSAGES/volto.po @@ -2872,6 +2872,11 @@ msgstr "Înregistrare" msgid "Registration form" msgstr "Formular de înregistrare" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/volto.pot b/packages/volto/locales/volto.pot index ba45f0fa1c..18436bc9bf 100644 --- a/packages/volto/locales/volto.pot +++ b/packages/volto/locales/volto.pot @@ -2868,6 +2868,11 @@ msgstr "" msgid "Registration form" msgstr "" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/locales/zh_CN/LC_MESSAGES/volto.po b/packages/volto/locales/zh_CN/LC_MESSAGES/volto.po index 0b08345f61..8b3aa94303 100644 --- a/packages/volto/locales/zh_CN/LC_MESSAGES/volto.po +++ b/packages/volto/locales/zh_CN/LC_MESSAGES/volto.po @@ -2872,6 +2872,11 @@ msgstr "注册" msgid "Registration form" msgstr "注册表单" +#. Default: "Related Items" +#: components/theme/RelatedItems/RelatedItems +msgid "Related Items" +msgstr "" + #. Default: "Relation" #: components/manage/Controlpanels/Relations/RelationsMatrix #: helpers/MessageLabels/MessageLabels diff --git a/packages/volto/news/3740.feature b/packages/volto/news/3740.feature new file mode 100644 index 0000000000..ed0c1b9313 --- /dev/null +++ b/packages/volto/news/3740.feature @@ -0,0 +1 @@ +Add component to show related items, which can be enabled using the `showRelatedItems` setting. @wesleybl diff --git a/packages/volto/src/components/theme/RelatedItems/RelatedItems.jsx b/packages/volto/src/components/theme/RelatedItems/RelatedItems.jsx new file mode 100644 index 0000000000..e0e121c377 --- /dev/null +++ b/packages/volto/src/components/theme/RelatedItems/RelatedItems.jsx @@ -0,0 +1,70 @@ +/** + * RelatedItems component. + * @module components/theme/RelatedItems/RelatedItems + */ + +import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink'; +import { defineMessages, useIntl } from 'react-intl'; +import PropTypes from 'prop-types'; +import { Container } from 'semantic-ui-react'; +import config from '@plone/volto/registry'; + +const messages = defineMessages({ + relatedItems: { + id: 'Related Items', + defaultMessage: 'Related Items', + }, +}); + +/** + * Related Items component. + * @function RelatedItems + * @param {array} relatedItems Array of related items. + * @returns {JSX.Element} Markup of the component. + */ +const RelatedItems = ({ content }) => { + const intl = useIntl(); + const relatedItems = content?.relatedItems; + if ( + !config.settings.showRelatedItems || + !relatedItems || + relatedItems.length === 0 + ) { + return null; + } + + return ( + +

{intl.formatMessage(messages.relatedItems)}

+
    + {relatedItems.map((relatedItem) => + relatedItem ? ( +
  • + + {relatedItem.title} + +
  • + ) : null, + )} +
+
+ ); +}; + +/** + * Property types. + * @property {Object} propTypes Property types. + * @static + */ +RelatedItems.propTypes = { + content: PropTypes.shape({ + relatedItems: PropTypes.arrayOf( + PropTypes.shape({ + '@id': PropTypes.string.isRequired, + title: PropTypes.string.isRequired, + }), + ), + }), +}; + +export default RelatedItems; diff --git a/packages/volto/src/components/theme/RelatedItems/RelatedItems.test.jsx b/packages/volto/src/components/theme/RelatedItems/RelatedItems.test.jsx new file mode 100644 index 0000000000..42647e24e2 --- /dev/null +++ b/packages/volto/src/components/theme/RelatedItems/RelatedItems.test.jsx @@ -0,0 +1,83 @@ +import renderer from 'react-test-renderer'; +import configureStore from 'redux-mock-store'; +import { Provider } from 'react-intl-redux'; +import { MemoryRouter } from 'react-router-dom'; + +import RelatedItems from './RelatedItems'; + +const mockStore = configureStore(); +let store; + +describe('Related Items', () => { + beforeEach(() => { + store = mockStore({ + intl: { + locale: 'en', + messages: {}, + }, + }); + }); + + it('renders without related items', () => { + const content = {}; + const component = renderer.create( + + + + + , + ); + const json = component.toJSON(); + expect(json).toMatchSnapshot(); + }); + + it('renders with related items', () => { + const content = { + relatedItems: [ + { + '@id': '/test-1', + title: 'Title 1', + description: 'Description 1', + }, + { + '@id': '/test-2', + title: 'Title 2', + description: 'Description 2', + }, + ], + }; + + const component = renderer.create( + + + + + , + ); + const json = component.toJSON(); + expect(json).toMatchSnapshot(); + }); + + it('renders with related items has null', () => { + const content = { + relatedItems: [ + { + '@id': '/test-1', + title: 'Title 1', + description: 'Description 1', + }, + null, + ], + }; + + const component = renderer.create( + + + + + , + ); + const json = component.toJSON(); + expect(json).toMatchSnapshot(); + }); +}); diff --git a/packages/volto/src/components/theme/RelatedItems/__snapshots__/RelatedItems.test.jsx.snap b/packages/volto/src/components/theme/RelatedItems/__snapshots__/RelatedItems.test.jsx.snap new file mode 100644 index 0000000000..1eef151979 --- /dev/null +++ b/packages/volto/src/components/theme/RelatedItems/__snapshots__/RelatedItems.test.jsx.snap @@ -0,0 +1,60 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Related Items renders with related items 1`] = ` +
+

+ Related Items +

+ +
+`; + +exports[`Related Items renders with related items has null 1`] = ` +
+

+ Related Items +

+ +
+`; + +exports[`Related Items renders without related items 1`] = `null`; diff --git a/packages/volto/src/config/index.js b/packages/volto/src/config/index.js index 48ab6e0159..0c8f57d0b6 100644 --- a/packages/volto/src/config/index.js +++ b/packages/volto/src/config/index.js @@ -141,6 +141,7 @@ let config = { serverConfig, storeExtenders: [], showTags: true, + showRelatedItems: false, controlpanels: [], controlPanelsIcons, filterControlPanels, diff --git a/packages/volto/src/config/slots.js b/packages/volto/src/config/slots.js index 008bada7e2..265b3573ce 100644 --- a/packages/volto/src/config/slots.js +++ b/packages/volto/src/config/slots.js @@ -1,3 +1,4 @@ +import RelatedItems from '@plone/volto/components/theme/RelatedItems/RelatedItems'; import Tags from '@plone/volto/components/theme/Tags/Tags'; const slots = { @@ -6,6 +7,10 @@ const slots = { name: 'tags', component: Tags, }, + { + name: 'relatedItems', + component: RelatedItems, + }, ], }; diff --git a/packages/volto/test-setup-config.jsx b/packages/volto/test-setup-config.jsx index 890205193a..4662306123 100644 --- a/packages/volto/test-setup-config.jsx +++ b/packages/volto/test-setup-config.jsx @@ -34,6 +34,7 @@ config.set('settings', { supportedLanguages: ['en'], defaultPageSize: 25, showTags: true, + showRelatedItems: true, isMultilingual: false, nonContentRoutes, nonContentRoutesPublic, diff --git a/packages/volto/theme/themes/pastanaga/extras/main.less b/packages/volto/theme/themes/pastanaga/extras/main.less index 1062b14845..d373cfb3c1 100644 --- a/packages/volto/theme/themes/pastanaga/extras/main.less +++ b/packages/volto/theme/themes/pastanaga/extras/main.less @@ -651,6 +651,11 @@ img.responsive { height: auto; } +// Related Items +.related-items { + margin-top: 20px; +} + // Deprecated as per https://github.com/plone/volto/issues/1265 // @import 'utils'; @import (multiple) '../extras/fonts';