Skip to content

Commit

Permalink
Merge pull request #215 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea authored Mar 13, 2024
2 parents bc5cbe0 + e53e930 commit c4791b7
Show file tree
Hide file tree
Showing 8 changed files with 751 additions and 10 deletions.
7 changes: 1 addition & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@ const defaultConfig = {
},
},
rules: {
'react/jsx-no-target-blank': [
'error',
{
allowReferrer: true,
},
],
'react/jsx-no-target-blank': 'off',
},
};

Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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.29.0](https://github.com/eea/volto-eea-website-theme/compare/1.28.3...1.29.0) - 7 March 2024
### [1.30.0](https://github.com/eea/volto-eea-website-theme/compare/1.29.0...1.30.0) - 13 March 2024

#### :rocket: New Features

Expand All @@ -21,13 +21,18 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- Update package.json [ichim-david - [`4c2f794`](https://github.com/eea/volto-eea-website-theme/commit/4c2f794256098dff98aa4b78ba99be65709b1b9b)]
- Fix export statement in reducers/index.js [David Ichim - [`bbaf5be`](https://github.com/eea/volto-eea-website-theme/commit/bbaf5be2e7cd24b6a8c5d694ee4030b6fafbd120)]
- Lint fix, export of print should be made after import [David Ichim - [`2a670db`](https://github.com/eea/volto-eea-website-theme/commit/2a670db0a9bcb741ea24ea3ac98ba7267b6a83e1)]
- test: TokenWidget.test.jsx and TopicsWidget.test.jsx cover more conditions [laszlocseh - [`dd154bb`](https://github.com/eea/volto-eea-website-theme/commit/dd154bb520237f458be563280cac1545eb381bdf)]
- Bump version to 1.29.0 from 1.28.4 [Claudia Ifrim - [`7bc8eab`](https://github.com/eea/volto-eea-website-theme/commit/7bc8eabd4b0462fc5afc07ed131d074af642cc89)]
- test: added TokenWidget.test.jsx and TopicsWidget.test.jsx [laszlocseh - [`f7292bb`](https://github.com/eea/volto-eea-website-theme/commit/f7292bb426591f758dcc7bc159b5dbd75b7afb36)]
- test: added HomePageView.test.jsx and HomePageInverseView.test.jsx [laszlocseh - [`2076651`](https://github.com/eea/volto-eea-website-theme/commit/2076651820693825b5e20b0a7774307cd78eeb57)]
- test: fix in Logo.test.jsx [laszlocseh - [`6d552f8`](https://github.com/eea/volto-eea-website-theme/commit/6d552f89d5aff6e47ef3032d4862a1bcbe364c01)]
- test: add Logo.test.jsx [laszlocseh - [`752c562`](https://github.com/eea/volto-eea-website-theme/commit/752c5629840d906382858f088b97d33147684ca8)]
- add isPrint missing files [laszlocseh - [`d995789`](https://github.com/eea/volto-eea-website-theme/commit/d995789f337a00455d45b5ec26de9c4c0c898ce6)]
### [1.29.0](https://github.com/eea/volto-eea-website-theme/compare/1.28.3...1.29.0) - 7 March 2024

### [1.28.3](https://github.com/eea/volto-eea-website-theme/compare/1.28.2...1.28.3) - 5 March 2024

#### :bug: Bug Fixes
Expand Down
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.29.0",
"version": "1.30.0",
"description": "@eeacms/volto-eea-website-theme: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Copyright } from '@eeacms/volto-eea-design-system/ui';
*/
export const View = (props) => {
const { data, detached } = props;
const href = data?.href?.[0]?.['@id'] || '';
const href = data?.href?.[0]?.['@id'] ?? (data?.href || '');
const { copyright, copyrightIcon, copyrightPosition } = data;
// const [hovering, setHovering] = React.useState(false);
const [viewLoaded, setViewLoaded] = React.useState(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
//this customization is used for fixing: in the search block, on edit sort on and reversed order doesn't work.
//See here volto pr: https://github.com/plone/volto/pull/5262
import React, { useEffect } from 'react';
import { defineMessages } from 'react-intl';
import { compose } from 'redux';

import { SidebarPortal, BlockDataForm } from '@plone/volto/components';
import { addExtensionFieldToSchema } from '@plone/volto/helpers/Extensions/withBlockSchemaEnhancer';
import { getBaseUrl } from '@plone/volto/helpers';
import config from '@plone/volto/registry';

import { SearchBlockViewComponent } from '@plone/volto/components/manage/Blocks/Search/SearchBlockView';
import Schema from '@plone/volto/components/manage/Blocks/Search/schema';
import {
withSearch,
withQueryString,
} from '@plone/volto/components/manage/Blocks/Search/hocs';
import { cloneDeep } from 'lodash';

const messages = defineMessages({
template: {
id: 'Results template',
defaultMessage: 'Results template',
},
});

const SearchBlockEdit = (props) => {
const {
block,
onChangeBlock,
data,
selected,
intl,
navRoot,
contentType,
onTriggerSearch,
querystring = {},
} = props;
const { sortable_indexes = {} } = querystring;

let schema = Schema({ data, intl });

schema = addExtensionFieldToSchema({
schema,
name: 'listingBodyTemplate',
items: config.blocks.blocksConfig.listing.variations,
intl,
title: { id: intl.formatMessage(messages.template) },
});
const listingVariations = config.blocks.blocksConfig?.listing?.variations;
let activeItem = listingVariations.find(
(item) => item.id === data.listingBodyTemplate,
);
const listingSchemaEnhancer = activeItem?.schemaEnhancer;
if (listingSchemaEnhancer)
schema = listingSchemaEnhancer({
schema: cloneDeep(schema),
data,
intl,
});
schema.properties.sortOnOptions.items = {
choices: Object.keys(sortable_indexes).map((k) => [
k,
sortable_indexes[k].title,
]),
};

const { query = {} } = data || {};
// We don't need deep compare here, as this is just json serializable data.
const deepQuery = JSON.stringify(query);
useEffect(() => {
onTriggerSearch(
'',
data?.facets,
data?.query?.sort_on,
data?.query?.sort_order,
);
}, [deepQuery, onTriggerSearch, data]);

return (
<>
<SearchBlockViewComponent
{...props}
path={getBaseUrl(props.pathname)}
mode="edit"
/>
<SidebarPortal selected={selected}>
<BlockDataForm
schema={schema}
onChangeField={(id, value) => {
onChangeBlock(block, {
...data,
[id]: value,
});
}}
onChangeBlock={onChangeBlock}
formData={data}
navRoot={navRoot}
contentType={contentType}
/>
</SidebarPortal>
</>
);
};

export default compose(withQueryString, withSearch())(SearchBlockEdit);
Loading

0 comments on commit c4791b7

Please sign in to comment.