@eeacms/volto-cca-policy 0.1.59 → 0.1.61
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 +15 -0
- package/package.json +1 -1
- package/src/components/manage/Blocks/RASTBlock/RASTAccordion.test.jsx +1 -1
- package/src/components/manage/Blocks/RASTBlock/RASTMap.jsx +7 -7
- package/src/components/manage/Blocks/RASTBlock/RASTView.jsx +4 -2
- package/src/components/manage/Blocks/RASTBlock/styles.less +6 -0
- package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderMenuPopUp.js +5 -3
- package/src/customizations/volto/components/manage/Controlpanels/ContentTypeLayout.jsx +519 -0
- package/src/index.js +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ 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
|
+
### [0.1.61](https://github.com/eea/volto-cca-policy/compare/0.1.60...0.1.61) - 17 January 2024
|
|
8
|
+
|
|
9
|
+
#### :bug: Bug Fixes
|
|
10
|
+
|
|
11
|
+
- fix: Add ContentTypeLayout customization [kreafox - [`06f4419`](https://github.com/eea/volto-cca-policy/commit/06f4419f4ffe29df43cc32f4faf0913a561bab0b)]
|
|
12
|
+
|
|
13
|
+
### [0.1.60](https://github.com/eea/volto-cca-policy/compare/0.1.59...0.1.60) - 16 January 2024
|
|
14
|
+
|
|
15
|
+
#### :hammer_and_wrench: Others
|
|
16
|
+
|
|
17
|
+
- Refs #257070 - Fix mega menu behavior, add configuration for visible folders and children. [GhitaB - [`c4d9108`](https://github.com/eea/volto-cca-policy/commit/c4d9108c50c5bbd10a5f1f913d7547aba71d2e8c)]
|
|
18
|
+
- Refs #260715 - rast map check rast accordiion test [Tripon Eugen - [`ed9805d`](https://github.com/eea/volto-cca-policy/commit/ed9805dbd39b648b2267758dd72510aba9214ab7)]
|
|
19
|
+
- Refs #260715 - rast map check root_path eslint [Tripon Eugen - [`23df223`](https://github.com/eea/volto-cca-policy/commit/23df223f6827e182e6a6a456cf1caae38ecd0bbb)]
|
|
20
|
+
- Refs #260715 - rast map check root_path not set [Tripon Eugen - [`8693b04`](https://github.com/eea/volto-cca-policy/commit/8693b0429985b2419581b2cbcf4993fa994961aa)]
|
|
21
|
+
- Refs #260715 - rast map align center [Tripon Eugen - [`b58c5cb`](https://github.com/eea/volto-cca-policy/commit/b58c5cb3d9ed08e3de2d3bb1dd3d0995f70a3c9e)]
|
|
7
22
|
### [0.1.59](https://github.com/eea/volto-cca-policy/compare/0.1.58...0.1.59) - 5 January 2024
|
|
8
23
|
|
|
9
24
|
#### :nail_care: Enhancements
|
package/package.json
CHANGED
|
@@ -70,7 +70,7 @@ export default function RASTMap(props) {
|
|
|
70
70
|
height="43"
|
|
71
71
|
rx="21.5"
|
|
72
72
|
stroke="white"
|
|
73
|
-
|
|
73
|
+
strokeWidth="2"
|
|
74
74
|
/>
|
|
75
75
|
</LinkWrap>
|
|
76
76
|
<LinkWrap
|
|
@@ -98,7 +98,7 @@ export default function RASTMap(props) {
|
|
|
98
98
|
height="43"
|
|
99
99
|
rx="21.5"
|
|
100
100
|
stroke="white"
|
|
101
|
-
|
|
101
|
+
strokeWidth="2"
|
|
102
102
|
/>
|
|
103
103
|
</LinkWrap>
|
|
104
104
|
<LinkWrap
|
|
@@ -126,7 +126,7 @@ export default function RASTMap(props) {
|
|
|
126
126
|
height="43"
|
|
127
127
|
rx="21.5"
|
|
128
128
|
stroke="white"
|
|
129
|
-
|
|
129
|
+
strokeWidth="2"
|
|
130
130
|
/>
|
|
131
131
|
</LinkWrap>
|
|
132
132
|
<LinkWrap
|
|
@@ -154,7 +154,7 @@ export default function RASTMap(props) {
|
|
|
154
154
|
height="43"
|
|
155
155
|
rx="21.5"
|
|
156
156
|
stroke="white"
|
|
157
|
-
|
|
157
|
+
strokeWidth="2"
|
|
158
158
|
/>
|
|
159
159
|
</LinkWrap>
|
|
160
160
|
<LinkWrap
|
|
@@ -182,7 +182,7 @@ export default function RASTMap(props) {
|
|
|
182
182
|
height="43"
|
|
183
183
|
rx="21.5"
|
|
184
184
|
stroke="white"
|
|
185
|
-
|
|
185
|
+
strokeWidth="2"
|
|
186
186
|
/>
|
|
187
187
|
</LinkWrap>
|
|
188
188
|
|
|
@@ -211,7 +211,7 @@ export default function RASTMap(props) {
|
|
|
211
211
|
height="43"
|
|
212
212
|
rx="21.5"
|
|
213
213
|
stroke="white"
|
|
214
|
-
|
|
214
|
+
strokeWidth="2"
|
|
215
215
|
/>
|
|
216
216
|
</LinkWrap>
|
|
217
217
|
|
|
@@ -362,7 +362,7 @@ export default function RASTMap(props) {
|
|
|
362
362
|
gradientUnits="userSpaceOnUse"
|
|
363
363
|
>
|
|
364
364
|
<stop stop-color="#BFDC80" />
|
|
365
|
-
<stop offset="1" stop-color="#AAD055"
|
|
365
|
+
<stop offset="1" stop-color="#AAD055" stopOpacity="0.1" />
|
|
366
366
|
</linearGradient>
|
|
367
367
|
</defs>
|
|
368
368
|
</svg>
|
|
@@ -23,8 +23,10 @@ export default function RASTView(props) {
|
|
|
23
23
|
if (typeof root_path === 'undefined') {
|
|
24
24
|
root_path = '/';
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
let items = useChildren(root_path);
|
|
27
|
+
if (root_path === '/') {
|
|
28
|
+
items = [];
|
|
29
|
+
}
|
|
28
30
|
|
|
29
31
|
return (
|
|
30
32
|
<div className="block rast-block">
|
|
@@ -347,9 +347,11 @@ function HeaderMenuPopUp({
|
|
|
347
347
|
);
|
|
348
348
|
|
|
349
349
|
const layout =
|
|
350
|
-
!!menuItemsLayouts &&
|
|
351
|
-
|
|
352
|
-
|
|
350
|
+
(!!menuItemsLayouts &&
|
|
351
|
+
Object.keys(menuItemsLayouts).includes(menuItem?.url) &&
|
|
352
|
+
menuItemsLayouts[menuItem.url]) ||
|
|
353
|
+
(!!menuItemsLayouts && menuItemsLayouts['*']) ||
|
|
354
|
+
{};
|
|
353
355
|
|
|
354
356
|
return (
|
|
355
357
|
<Transition visible={visible} animation="slide down" duration={300}>
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The render of the ContentTypeLayout component is customized (lines 441, 442)
|
|
3
|
+
* Handle the cases when the schema is undefined
|
|
4
|
+
* Content Type component.
|
|
5
|
+
* @module components/manage/Controlpanels/ContentTypeLayout
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React, { Component } from 'react';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import { connect } from 'react-redux';
|
|
11
|
+
import { compose } from 'redux';
|
|
12
|
+
import { Link } from 'react-router-dom';
|
|
13
|
+
import {
|
|
14
|
+
getParentUrl,
|
|
15
|
+
hasBlocksData,
|
|
16
|
+
getBlocksFieldname,
|
|
17
|
+
getBlocksLayoutFieldname,
|
|
18
|
+
} from '@plone/volto/helpers';
|
|
19
|
+
import { Portal } from 'react-portal';
|
|
20
|
+
import { Button, Segment } from 'semantic-ui-react';
|
|
21
|
+
import { toast } from 'react-toastify';
|
|
22
|
+
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
|
23
|
+
import { nth, join } from 'lodash';
|
|
24
|
+
import {
|
|
25
|
+
Error,
|
|
26
|
+
Form,
|
|
27
|
+
Icon,
|
|
28
|
+
Toolbar,
|
|
29
|
+
Sidebar,
|
|
30
|
+
Toast,
|
|
31
|
+
} from '@plone/volto/components';
|
|
32
|
+
import {
|
|
33
|
+
getSchema,
|
|
34
|
+
updateSchema,
|
|
35
|
+
getControlpanel,
|
|
36
|
+
updateControlpanel,
|
|
37
|
+
} from '@plone/volto/actions';
|
|
38
|
+
|
|
39
|
+
import saveSVG from '@plone/volto/icons/save.svg';
|
|
40
|
+
import clearSVG from '@plone/volto/icons/clear.svg';
|
|
41
|
+
import backSVG from '@plone/volto/icons/back.svg';
|
|
42
|
+
|
|
43
|
+
const messages = defineMessages({
|
|
44
|
+
changesSaved: {
|
|
45
|
+
id: 'Changes saved.',
|
|
46
|
+
defaultMessage: 'Changes saved.',
|
|
47
|
+
},
|
|
48
|
+
back: {
|
|
49
|
+
id: 'Back',
|
|
50
|
+
defaultMessage: 'Back',
|
|
51
|
+
},
|
|
52
|
+
save: {
|
|
53
|
+
id: 'Save',
|
|
54
|
+
defaultMessage: 'Save',
|
|
55
|
+
},
|
|
56
|
+
cancel: {
|
|
57
|
+
id: 'Cancel',
|
|
58
|
+
defaultMessage: 'Cancel',
|
|
59
|
+
},
|
|
60
|
+
info: {
|
|
61
|
+
id: 'Info',
|
|
62
|
+
defaultMessage: 'Info',
|
|
63
|
+
},
|
|
64
|
+
enable: {
|
|
65
|
+
id: 'Enable editable Blocks',
|
|
66
|
+
defaultMessage: 'Enable editable Blocks',
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* ContentTypeLayout class.
|
|
72
|
+
* @class ContentTypeLayout
|
|
73
|
+
* @extends Component
|
|
74
|
+
*/
|
|
75
|
+
class ContentTypeLayout extends Component {
|
|
76
|
+
/**
|
|
77
|
+
* Property types.
|
|
78
|
+
* @property {Object} propTypes Property types.
|
|
79
|
+
* @static
|
|
80
|
+
*/
|
|
81
|
+
static propTypes = {
|
|
82
|
+
updateControlpanel: PropTypes.func.isRequired,
|
|
83
|
+
getControlpanel: PropTypes.func.isRequired,
|
|
84
|
+
getSchema: PropTypes.func.isRequired,
|
|
85
|
+
updateSchema: PropTypes.func.isRequired,
|
|
86
|
+
id: PropTypes.string.isRequired,
|
|
87
|
+
parent: PropTypes.string.isRequired,
|
|
88
|
+
pathname: PropTypes.string.isRequired,
|
|
89
|
+
schemaRequest: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
90
|
+
cpanelRequest: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
91
|
+
schema: PropTypes.objectOf(PropTypes.any),
|
|
92
|
+
controlpanel: PropTypes.shape({
|
|
93
|
+
'@id': PropTypes.string,
|
|
94
|
+
data: PropTypes.object,
|
|
95
|
+
schema: PropTypes.object,
|
|
96
|
+
title: PropTypes.string,
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Default properties.
|
|
102
|
+
* @property {Object} defaultProps Default properties.
|
|
103
|
+
* @static
|
|
104
|
+
*/
|
|
105
|
+
static defaultProps = {
|
|
106
|
+
schema: {},
|
|
107
|
+
controlpanel: null,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Constructor
|
|
112
|
+
* @method constructor
|
|
113
|
+
* @param {Object} props Component properties
|
|
114
|
+
* @constructs ContentTypeLayout
|
|
115
|
+
*/
|
|
116
|
+
constructor(props) {
|
|
117
|
+
super(props);
|
|
118
|
+
|
|
119
|
+
this.state = {
|
|
120
|
+
visual: false,
|
|
121
|
+
content: null,
|
|
122
|
+
readOnlyBehavior: null,
|
|
123
|
+
error: null,
|
|
124
|
+
isClient: false,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
this.form = React.createRef();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Component did mount
|
|
132
|
+
* @method componentDidMount
|
|
133
|
+
* @returns {undefined}
|
|
134
|
+
*/
|
|
135
|
+
componentDidMount() {
|
|
136
|
+
this.props.getControlpanel(join([this.props.parent, this.props.id], '/'));
|
|
137
|
+
this.props.getSchema(this.props.id);
|
|
138
|
+
this.setState({ isClient: true });
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Component will receive props
|
|
143
|
+
* @method componentWillReceiveProps
|
|
144
|
+
* @param {Object} nextProps Next properties
|
|
145
|
+
* @returns {undefined}
|
|
146
|
+
*/
|
|
147
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
148
|
+
// Control Panel GET
|
|
149
|
+
if (
|
|
150
|
+
this.props.cpanelRequest.get.loading &&
|
|
151
|
+
nextProps.cpanelRequest.get.error
|
|
152
|
+
) {
|
|
153
|
+
this.setState({
|
|
154
|
+
error: nextProps.cpanelRequest.get.error,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Schema GET
|
|
159
|
+
if (this.props.schemaRequest.loading && nextProps.schemaRequest.loaded) {
|
|
160
|
+
const properties = nextProps.schema?.properties || {};
|
|
161
|
+
const content = {};
|
|
162
|
+
for (const key in properties) {
|
|
163
|
+
const value = properties[key].default;
|
|
164
|
+
if (value) {
|
|
165
|
+
content[key] = value;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (hasBlocksData(properties)) {
|
|
170
|
+
this.setState({
|
|
171
|
+
visual: true,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
const blocksFieldName = getBlocksFieldname(properties);
|
|
175
|
+
const blocksLayoutFieldname = getBlocksLayoutFieldname(properties);
|
|
176
|
+
content[blocksFieldName] = properties[blocksFieldName]?.default || {};
|
|
177
|
+
content[blocksLayoutFieldname] = properties[blocksLayoutFieldname]
|
|
178
|
+
?.default || { items: [] };
|
|
179
|
+
|
|
180
|
+
const blocksBehavior = properties[blocksFieldName]?.behavior || '';
|
|
181
|
+
this.setState({
|
|
182
|
+
readOnlyBehavior: !blocksBehavior.includes('generated')
|
|
183
|
+
? blocksBehavior
|
|
184
|
+
: '',
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
187
|
+
this.setState({
|
|
188
|
+
visual: false,
|
|
189
|
+
readOnlyBehavior: '',
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
this.setState({
|
|
194
|
+
content: content,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Schema updated
|
|
199
|
+
if (
|
|
200
|
+
this.props.schemaRequest.update.loading &&
|
|
201
|
+
nextProps.schemaRequest.update.loaded
|
|
202
|
+
) {
|
|
203
|
+
this.props.getSchema(this.props.id);
|
|
204
|
+
toast.info(
|
|
205
|
+
<Toast
|
|
206
|
+
info
|
|
207
|
+
title={this.props.intl.formatMessage(messages.info)}
|
|
208
|
+
content={this.props.intl.formatMessage(messages.changesSaved)}
|
|
209
|
+
/>,
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Blocks behavior disabled
|
|
214
|
+
if (
|
|
215
|
+
this.props.cpanelRequest.update.loading &&
|
|
216
|
+
nextProps.cpanelRequest.update.loaded
|
|
217
|
+
) {
|
|
218
|
+
this.onEnableBlocks();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Submit handler
|
|
224
|
+
* @method onSubmit
|
|
225
|
+
* @param {object} data Form data.
|
|
226
|
+
* @returns {undefined}
|
|
227
|
+
*/
|
|
228
|
+
onSubmit = (data) => {
|
|
229
|
+
const schema = { properties: {} };
|
|
230
|
+
Object.keys(data)
|
|
231
|
+
.filter((k) => data[k])
|
|
232
|
+
.forEach((k) => (schema.properties[k] = { default: data[k] }));
|
|
233
|
+
this.props.updateSchema(this.props.id, schema);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Cancel handler
|
|
238
|
+
* @method onCancel
|
|
239
|
+
* @returns {undefined}
|
|
240
|
+
*/
|
|
241
|
+
onCancel = () => {
|
|
242
|
+
const url = getParentUrl(this.props.pathname);
|
|
243
|
+
this.props.history.push(getParentUrl(url));
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Enable blocks handler
|
|
248
|
+
* @method onEnableBlocks
|
|
249
|
+
* @returns {undefined}
|
|
250
|
+
*/
|
|
251
|
+
onEnableBlocks = () => {
|
|
252
|
+
const { properties = {} } = this.props.schema;
|
|
253
|
+
const blocksFieldName = getBlocksFieldname(properties);
|
|
254
|
+
const blocksLayoutFieldname = getBlocksLayoutFieldname(properties);
|
|
255
|
+
const schema = {
|
|
256
|
+
fieldsets: [
|
|
257
|
+
{
|
|
258
|
+
id: 'layout',
|
|
259
|
+
title: 'Layout',
|
|
260
|
+
fields: ['blocks', 'blocks_layout'],
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
properties: {
|
|
264
|
+
blocks: {
|
|
265
|
+
title: 'Blocks',
|
|
266
|
+
type: 'dict',
|
|
267
|
+
widget: 'json',
|
|
268
|
+
factory: 'JSONField',
|
|
269
|
+
default: properties[blocksFieldName]?.default || {},
|
|
270
|
+
},
|
|
271
|
+
blocks_layout: {
|
|
272
|
+
title: 'Blocks Layout',
|
|
273
|
+
type: 'dict',
|
|
274
|
+
widget: 'json',
|
|
275
|
+
factory: 'JSONField',
|
|
276
|
+
default: properties[blocksLayoutFieldname]?.default || { items: [] },
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
this.props.updateSchema(this.props.id, schema);
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Disable Blocks behavior handler
|
|
285
|
+
* @method onDisableBlocksBehavior
|
|
286
|
+
* @returns {undefined}
|
|
287
|
+
*/
|
|
288
|
+
onDisableBlocksBehavior = () => {
|
|
289
|
+
this.props.updateControlpanel(this.props.controlpanel['@id'], {
|
|
290
|
+
[this.state.readOnlyBehavior]: false,
|
|
291
|
+
'volto.blocks.editable.layout': true,
|
|
292
|
+
});
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Enable Blocks behavior handler
|
|
297
|
+
* @method onEnableBlocksBehavior
|
|
298
|
+
* @returns {undefined}
|
|
299
|
+
*/
|
|
300
|
+
onEnableBlocksBehavior = () => {
|
|
301
|
+
this.props.updateControlpanel(this.props.controlpanel['@id'], {
|
|
302
|
+
'volto.blocks.editable.layout': true,
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Render method.
|
|
308
|
+
* @method render
|
|
309
|
+
* @returns {string} Markup for the component.
|
|
310
|
+
*/
|
|
311
|
+
render() {
|
|
312
|
+
// Error
|
|
313
|
+
if (this.state.error) {
|
|
314
|
+
return <Error error={this.state.error} />;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
if (!this.state.visual) {
|
|
318
|
+
// Still loading
|
|
319
|
+
if (!this.state.content) {
|
|
320
|
+
return <div />;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Blocks are not enabled
|
|
324
|
+
return (
|
|
325
|
+
<>
|
|
326
|
+
<Segment
|
|
327
|
+
placeholder
|
|
328
|
+
id="page-controlpanel-layout"
|
|
329
|
+
className="ui container center aligned"
|
|
330
|
+
>
|
|
331
|
+
<div>
|
|
332
|
+
<FormattedMessage
|
|
333
|
+
id="Can not edit Layout for <strong>{type}</strong> content-type as it doesn't have support for <strong>Volto Blocks</strong> enabled"
|
|
334
|
+
defaultMessage="Can not edit Layout for <strong>{type}</strong> content-type as it doesn't have support for <strong>Volto Blocks</strong> enabled"
|
|
335
|
+
values={{
|
|
336
|
+
strong: (...chunks) => <strong>{chunks}</strong>,
|
|
337
|
+
type: this.props?.controlpanel?.title || this.props.id,
|
|
338
|
+
}}
|
|
339
|
+
/>
|
|
340
|
+
</div>
|
|
341
|
+
<div className="ui divider"></div>
|
|
342
|
+
<Button
|
|
343
|
+
primary
|
|
344
|
+
onClick={this.onEnableBlocksBehavior}
|
|
345
|
+
content={this.props.intl.formatMessage(messages.enable)}
|
|
346
|
+
/>
|
|
347
|
+
</Segment>
|
|
348
|
+
<Portal
|
|
349
|
+
node={this.state.isClient && document.getElementById('toolbar')}
|
|
350
|
+
>
|
|
351
|
+
<Toolbar
|
|
352
|
+
pathname={this.props.pathname}
|
|
353
|
+
hideDefaultViewButtons
|
|
354
|
+
inner={
|
|
355
|
+
<>
|
|
356
|
+
<Link className="item" to="#" onClick={() => this.onCancel()}>
|
|
357
|
+
<Icon
|
|
358
|
+
name={backSVG}
|
|
359
|
+
size="30px"
|
|
360
|
+
className="contents circled"
|
|
361
|
+
title={this.props.intl.formatMessage(messages.back)}
|
|
362
|
+
/>
|
|
363
|
+
</Link>
|
|
364
|
+
</>
|
|
365
|
+
}
|
|
366
|
+
/>
|
|
367
|
+
</Portal>
|
|
368
|
+
</>
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (this.state.readOnlyBehavior) {
|
|
373
|
+
return (
|
|
374
|
+
<>
|
|
375
|
+
<Segment
|
|
376
|
+
placeholder
|
|
377
|
+
id="page-controlpanel-layout"
|
|
378
|
+
className="ui container center aligned"
|
|
379
|
+
>
|
|
380
|
+
<div>
|
|
381
|
+
<FormattedMessage
|
|
382
|
+
id="Can not edit Layout for <strong>{type}</strong> content-type as the <strong>Blocks behavior</strong> is enabled and <strong>read-only</strong>"
|
|
383
|
+
defaultMessage="Can not edit Layout for <strong>{type}</strong> content-type as the <strong>Blocks behavior</strong> is enabled and <strong>read-only</strong>"
|
|
384
|
+
values={{
|
|
385
|
+
strong: (...chunks) => <strong>{chunks}</strong>,
|
|
386
|
+
type: this.props?.controlpanel?.title || this.props.id,
|
|
387
|
+
}}
|
|
388
|
+
/>
|
|
389
|
+
</div>
|
|
390
|
+
<div className="ui divider"></div>
|
|
391
|
+
<Button
|
|
392
|
+
primary
|
|
393
|
+
onClick={this.onDisableBlocksBehavior}
|
|
394
|
+
content={this.props.intl.formatMessage(messages.enable)}
|
|
395
|
+
/>
|
|
396
|
+
</Segment>
|
|
397
|
+
<Portal
|
|
398
|
+
node={this.state.isClient && document.getElementById('toolbar')}
|
|
399
|
+
>
|
|
400
|
+
<Toolbar
|
|
401
|
+
pathname={this.props.pathname}
|
|
402
|
+
hideDefaultViewButtons
|
|
403
|
+
inner={
|
|
404
|
+
<>
|
|
405
|
+
<Link className="item" to="#" onClick={() => this.onCancel()}>
|
|
406
|
+
<Icon
|
|
407
|
+
name={backSVG}
|
|
408
|
+
size="30px"
|
|
409
|
+
className="contents circled"
|
|
410
|
+
title={this.props.intl.formatMessage(messages.back)}
|
|
411
|
+
/>
|
|
412
|
+
</Link>
|
|
413
|
+
</>
|
|
414
|
+
}
|
|
415
|
+
/>
|
|
416
|
+
</Portal>
|
|
417
|
+
</>
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// Render layout editor
|
|
422
|
+
const blocksFieldName = getBlocksFieldname(
|
|
423
|
+
this.props.schema?.properties || {},
|
|
424
|
+
);
|
|
425
|
+
const blocksLayoutFieldname = getBlocksLayoutFieldname(
|
|
426
|
+
this.props.schema?.properties || {},
|
|
427
|
+
);
|
|
428
|
+
return (
|
|
429
|
+
<div id="page-controlpanel-layout">
|
|
430
|
+
<Form
|
|
431
|
+
isAdminForm
|
|
432
|
+
ref={this.form}
|
|
433
|
+
schema={{
|
|
434
|
+
fieldsets: [
|
|
435
|
+
{
|
|
436
|
+
id: 'layout',
|
|
437
|
+
title: 'Layout',
|
|
438
|
+
fields: [blocksFieldName, blocksLayoutFieldname],
|
|
439
|
+
},
|
|
440
|
+
],
|
|
441
|
+
properties: {
|
|
442
|
+
...(this.props.schema?.properties[blocksFieldName] || {}),
|
|
443
|
+
...(this.props.schema?.properties[blocksLayoutFieldname] || {}),
|
|
444
|
+
// ...this.props.schema.properties[blocksFieldName],
|
|
445
|
+
// ...this.props.schema.properties[blocksLayoutFieldname],
|
|
446
|
+
},
|
|
447
|
+
required: [],
|
|
448
|
+
}}
|
|
449
|
+
formData={this.state.content}
|
|
450
|
+
onSubmit={this.onSubmit}
|
|
451
|
+
onCancel={this.onCancel}
|
|
452
|
+
pathname={this.props.pathname}
|
|
453
|
+
visual={this.state.visual}
|
|
454
|
+
hideActions
|
|
455
|
+
/>
|
|
456
|
+
<Portal
|
|
457
|
+
node={this.state.isClient && document.getElementById('sidebar')}
|
|
458
|
+
>
|
|
459
|
+
<Sidebar settingsTab={true} documentTab={false} />
|
|
460
|
+
</Portal>
|
|
461
|
+
<Portal
|
|
462
|
+
node={this.state.isClient && document.getElementById('toolbar')}
|
|
463
|
+
>
|
|
464
|
+
<Toolbar
|
|
465
|
+
pathname={this.props.pathname}
|
|
466
|
+
hideDefaultViewButtons
|
|
467
|
+
inner={
|
|
468
|
+
<>
|
|
469
|
+
<Button
|
|
470
|
+
id="toolbar-save"
|
|
471
|
+
className="save"
|
|
472
|
+
aria-label={this.props.intl.formatMessage(messages.save)}
|
|
473
|
+
onClick={() => this.form.current.onSubmit()}
|
|
474
|
+
disabled={this.props.schemaRequest.update.loading}
|
|
475
|
+
loading={this.props.schemaRequest.update.loading}
|
|
476
|
+
>
|
|
477
|
+
<Icon
|
|
478
|
+
name={saveSVG}
|
|
479
|
+
className="circled"
|
|
480
|
+
size="30px"
|
|
481
|
+
title={this.props.intl.formatMessage(messages.save)}
|
|
482
|
+
/>
|
|
483
|
+
</Button>
|
|
484
|
+
<Button
|
|
485
|
+
className="cancel"
|
|
486
|
+
aria-label={this.props.intl.formatMessage(messages.cancel)}
|
|
487
|
+
onClick={() => this.onCancel()}
|
|
488
|
+
>
|
|
489
|
+
<Icon
|
|
490
|
+
name={clearSVG}
|
|
491
|
+
className="circled"
|
|
492
|
+
size="30px"
|
|
493
|
+
title={this.props.intl.formatMessage(messages.cancel)}
|
|
494
|
+
/>
|
|
495
|
+
</Button>
|
|
496
|
+
</>
|
|
497
|
+
}
|
|
498
|
+
/>
|
|
499
|
+
</Portal>
|
|
500
|
+
</div>
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export default compose(
|
|
506
|
+
injectIntl,
|
|
507
|
+
connect(
|
|
508
|
+
(state, props) => ({
|
|
509
|
+
schema: state.schema.schema,
|
|
510
|
+
schemaRequest: state.schema,
|
|
511
|
+
cpanelRequest: state.controlpanels,
|
|
512
|
+
controlpanel: state.controlpanels.controlpanel,
|
|
513
|
+
pathname: props.location.pathname,
|
|
514
|
+
id: nth(props.location.pathname.split('/'), -2),
|
|
515
|
+
parent: nth(props.location.pathname.split('/'), -3),
|
|
516
|
+
}),
|
|
517
|
+
{ getSchema, updateSchema, getControlpanel, updateControlpanel },
|
|
518
|
+
),
|
|
519
|
+
)(ContentTypeLayout);
|
package/src/index.js
CHANGED
|
@@ -276,6 +276,19 @@ const applyConfig = (config) => {
|
|
|
276
276
|
},
|
|
277
277
|
];
|
|
278
278
|
|
|
279
|
+
// mega menu layout settings
|
|
280
|
+
config.settings.menuItemsLayouts = {
|
|
281
|
+
// '*': {
|
|
282
|
+
// hideChildrenFromNavigation: false,
|
|
283
|
+
// },
|
|
284
|
+
'/en/eu-policy': {
|
|
285
|
+
hideChildrenFromNavigation: false,
|
|
286
|
+
},
|
|
287
|
+
'/en/knowledge-1': {
|
|
288
|
+
hideChildrenFromNavigation: false,
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
|
|
279
292
|
// Custom results
|
|
280
293
|
config.settings.searchlib.resolve.HealthHorizontalCardItem = {
|
|
281
294
|
component: HealthHorizontalCardItem,
|