@eeacms/volto-eea-website-theme 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -3
- package/package.json +2 -2
- package/src/components/manage/Blocks/ContextNavigation/variations/Accordion.jsx +58 -12
- package/src/components/manage/Blocks/Title/index.js +0 -1
- package/src/components/manage/Blocks/Title/schema.js +18 -3
- package/src/components/manage/Blocks/Title/variations/WebReport.jsx +3 -2
- package/src/components/manage/Blocks/Title/variations/WebReportPage.jsx +5 -4
- package/src/components/theme/Banner/View.jsx +3 -1
- package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.jsx +7 -16
- package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.test.jsx +75 -0
- package/src/customizations/volto/components/theme/View/DefaultView.jsx +8 -3
- package/src/customizations/volto/reducers/breadcrumbs/breadcrumbs.js +98 -0
- package/src/index.js +3 -5
- package/src/components/manage/Blocks/Title/variations/styles.less +0 -28
package/CHANGELOG.md
CHANGED
@@ -4,11 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
4
4
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
6
6
|
|
7
|
-
### [3.
|
7
|
+
### [3.2.0](https://github.com/eea/volto-eea-website-theme/compare/3.1.0...3.2.0) - 11 November 2024
|
8
|
+
|
9
|
+
#### :hammer_and_wrench: Others
|
10
|
+
|
11
|
+
- Update package.json [Ichim David - [`4b5073b`](https://github.com/eea/volto-eea-website-theme/commit/4b5073b60a7d144597363f89d5cba6357baa9e19)]
|
12
|
+
### [3.1.0](https://github.com/eea/volto-eea-website-theme/compare/3.0.0...3.1.0) - 6 November 2024
|
8
13
|
|
9
14
|
#### :hammer_and_wrench: Others
|
10
15
|
|
11
|
-
- fix Grid conversion, ref #278618 [Miu Razvan - [`f80b786`](https://github.com/eea/volto-eea-website-theme/commit/f80b7869b4ac060bf35250cf5045ab930a0003de)]
|
12
16
|
## [3.0.0](https://github.com/eea/volto-eea-website-theme/compare/2.4.0...3.0.0) - 21 October 2024
|
13
17
|
|
14
18
|
#### :nail_care: Enhancements
|
@@ -115,7 +119,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
115
119
|
#### :hammer_and_wrench: Others
|
116
120
|
|
117
121
|
- modified param of dateIsInFuture to signal it's a string and not a date [David Ichim - [`e3243a0`](https://github.com/eea/volto-eea-website-theme/commit/e3243a075969a379462ba0b7889fe0d8b52af62a)]
|
118
|
-
## [2.0.0](https://github.com/eea/volto-eea-website-theme/compare/1.
|
122
|
+
## [2.0.0](https://github.com/eea/volto-eea-website-theme/compare/1.35.0...2.0.0) - 13 May 2024
|
119
123
|
|
120
124
|
#### :rocket: New Features
|
121
125
|
|
@@ -140,6 +144,18 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
140
144
|
#### :hammer_and_wrench: Others
|
141
145
|
|
142
146
|
- Bump package version to 2.0.0 to signal major release due to Volto 17 jump [David Ichim - [`ffe3049`](https://github.com/eea/volto-eea-website-theme/commit/ffe3049b3b656093a44f05044dbe7cd63bac495f)]
|
147
|
+
### [1.35.0](https://github.com/eea/volto-eea-website-theme/compare/1.34.0...1.35.0) - 6 November 2024
|
148
|
+
|
149
|
+
#### :bug: Bug Fixes
|
150
|
+
|
151
|
+
- fix(slate) - fix console error on list element - ref #278427 [kreafox - [`2ea7dd1`](https://github.com/eea/volto-eea-website-theme/commit/2ea7dd1488782db09ca3b8636a932930326f1175)]
|
152
|
+
- fix: cypress 13.1.0 [kreafox - [`0636604`](https://github.com/eea/volto-eea-website-theme/commit/0636604cf023730927c0006dcb146d5f9e086f1c)]
|
153
|
+
|
154
|
+
#### :hammer_and_wrench: Others
|
155
|
+
|
156
|
+
- Revert "Release 1.35.0" [alin - [`dcc318a`](https://github.com/eea/volto-eea-website-theme/commit/dcc318a5082e3c7fff44d00bfd9bb140c4efc21a)]
|
157
|
+
- Revert "1.35.1" [alin - [`6012bc6`](https://github.com/eea/volto-eea-website-theme/commit/6012bc68cf7a692fc964610a6071c82d4211fb2e)]
|
158
|
+
- Release 1.35.0 [kreafox - [`e21bee6`](https://github.com/eea/volto-eea-website-theme/commit/e21bee61e55e6c6b46d0119059f7a6063b0edad8)]
|
143
159
|
### [1.34.0](https://github.com/eea/volto-eea-website-theme/compare/1.33.2...1.34.0) - 9 May 2024
|
144
160
|
|
145
161
|
#### :bug: Bug Fixes
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@eeacms/volto-eea-website-theme",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.2.0",
|
4
4
|
"description": "@eeacms/volto-eea-website-theme: Volto add-on",
|
5
5
|
"main": "src/index.js",
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
@@ -24,8 +24,8 @@
|
|
24
24
|
"url": "git@github.com:eea/volto-eea-website-theme.git"
|
25
25
|
},
|
26
26
|
"dependencies": {
|
27
|
-
"@eeacms/volto-block-style": "*",
|
28
27
|
"@eeacms/volto-block-toc": "*",
|
28
|
+
"@eeacms/volto-block-style": "*",
|
29
29
|
"@eeacms/volto-eea-design-system": "*",
|
30
30
|
"@eeacms/volto-group-block": "*",
|
31
31
|
"volto-subsites": "*"
|
@@ -4,18 +4,15 @@ import React from 'react';
|
|
4
4
|
import { defineMessages, useIntl } from 'react-intl';
|
5
5
|
import { withRouter } from 'react-router';
|
6
6
|
import { compose } from 'redux';
|
7
|
-
import { Accordion } from 'semantic-ui-react';
|
7
|
+
import { Accordion, Icon } from 'semantic-ui-react';
|
8
8
|
|
9
9
|
import Slugger from 'github-slugger';
|
10
10
|
|
11
|
-
import {
|
11
|
+
import { UniversalLink, MaybeWrap } from '@plone/volto/components';
|
12
12
|
import { withContentNavigation } from '@plone/volto/components/theme/Navigation/withContentNavigation';
|
13
13
|
import withEEASideMenu from '@eeacms/volto-block-toc/hocs/withEEASideMenu';
|
14
14
|
import { flattenToAppURL } from '@plone/volto/helpers';
|
15
15
|
|
16
|
-
import downIcon from '@plone/volto/icons/down-key.svg';
|
17
|
-
import upIcon from '@plone/volto/icons/up-key.svg';
|
18
|
-
|
19
16
|
const messages = defineMessages({
|
20
17
|
navigation: {
|
21
18
|
id: 'Navigation',
|
@@ -33,6 +30,8 @@ const AccordionNavigation = ({
|
|
33
30
|
const navOpen = ['mobile', 'tablet'].includes(device) ? false : true;
|
34
31
|
const [isNavOpen, setIsNavOpen] = React.useState(navOpen);
|
35
32
|
const [activeItems, setActiveItems] = React.useState({});
|
33
|
+
const contextNavigationListRef = React.useRef(null);
|
34
|
+
const summaryRef = React.useRef(null);
|
36
35
|
|
37
36
|
const onClickSummary = React.useCallback((e) => {
|
38
37
|
e.preventDefault();
|
@@ -43,6 +42,26 @@ const AccordionNavigation = ({
|
|
43
42
|
if (isMenuOpenOnOutsideClick === false) setIsNavOpen(false);
|
44
43
|
}, [isMenuOpenOnOutsideClick]);
|
45
44
|
|
45
|
+
React.useEffect(() => {
|
46
|
+
if (!navOpen) {
|
47
|
+
const handleOutsideClick = (event) => {
|
48
|
+
if (
|
49
|
+
summaryRef.current &&
|
50
|
+
contextNavigationListRef.current &&
|
51
|
+
!summaryRef.current.contains(event.target) &&
|
52
|
+
!contextNavigationListRef.current.contains(event.target)
|
53
|
+
) {
|
54
|
+
setIsNavOpen(false);
|
55
|
+
}
|
56
|
+
};
|
57
|
+
|
58
|
+
document.addEventListener('click', handleOutsideClick);
|
59
|
+
return () => {
|
60
|
+
document.removeEventListener('click', handleOutsideClick);
|
61
|
+
};
|
62
|
+
}
|
63
|
+
}, [summaryRef, navOpen]);
|
64
|
+
|
46
65
|
const onKeyDownSummary = React.useCallback(
|
47
66
|
(e) => {
|
48
67
|
if (e.keyCode === 13 || e.keyCode === 32) {
|
@@ -95,7 +114,11 @@ const AccordionNavigation = ({
|
|
95
114
|
id={`accordion-title-${normalizedTitle}`}
|
96
115
|
>
|
97
116
|
<span className="title-text">{title}</span>
|
98
|
-
<Icon
|
117
|
+
<Icon
|
118
|
+
className={
|
119
|
+
isActive ? 'ri-arrow-up-s-line' : 'ri-arrow-down-s-line'
|
120
|
+
}
|
121
|
+
/>
|
99
122
|
</Accordion.Title>
|
100
123
|
<Accordion.Content
|
101
124
|
active={isActive}
|
@@ -127,20 +150,40 @@ const AccordionNavigation = ({
|
|
127
150
|
|
128
151
|
return items.length ? (
|
129
152
|
<>
|
130
|
-
<nav className="context-navigation">
|
153
|
+
<nav className="context-navigation" aria-label={title}>
|
131
154
|
<details open={isNavOpen}>
|
132
155
|
{/* eslint-disable-next-line */}
|
133
156
|
<summary
|
134
157
|
className="context-navigation-header accordion-header"
|
135
158
|
onClick={onClickSummary}
|
136
159
|
onKeyDown={onKeyDownSummary}
|
160
|
+
ref={summaryRef}
|
137
161
|
>
|
138
|
-
|
139
|
-
|
162
|
+
<MaybeWrap
|
163
|
+
condition={!navOpen}
|
164
|
+
className="ui container d-flex flex-items-center"
|
165
|
+
>
|
166
|
+
{has_custom_name
|
167
|
+
? title
|
168
|
+
: intl.formatMessage(messages.navigation)}
|
169
|
+
<Icon
|
170
|
+
className={
|
171
|
+
isNavOpen ? 'ri-arrow-up-s-line' : 'ri-arrow-down-s-line'
|
172
|
+
}
|
173
|
+
/>
|
174
|
+
</MaybeWrap>
|
140
175
|
</summary>
|
141
|
-
<
|
142
|
-
{
|
143
|
-
|
176
|
+
<MaybeWrap
|
177
|
+
condition={!navOpen}
|
178
|
+
className="ui container d-flex flex-items-center"
|
179
|
+
>
|
180
|
+
<ul
|
181
|
+
className="context-navigation-list accordion-list"
|
182
|
+
ref={contextNavigationListRef}
|
183
|
+
>
|
184
|
+
{items.map((item) => renderItems({ item }))}
|
185
|
+
</ul>
|
186
|
+
</MaybeWrap>
|
144
187
|
</details>
|
145
188
|
</nav>
|
146
189
|
</>
|
@@ -174,6 +217,9 @@ export default compose(
|
|
174
217
|
(WrappedComponent) => (props) =>
|
175
218
|
withEEASideMenu(WrappedComponent)({
|
176
219
|
...props,
|
220
|
+
targetParent: '.eea.header ',
|
221
|
+
fixedVisibilitySwitchTarget: '.main.bar',
|
222
|
+
insertBeforeOnMobile: '.banner',
|
177
223
|
shouldRender: props.navigation?.items?.length > 0,
|
178
224
|
}),
|
179
225
|
)(AccordionNavigation);
|
@@ -3,7 +3,6 @@ import View from './View';
|
|
3
3
|
import DefaultTemplate from './variations/Default';
|
4
4
|
import WebReport from './variations/WebReport';
|
5
5
|
import WebReportPage from './variations/WebReportPage';
|
6
|
-
import './variations/styles.less';
|
7
6
|
|
8
7
|
const applyConfig = (config) => {
|
9
8
|
config.blocks.blocksConfig.title = {
|
@@ -2,12 +2,20 @@ import alignTopSVG from '@plone/volto/icons/move-up.svg';
|
|
2
2
|
import alignCenterSVG from '@plone/volto/icons/row.svg';
|
3
3
|
import alignBottomSVG from '@plone/volto/icons/move-down.svg';
|
4
4
|
|
5
|
+
import alignTextLeftSVG from '@plone/volto/icons/align-left.svg';
|
6
|
+
import alignTextCenterSVG from '@plone/volto/icons/align-center.svg';
|
7
|
+
|
5
8
|
const ALIGN_INFO_MAP_IMAGE_POSITION = {
|
6
9
|
'has--bg--top': [alignTopSVG, 'Top'],
|
7
10
|
'has--bg--center': [alignCenterSVG, 'Center'],
|
8
11
|
'has--bg--bottom': [alignBottomSVG, 'Bottom'],
|
9
12
|
};
|
10
13
|
|
14
|
+
const ALIGN_INFO_MAP_TEXT_ALIGN = {
|
15
|
+
'has--text--left': [alignTextLeftSVG, 'Left'],
|
16
|
+
'has--text--center': [alignTextCenterSVG, 'Center'],
|
17
|
+
};
|
18
|
+
|
11
19
|
const infoSchema = {
|
12
20
|
title: 'Info',
|
13
21
|
fieldsets: [
|
@@ -145,8 +153,8 @@ const titleSchema = {
|
|
145
153
|
copyrightPosition: {
|
146
154
|
title: 'Align',
|
147
155
|
widget: 'style_align',
|
148
|
-
actions: ['left', 'right'],
|
149
|
-
defaultValue: '
|
156
|
+
actions: ['left', 'center', 'right'],
|
157
|
+
defaultValue: '',
|
150
158
|
},
|
151
159
|
styles: {
|
152
160
|
widget: 'object',
|
@@ -156,7 +164,7 @@ const titleSchema = {
|
|
156
164
|
{
|
157
165
|
id: 'default',
|
158
166
|
title: 'Default',
|
159
|
-
fields: ['bg'],
|
167
|
+
fields: ['bg', 'textAlign'],
|
160
168
|
},
|
161
169
|
],
|
162
170
|
properties: {
|
@@ -167,6 +175,13 @@ const titleSchema = {
|
|
167
175
|
actionsInfoMap: ALIGN_INFO_MAP_IMAGE_POSITION,
|
168
176
|
defaultValue: 'has--bg--center',
|
169
177
|
},
|
178
|
+
textAlign: {
|
179
|
+
title: 'Text align',
|
180
|
+
widget: 'style_align',
|
181
|
+
actions: Object.keys(ALIGN_INFO_MAP_TEXT_ALIGN),
|
182
|
+
actionsInfoMap: ALIGN_INFO_MAP_TEXT_ALIGN,
|
183
|
+
defaultValue: '',
|
184
|
+
},
|
170
185
|
},
|
171
186
|
required: [],
|
172
187
|
},
|
@@ -38,11 +38,12 @@ const WebReport = (props) => {
|
|
38
38
|
{...props}
|
39
39
|
data={{
|
40
40
|
...props.data,
|
41
|
-
|
42
|
-
aboveTitle: (
|
41
|
+
aboveTitle: !props.data.hideContentType ? (
|
43
42
|
<div className="content-type">
|
44
43
|
{props.data.content_type || props.properties.type_title}
|
45
44
|
</div>
|
45
|
+
) : (
|
46
|
+
' '
|
46
47
|
),
|
47
48
|
belowTitle: (
|
48
49
|
<>
|
@@ -32,12 +32,13 @@ const WebReportPage = (props) => {
|
|
32
32
|
{...props}
|
33
33
|
data={{
|
34
34
|
...props.data,
|
35
|
-
hideContentType: true,
|
36
35
|
aboveTitle: (
|
37
36
|
<>
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
{!props.data.hideContentType && (
|
38
|
+
<div className="content-type">
|
39
|
+
{props.data.content_type || props.properties.type_title}
|
40
|
+
</div>
|
41
|
+
)}
|
41
42
|
<div className="subtitle">{props.data.subtitle}</div>
|
42
43
|
</>
|
43
44
|
),
|
@@ -300,7 +300,9 @@ const View = (props) => {
|
|
300
300
|
<Banner.Metadata>
|
301
301
|
<Banner.MetadataField
|
302
302
|
type="type"
|
303
|
-
hidden={
|
303
|
+
hidden={
|
304
|
+
hideContentType || props.variation.id.indexOf('report') !== -1
|
305
|
+
}
|
304
306
|
value={type}
|
305
307
|
/>
|
306
308
|
<Banner.MetadataField
|
@@ -3,7 +3,7 @@
|
|
3
3
|
* @module components/theme/Breadcrumbs/Breadcrumbs
|
4
4
|
*/
|
5
5
|
|
6
|
-
import React, { useEffect
|
6
|
+
import React, { useEffect } from 'react';
|
7
7
|
import { useDispatch, useSelector } from 'react-redux';
|
8
8
|
|
9
9
|
import { useLocation } from 'react-router';
|
@@ -32,26 +32,17 @@ const isContentRoute = (pathname) => {
|
|
32
32
|
const Breadcrumbs = (props) => {
|
33
33
|
const dispatch = useDispatch();
|
34
34
|
const { items = [], root = '/' } = useSelector((state) => state?.breadcrumbs);
|
35
|
-
const
|
35
|
+
const token = useSelector((state) => state?.userSession?.token);
|
36
36
|
|
37
37
|
// const pathname = useSelector((state) => state.location.pathname);
|
38
38
|
const location = useLocation();
|
39
39
|
const { pathname } = location;
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
const type = content['@type'];
|
44
|
-
const isContentTypesToAvoid =
|
45
|
-
config.settings.contentTypeToAvoidAsLinks || {};
|
46
|
-
if (isContentTypesToAvoid[type]) {
|
47
|
-
return isContentTypesToAvoid[type];
|
48
|
-
}
|
49
|
-
}
|
50
|
-
}, [content]);
|
40
|
+
const contentTypesAsBreadcrumbSection = !token
|
41
|
+
? config.settings.contentTypesAsBreadcrumbSection
|
42
|
+
: [];
|
51
43
|
|
52
44
|
const sections = items.map((item) => ({
|
53
|
-
|
54
|
-
href: item.url,
|
45
|
+
...item,
|
55
46
|
key: item.title,
|
56
47
|
}));
|
57
48
|
|
@@ -71,7 +62,7 @@ const Breadcrumbs = (props) => {
|
|
71
62
|
pathname={pathname}
|
72
63
|
sections={sections}
|
73
64
|
root={root}
|
74
|
-
|
65
|
+
contentTypesAsBreadcrumbSection={contentTypesAsBreadcrumbSection}
|
75
66
|
/>
|
76
67
|
</React.Fragment>
|
77
68
|
);
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import renderer from 'react-test-renderer';
|
3
|
+
import configureStore from 'redux-mock-store';
|
4
|
+
import { Provider } from 'react-intl-redux';
|
5
|
+
import { MemoryRouter } from 'react-router-dom';
|
6
|
+
import config from '@plone/volto/registry';
|
7
|
+
|
8
|
+
import Breadcrumbs from './Breadcrumbs';
|
9
|
+
|
10
|
+
const mockStore = configureStore();
|
11
|
+
|
12
|
+
describe('Breadcrumbs', () => {
|
13
|
+
it('renders a breadcrumbs component', () => {
|
14
|
+
const store = mockStore({
|
15
|
+
breadcrumbs: {
|
16
|
+
items: [
|
17
|
+
{ title: 'Blog', url: '/blog' },
|
18
|
+
{ title: 'My first blog', url: '/blog/my-first-blog' },
|
19
|
+
],
|
20
|
+
},
|
21
|
+
intl: {
|
22
|
+
locale: 'en',
|
23
|
+
messages: {},
|
24
|
+
},
|
25
|
+
});
|
26
|
+
const component = renderer.create(
|
27
|
+
<Provider store={store}>
|
28
|
+
<MemoryRouter>
|
29
|
+
<Breadcrumbs pathname="/blog" />
|
30
|
+
</MemoryRouter>
|
31
|
+
</Provider>,
|
32
|
+
);
|
33
|
+
const json = component.toJSON();
|
34
|
+
expect(json).toMatchSnapshot();
|
35
|
+
});
|
36
|
+
|
37
|
+
it('renders breadcrumbs with contentTypesAsBreadcrumbSection', () => {
|
38
|
+
// Mock the config settings
|
39
|
+
config.settings = {
|
40
|
+
...config.settings,
|
41
|
+
contentTypesAsBreadcrumbSection: ['Folder', 'News Item'],
|
42
|
+
};
|
43
|
+
|
44
|
+
const store = mockStore({
|
45
|
+
breadcrumbs: {
|
46
|
+
items: [
|
47
|
+
{ title: 'Home', url: '/' },
|
48
|
+
{ title: 'News', url: '/news', portal_type: 'Folder' },
|
49
|
+
{
|
50
|
+
title: 'Latest Update',
|
51
|
+
url: '/news/latest-update',
|
52
|
+
portal_type: 'News Item',
|
53
|
+
},
|
54
|
+
],
|
55
|
+
},
|
56
|
+
intl: {
|
57
|
+
locale: 'en',
|
58
|
+
messages: {},
|
59
|
+
},
|
60
|
+
userSession: {
|
61
|
+
token: null,
|
62
|
+
},
|
63
|
+
});
|
64
|
+
|
65
|
+
const component = renderer.create(
|
66
|
+
<Provider store={store}>
|
67
|
+
<MemoryRouter>
|
68
|
+
<Breadcrumbs pathname="/news/latest-update" />
|
69
|
+
</MemoryRouter>
|
70
|
+
</Provider>,
|
71
|
+
);
|
72
|
+
const json = component.toJSON();
|
73
|
+
expect(json).toMatchSnapshot();
|
74
|
+
});
|
75
|
+
});
|
@@ -94,8 +94,13 @@ const DefaultView = (props) => {
|
|
94
94
|
|
95
95
|
const Container =
|
96
96
|
config.getComponent({ name: 'Container' }).component || SemanticContainer;
|
97
|
-
|
98
|
-
|
97
|
+
|
98
|
+
// choose last matching navigation path in case we get more specific paths
|
99
|
+
const matchingNavigationPath = navigation_paths.reduceRight(
|
100
|
+
(acc, navPath) => {
|
101
|
+
return acc || (path.includes(navPath.url) ? navPath : null);
|
102
|
+
},
|
103
|
+
null,
|
99
104
|
);
|
100
105
|
|
101
106
|
// If the content is not yet loaded, then do not show anything
|
@@ -113,7 +118,7 @@ const DefaultView = (props) => {
|
|
113
118
|
no_icons: matchingNavigationPath.no_icons || true,
|
114
119
|
root_path: matchingNavigationPath.url,
|
115
120
|
includeTop: matchingNavigationPath.includeTop || true,
|
116
|
-
bottomLevel: matchingNavigationPath.bottomLevel ||
|
121
|
+
bottomLevel: matchingNavigationPath.bottomLevel || 4,
|
117
122
|
topLevel: matchingNavigationPath.topLevel || 1,
|
118
123
|
currentFolderOnly:
|
119
124
|
matchingNavigationPath.currentFolderOnly || false,
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/**
|
2
|
+
* Breadcrumbs reducer.
|
3
|
+
* @module reducers/breadcrumbs/breadcrumbs
|
4
|
+
* Customized reducer as part of ticket 271001 in order to receive portal_type info
|
5
|
+
*/
|
6
|
+
|
7
|
+
import { map } from 'lodash';
|
8
|
+
import {
|
9
|
+
flattenToAppURL,
|
10
|
+
getBaseUrl,
|
11
|
+
hasApiExpander,
|
12
|
+
} from '@plone/volto/helpers';
|
13
|
+
|
14
|
+
import {
|
15
|
+
GET_BREADCRUMBS,
|
16
|
+
GET_CONTENT,
|
17
|
+
} from '@plone/volto/constants/ActionTypes';
|
18
|
+
|
19
|
+
const initialState = {
|
20
|
+
error: null,
|
21
|
+
items: [],
|
22
|
+
root: null,
|
23
|
+
loaded: false,
|
24
|
+
loading: false,
|
25
|
+
};
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Breadcrumbs reducer.
|
29
|
+
* @function breadcrumbs
|
30
|
+
* @param {Object} state Current state.
|
31
|
+
* @param {Object} action Action to be handled.
|
32
|
+
* @returns {Object} New state.
|
33
|
+
*/
|
34
|
+
export default function breadcrumbs(state = initialState, action = {}) {
|
35
|
+
let hasExpander;
|
36
|
+
switch (action.type) {
|
37
|
+
case `${GET_BREADCRUMBS}_PENDING`:
|
38
|
+
return {
|
39
|
+
...state,
|
40
|
+
error: null,
|
41
|
+
loaded: false,
|
42
|
+
loading: true,
|
43
|
+
};
|
44
|
+
case `${GET_CONTENT}_SUCCESS`:
|
45
|
+
hasExpander = hasApiExpander(
|
46
|
+
'breadcrumbs',
|
47
|
+
getBaseUrl(flattenToAppURL(action.result['@id'])),
|
48
|
+
);
|
49
|
+
if (hasExpander && !action.subrequest) {
|
50
|
+
return {
|
51
|
+
...state,
|
52
|
+
error: null,
|
53
|
+
items: map(
|
54
|
+
action.result['@components'].breadcrumbs.items,
|
55
|
+
(item) => ({
|
56
|
+
...item,
|
57
|
+
portal_type: item.portal_type,
|
58
|
+
url: flattenToAppURL(item['@id']),
|
59
|
+
}),
|
60
|
+
),
|
61
|
+
root: flattenToAppURL(action.result['@components'].breadcrumbs.root),
|
62
|
+
loaded: true,
|
63
|
+
loading: false,
|
64
|
+
};
|
65
|
+
}
|
66
|
+
return state;
|
67
|
+
case `${GET_BREADCRUMBS}_SUCCESS`:
|
68
|
+
hasExpander = hasApiExpander(
|
69
|
+
'breadcrumbs',
|
70
|
+
getBaseUrl(flattenToAppURL(action.result['@id'])),
|
71
|
+
);
|
72
|
+
if (!hasExpander) {
|
73
|
+
return {
|
74
|
+
...state,
|
75
|
+
error: null,
|
76
|
+
items: map(action.result.items, (item) => ({
|
77
|
+
...item,
|
78
|
+
portal_type: item.portal_type,
|
79
|
+
url: flattenToAppURL(item['@id']),
|
80
|
+
})),
|
81
|
+
root: flattenToAppURL(action.result.root),
|
82
|
+
loaded: true,
|
83
|
+
loading: false,
|
84
|
+
};
|
85
|
+
}
|
86
|
+
return state;
|
87
|
+
case `${GET_BREADCRUMBS}_FAIL`:
|
88
|
+
return {
|
89
|
+
...state,
|
90
|
+
error: action.error,
|
91
|
+
items: [],
|
92
|
+
loaded: false,
|
93
|
+
loading: false,
|
94
|
+
};
|
95
|
+
default:
|
96
|
+
return state;
|
97
|
+
}
|
98
|
+
}
|
package/src/index.js
CHANGED
@@ -495,11 +495,9 @@ const applyConfig = (config) => {
|
|
495
495
|
// },
|
496
496
|
};
|
497
497
|
|
498
|
-
//If you don't want to show the content type as a link in the breadcrumbs, you can set it
|
499
|
-
//
|
500
|
-
config.settings.
|
501
|
-
web_report_section: 2,
|
502
|
-
};
|
498
|
+
// If you don't want to show the content type as a link in the breadcrumbs, you can set it
|
499
|
+
// contentTypesAsBreadcrumbSection
|
500
|
+
config.settings.contentTypesAsBreadcrumbSection = ['web_report_section'];
|
503
501
|
|
504
502
|
// Group
|
505
503
|
if (config.blocks.blocksConfig.group) {
|
@@ -1,28 +0,0 @@
|
|
1
|
-
.view-viewview.light-header .main.bar {
|
2
|
-
position: relative;
|
3
|
-
z-index: 1;
|
4
|
-
width: 100%;
|
5
|
-
margin-bottom: -160px;
|
6
|
-
}
|
7
|
-
//Gradient styles for web report
|
8
|
-
.light-header .gradient {
|
9
|
-
background: linear-gradient(
|
10
|
-
0deg,
|
11
|
-
#ffffff,
|
12
|
-
rgba(255, 255, 255, 0.9) 30%,
|
13
|
-
rgba(46, 82, 114, 0.7) 70%,
|
14
|
-
rgba(14, 21, 26, 0.8) 100%
|
15
|
-
) !important;
|
16
|
-
}
|
17
|
-
|
18
|
-
.ui.block.title .eea.banner .content {
|
19
|
-
padding-right: 1rem;
|
20
|
-
padding-left: 1rem;
|
21
|
-
}
|
22
|
-
|
23
|
-
.share-popup {
|
24
|
-
.actions {
|
25
|
-
display: flex;
|
26
|
-
flex-flow: row;
|
27
|
-
}
|
28
|
-
}
|