Skip to content

Commit

Permalink
Merge pull request #163 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea authored Aug 29, 2023
2 parents a208b81 + b153c87 commit 755f7d2
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 33 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [1.20.0](https://github.com/eea/volto-eea-website-theme/compare/1.19.0...1.20.0) - 29 August 2023

#### :bug: Bug Fixes

- fix(tests): try fixing failing test on cypress [kreafox - [`6a3f261`](https://github.com/eea/volto-eea-website-theme/commit/6a3f261a1ff11245f40899cf8f75420077b993a6)]
- fix(tests): undo changes on BaseTag [kreafox - [`b74cbf2`](https://github.com/eea/volto-eea-website-theme/commit/b74cbf28276cddaa32cda6d7edceae0a6094b2ff)]
- fix(tests): comment BaseTag [kreafox - [`d1fd9d1`](https://github.com/eea/volto-eea-website-theme/commit/d1fd9d1d801c2a4de6e08aefd6f4f91076bb17f2)]

#### :house: Internal changes

- chore: remove volto-toc-block dependency - refs #256517 [dobri1408 - [`d465e45`](https://github.com/eea/volto-eea-website-theme/commit/d465e45f27416eef10a55edb85ecc75c6deaf774)]

#### :hammer_and_wrench: Others

- increase code covreage [Dobricean Ioan Dorian - [`4ff918e`](https://github.com/eea/volto-eea-website-theme/commit/4ff918edd9acb56dcbf466b759dbdd78b61b1218)]
- Release 1.20.0 [Alin Voinea - [`5fa90e1`](https://github.com/eea/volto-eea-website-theme/commit/5fa90e12d18db593400770fe48755cedda03a5e8)]
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`de90b72`](https://github.com/eea/volto-eea-website-theme/commit/de90b72fde94c2cf2245dfa49bd74cd9ea620f9f)]
- Cleanup [Tiberiu Ichim - [`248e953`](https://github.com/eea/volto-eea-website-theme/commit/248e9534364e550b8b0770f3f336c98e73cad434)]
- Maybe now [Tiberiu Ichim - [`361d026`](https://github.com/eea/volto-eea-website-theme/commit/361d0269c5f2ec5bad5e12727903a89aa3d1607d)]
- Protect against cypress [Tiberiu Ichim - [`64361fe`](https://github.com/eea/volto-eea-website-theme/commit/64361fefa5b2136c6b91b2f7e55ff56b5bc5bf15)]
- One more step [Tiberiu Ichim - [`858a7a3`](https://github.com/eea/volto-eea-website-theme/commit/858a7a317162316642722c30d867e9d0d04d79ea)]
- One more step [Tiberiu Ichim - [`6fd31d2`](https://github.com/eea/volto-eea-website-theme/commit/6fd31d2c17043d87acbaa786e0543d9ca1072aec)]
- Just Helmet [Tiberiu Ichim - [`56d38d9`](https://github.com/eea/volto-eea-website-theme/commit/56d38d929d50f06722e638f4fe9f46f8879b25a8)]
- Fix import [Tiberiu Ichim - [`14ecc8f`](https://github.com/eea/volto-eea-website-theme/commit/14ecc8fc41d5e35d4d16021cffc3eabe53a562c5)]
- Add client condition [Tiberiu Ichim - [`8c44a99`](https://github.com/eea/volto-eea-website-theme/commit/8c44a9962056a6e2864a57c324d60aab04928f8f)]
- Use Helmet again [Tiberiu Ichim - [`82aa4f3`](https://github.com/eea/volto-eea-website-theme/commit/82aa4f306f2a654bd9f2cc35de335eeaa35c6620)]
- Let's try this to make test pass [Tiberiu Ichim - [`327fdfb`](https://github.com/eea/volto-eea-website-theme/commit/327fdfbd2b730b19a4e8ea4907d5e4ae6018163a)]
- Refs #254325; add rss autodiscovery [Tiberiu Ichim - [`64d4df1`](https://github.com/eea/volto-eea-website-theme/commit/64d4df198880d9359dd6590fa000f71299971508)]
### [1.19.0](https://github.com/eea/volto-eea-website-theme/compare/1.18.1...1.19.0) - 17 August 2023

#### :bug: Bug Fixes
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ start: ## Start development environment
echo "Running: ${DOCKER_COMPOSE} up"
${DOCKER_COMPOSE} up

.PHONY: shell
shell: ## Start a shell in the frontend container
echo "Running: ${DOCKER_COMPOSE} run frontend bash"
${DOCKER_COMPOSE} run --entrypoint=bash frontend

.PHONY: cypress-open
cypress-open: ## Open cypress integration tests
NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open
Expand Down
38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
[![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-eea-website-theme-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-eea-website-theme-develop)
[![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-eea-website-theme-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-eea-website-theme-develop)


EEA Website [Volto](https://github.com/plone/volto) Theme

## Demo

- https://demo-www.eea.europa.eu
- https://www.eea.europa.eu

## Getting started

Expand All @@ -42,25 +41,25 @@ Go to http://localhost:3000

1. Start Volto frontend

* If you already have a volto project, just update `package.json`:
- If you already have a volto project, just update `package.json`:

```JSON
"addons": [
"@eeacms/volto-eea-website-theme"
],
```JSON
"addons": [
"@eeacms/volto-eea-website-theme"
],

"dependencies": {
"@eeacms/volto-eea-website-theme": "^1.0.0"
}
```
"dependencies": {
"@eeacms/volto-eea-website-theme": "^1.0.0"
}
```

* If not, create one:
- If not, create one:

```
npm install -g yo @plone/generator-volto
yo @plone/volto my-volto-project --addon @eeacms/volto-eea-website-theme
cd my-volto-project
```
```
npm install -g yo @plone/generator-volto
yo @plone/volto my-volto-project --addon @eeacms/volto-eea-website-theme
cd my-volto-project
```

1. Install new add-ons and restart Volto:

Expand All @@ -81,6 +80,11 @@ See [RELEASE.md](https://github.com/eea/volto-eea-website-theme/blob/master/RELE

See [DEVELOP.md](https://github.com/eea/volto-eea-website-theme/blob/master/DEVELOP.md).

## Docusaurus and Storybook

See [Docusaurus](https://eea.github.io/).
See [Storybook](https://eea.github.io/eea-storybook/).

## Copyright and license

The Initial Owner of the Original Code is European Environment Agency (EEA).
Expand Down
13 changes: 12 additions & 1 deletion cypress/e2e/01-block-basics.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,22 @@ describe('Blocks Tests', () => {

cy.getSlate().click();

// Add block
// test rss link
cy.get('.documentFirstHeading').click();
cy.get('a').contains('Block').click();
cy.get(`[aria-label="Add RSS Link"]`).click();
cy.get('#field-title-0-rssLinks-0').type('Test EEA Theme');
cy.get('#field-href-2-rssLinks-0').type('test.com');

//add a block
cy.getSlate().click();
cy.get('.ui.basic.icon.button.block-add-button').first().click();
cy.get('.blocks-chooser .title').contains('Media').click();
cy.get('.content.active.media .button.image').contains('Image').click();

// check banner rss link
cy.get('.button.rssfeed').click();

// Save
cy.get('#toolbar-save').click();
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
Expand Down
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
version: "3"
services:
backend:
image: plone/plone-backend:${PLONE_VERSION:-6}
image: eeacms/plone-backend
ports:
- "8080:8080"
environment:
SITE: "Plone"
PROFILES: "eea.kitkat:testing"

frontend:
build:
Expand All @@ -23,6 +24,9 @@ services:
volumes:
- ./:/app/src/addons/${ADDON_PATH}
environment:
CI: "true"
NODE_ENV: "development"
RAZZLE_JEST_CONFIG: "src/addons/${ADDON_PATH}/jest-addon.config.js"
RAZZLE_INTERNAL_API_PATH: "http://backend:8080/Plone"
RAZZLE_DEV_PROXY_API_PATH: "http://backend:8080/Plone"
HOST: "0.0.0.0"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-eea-website-theme",
"version": "1.19.0",
"version": "1.20.0",
"description": "@eeacms/volto-eea-website-theme: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
35 changes: 34 additions & 1 deletion src/components/manage/Blocks/Title/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,34 @@ const infoSchema = {
required: [],
};

const RSSLink = {
title: 'RSS Link',
fieldsets: [
{
id: 'default',
title: 'Default',
fields: ['title', 'feedType', 'href'],
},
],
properties: {
title: {
title: 'Title',
},
feedType: {
title: 'Feed Type',
choices: [
['rss2', 'RSS2'],
['atom', 'ATOM'],
],
default: 'rss2',
},
href: {
title: 'URL Path',
},
},
required: [],
};

export default {
title: 'Page header',
fieldsets: [
Expand All @@ -33,7 +61,7 @@ export default {
{
id: 'actions',
title: 'Actions',
fields: ['hideShareButton', 'hideDownloadButton'],
fields: ['hideShareButton', 'hideDownloadButton', 'rssLinks'],
},
{
id: 'copyright',
Expand Down Expand Up @@ -66,6 +94,11 @@ export default {
title: 'Hide download button',
type: 'boolean',
},
rssLinks: {
title: 'RSS Links',
widget: 'object_list',
schema: RSSLink,
},
info: {
title: 'Extra info',
widget: 'object_list',
Expand Down
31 changes: 31 additions & 0 deletions src/components/theme/Banner/View.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useCallback, useMemo, useRef } from 'react';
import { Helmet } from '@plone/volto/helpers';
import { compose } from 'redux';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
Expand Down Expand Up @@ -41,6 +42,10 @@ const messages = defineMessages({
id: 'Modified',
defaultMessage: 'Modified',
},
rssFeed: {
id: 'rssFeed',
defaultMessage: 'RSS Feed',
},
});

const friendlyId = (id) => {
Expand Down Expand Up @@ -74,6 +79,7 @@ const View = (props) => {
copyright,
copyrightIcon,
copyrightPosition,
rssLinks,
// contentType,
} = props.data;
const copyrightPrefix =
Expand Down Expand Up @@ -165,6 +171,31 @@ const View = (props) => {
}}
/>
)}
{rssLinks?.map((rssLink, index) => (
<>
<Helmet
link={[
{
rel: 'alternate',
title:
rssLink.title ?? intl.formatMessage(messages.rssFeed),
href: rssLink.href,
type:
rssLink.feedType === 'atom'
? 'application/atom+xml'
: 'application/rss+xml',
},
]}
/>
<Banner.Action
icon="ri-rss-fill"
title={rssLink.title ?? intl.formatMessage(messages.rssFeed)}
className="rssfeed"
href={rssLink.href}
target="_blank"
/>
</>
))}
</>
}
>
Expand Down
11 changes: 11 additions & 0 deletions src/components/theme/BaseTag.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useSelector } from 'react-redux';
import { flattenToAppURL, Helmet } from '@plone/volto/helpers';

export default function BaseTag(props) {
const contentId = useSelector((store) => store?.content?.data?.['@id']);
const baseHref = contentId ? flattenToAppURL(contentId) : null;

return baseHref !== null ? (
<Helmet base={{ target: '_blank', href: `${baseHref}/` }} />
) : null;
}
54 changes: 42 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
import * as eea from './config';
import InpageNavigation from '@eeacms/volto-eea-design-system/ui/InpageNavigation/InpageNavigation';
import installCustomTitle from '@eeacms/volto-eea-website-theme/components/manage/Blocks/Title';
import installLayoutSettingsBlock from '@eeacms/volto-eea-website-theme/components/manage/Blocks/LayoutSettings';
import { addStylingFieldsetSchemaEnhancer } from '@eeacms/volto-eea-website-theme/helpers/schema-utils';
import { Icon } from '@plone/volto/components';
import { getBlocks } from '@plone/volto/helpers';
import CustomCSS from '@eeacms/volto-eea-website-theme/components/theme/CustomCSS/CustomCSS';
import NotFound from '@eeacms/volto-eea-website-theme/components/theme/NotFound/NotFound';
import DraftBackground from '@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground';
import { TokenWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TokenWidget';
import HomePageInverseView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageInverseView';
import HomePageView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageView';
import InpageNavigation from '@eeacms/volto-eea-design-system/ui/InpageNavigation/InpageNavigation';
import NotFound from '@eeacms/volto-eea-website-theme/components/theme/NotFound/NotFound';
import { TopicsWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TopicsWidget';
import { TokenWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TokenWidget';

import { addStylingFieldsetSchemaEnhancer } from '@eeacms/volto-eea-website-theme/helpers/schema-utils';
import installCustomTitle from '@eeacms/volto-eea-website-theme/components/manage/Blocks/Title';
import installLayoutSettingsBlock from '@eeacms/volto-eea-website-theme/components/manage/Blocks/LayoutSettings';

import BaseTag from './components/theme/BaseTag';
import SubsiteClass from './components/theme/SubsiteClass';
import HomePageView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageView';
import HomePageInverseView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageInverseView';
import { Icon } from '@plone/volto/components';
import contentBoxSVG from './icons/content-box.svg';
import voltoCustomMiddleware from './middleware/voltoCustom';
import okMiddleware from './middleware/ok';

import installSlate from './slate';
import okMiddleware from './middleware/ok';
import voltoCustomMiddleware from './middleware/voltoCustom';

import * as eea from './config';

const restrictedBlocks = [
'__grid', // Grid/Teaser block (kitconcept)
Expand Down Expand Up @@ -120,6 +126,26 @@ const applyConfig = (config) => {
// Apply columns block customization
if (config.blocks.blocksConfig.columnsBlock) {
config.blocks.blocksConfig.columnsBlock.available_colors = eea.colors;
config.blocks.blocksConfig.columnsBlock.tocEntries = (
block = {},
tocData,
) => {
// integration with volto-block-toc
const headlines = tocData.levels || ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
let entries = [];
const sorted_column_blocks = getBlocks(block?.data || {});
sorted_column_blocks.forEach((column_block) => {
const sorted_blocks = getBlocks(column_block[1]);
sorted_blocks.forEach((block) => {
const { value, plaintext } = block[1];
const type = value?.[0]?.type;
if (headlines.includes(type)) {
entries.push([parseInt(type.slice(1)), plaintext, block[0]]);
}
});
});
return entries;
};
}

// Description block custom CSS
Expand Down Expand Up @@ -166,6 +192,10 @@ const applyConfig = (config) => {
match: '',
component: SubsiteClass,
},
{
match: '',
component: BaseTag,
},
];

config = installSlate(config);
Expand Down

0 comments on commit 755f7d2

Please sign in to comment.