@eeacms/volto-cca-policy 0.1.60 → 0.1.62
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 +17 -0
- package/package.json +1 -1
- package/src/customizations/volto/components/manage/Controlpanels/ContentTypeLayout.jsx +519 -0
- package/src/search/mission_stories/config-stories.js +17 -7
- package/src/search/utils.js +16 -0
- package/theme/globals/mission.less +129 -0
- package/theme/globals/site.overrides +1 -129
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ 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.62](https://github.com/eea/volto-cca-policy/compare/0.1.61...0.1.62) - 19 January 2024
|
|
8
|
+
|
|
9
|
+
#### :bug: Bug Fixes
|
|
10
|
+
|
|
11
|
+
- fix: preview image in search listing [kreafox - [`e164430`](https://github.com/eea/volto-cca-policy/commit/e1644300d19fa58fa69fdd0e5b23041809ca69a6)]
|
|
12
|
+
- fix: stories search listing + show images [kreafox - [`081ff11`](https://github.com/eea/volto-cca-policy/commit/081ff115adfcab58dfe8e7f9fce09cc71e9281f5)]
|
|
13
|
+
|
|
14
|
+
#### :nail_care: Enhancements
|
|
15
|
+
|
|
16
|
+
- change: separate mission styling [kreafox - [`a3d972c`](https://github.com/eea/volto-cca-policy/commit/a3d972ce871649af92f2c9b7ba8abcdfff969852)]
|
|
17
|
+
|
|
18
|
+
### [0.1.61](https://github.com/eea/volto-cca-policy/compare/0.1.60...0.1.61) - 17 January 2024
|
|
19
|
+
|
|
20
|
+
#### :bug: Bug Fixes
|
|
21
|
+
|
|
22
|
+
- fix: Add ContentTypeLayout customization [kreafox - [`06f4419`](https://github.com/eea/volto-cca-policy/commit/06f4419f4ffe29df43cc32f4faf0913a561bab0b)]
|
|
23
|
+
|
|
7
24
|
### [0.1.60](https://github.com/eea/volto-cca-policy/compare/0.1.59...0.1.60) - 16 January 2024
|
|
8
25
|
|
|
9
26
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -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?.properties || {};
|
|
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);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mergeConfig } from '@eeacms/search';
|
|
2
|
-
import { getClientProxyAddress } from './../utils';
|
|
2
|
+
import { getClientProxyAddress, getSearchThumbUrl } from './../utils';
|
|
3
3
|
import facets from './facets-stories';
|
|
4
4
|
|
|
5
5
|
const missionStoriesConfig = {
|
|
@@ -25,12 +25,6 @@ export default function installMissionStoriesSearch(config) {
|
|
|
25
25
|
|
|
26
26
|
const { missionStoriesSearch } = config.searchui;
|
|
27
27
|
|
|
28
|
-
missionStoriesSearch.permanentFilters.push({
|
|
29
|
-
terms: {
|
|
30
|
-
objectProvides: ['mission_storyy'],
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
|
|
34
28
|
missionStoriesSearch.facets = facets;
|
|
35
29
|
|
|
36
30
|
if (typeof window !== 'undefined') {
|
|
@@ -38,5 +32,21 @@ export default function installMissionStoriesSearch(config) {
|
|
|
38
32
|
process.env.RAZZLE_ES_PROXY_ADDR || getClientProxyAddress();
|
|
39
33
|
}
|
|
40
34
|
|
|
35
|
+
missionStoriesSearch.resultItemModel = {
|
|
36
|
+
factory: 'ResultModel',
|
|
37
|
+
urlField: 'about',
|
|
38
|
+
titleField: 'title',
|
|
39
|
+
metatypeField: 'objectProvides',
|
|
40
|
+
descriptionField: 'description',
|
|
41
|
+
tagsField: 'topic',
|
|
42
|
+
issuedField: 'issued',
|
|
43
|
+
getThumbnailUrl: 'getSearchThumbUrl',
|
|
44
|
+
getIconUrl: 'getGlobalsearchIconUrl',
|
|
45
|
+
fallbackThumbUrl:
|
|
46
|
+
'https://react.semantic-ui.com/images/wireframe/white-image.png',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
config.resolve.getSearchThumbUrl = getSearchThumbUrl();
|
|
50
|
+
|
|
41
51
|
return config;
|
|
42
52
|
}
|
package/src/search/utils.js
CHANGED
|
@@ -34,3 +34,19 @@ export function getClientProxyAddress() {
|
|
|
34
34
|
url.search = '';
|
|
35
35
|
return url.toString();
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
export const getSearchThumbUrl = () => (result, config, fallback) => {
|
|
39
|
+
let image = fallback;
|
|
40
|
+
|
|
41
|
+
if (
|
|
42
|
+
result.about?.raw?.indexOf('://cca-p6.devel5cph.eionet.europa.eu') !== -1 ||
|
|
43
|
+
result.about?.raw?.indexOf('://cca.devel5cph.eionet.europa.eu') !== -1 ||
|
|
44
|
+
result.about?.raw?.indexOf('://climate-adapt.eea.europa.eu') !== -1
|
|
45
|
+
) {
|
|
46
|
+
if (result.cca_preview_image) {
|
|
47
|
+
image = result?.about?.raw + '/@@images/preview_image/preview';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return image;
|
|
52
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/* Mission subsite */
|
|
2
|
+
|
|
3
|
+
body.subsite-mkh {
|
|
4
|
+
.top.bar .ui.container {
|
|
5
|
+
z-index: 3;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&.subsite-root {
|
|
9
|
+
.segment.content-area {
|
|
10
|
+
padding-top: 0;
|
|
11
|
+
margin-top: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#page-document {
|
|
15
|
+
> div.styled-group:nth-child(2) {
|
|
16
|
+
margin-top: 0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.subfooter .footer-description {
|
|
22
|
+
margin-top: 3em;
|
|
23
|
+
margin-bottom: 1em;
|
|
24
|
+
|
|
25
|
+
p {
|
|
26
|
+
font-size: 1.125rem;
|
|
27
|
+
font-weight: 600;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ui.menu .green.active.item,
|
|
32
|
+
.ui.green.menu .active.item {
|
|
33
|
+
border-color: @green-1 !important;
|
|
34
|
+
color: @green-1 !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.main-menu {
|
|
38
|
+
.item a {
|
|
39
|
+
color: @blue-1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.item a:hover {
|
|
43
|
+
border-color: @green-1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.item.active a {
|
|
47
|
+
border-color: @green-1;
|
|
48
|
+
color: @green-1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.search-action {
|
|
53
|
+
background-color: @green-1;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.eea.banner {
|
|
57
|
+
background: @green-1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#mega-menu {
|
|
61
|
+
.ui.accordion .title i,
|
|
62
|
+
.ui.accordion button.title i {
|
|
63
|
+
color: @white;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
footer,
|
|
68
|
+
.burger-action,
|
|
69
|
+
#search-box,
|
|
70
|
+
#mega-menu,
|
|
71
|
+
#mega-menu .ui.accordion .content {
|
|
72
|
+
background: @subsiteBackgroundGradient;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* Latest news updates, Latest events */
|
|
77
|
+
body.subsite-root.section-mission {
|
|
78
|
+
div.columns-view {
|
|
79
|
+
div.block.listing.default {
|
|
80
|
+
div.items {
|
|
81
|
+
div.listing-item {
|
|
82
|
+
border: none;
|
|
83
|
+
margin: 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.listing-body {
|
|
87
|
+
position: relative;
|
|
88
|
+
padding-left: 2em;
|
|
89
|
+
|
|
90
|
+
&:before {
|
|
91
|
+
position: absolute;
|
|
92
|
+
top: -5px;
|
|
93
|
+
left: 0;
|
|
94
|
+
color: inherit;
|
|
95
|
+
content: '\ea6c';
|
|
96
|
+
font-family: remixicon !important;
|
|
97
|
+
font-size: 1.5em;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
div.block.listing.summary {
|
|
104
|
+
.u-item {
|
|
105
|
+
padding-top: 0;
|
|
106
|
+
padding-bottom: 20px;
|
|
107
|
+
border: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.listing-header {
|
|
111
|
+
font-size: @h4;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.listing-body.has-icon i.icon {
|
|
115
|
+
margin-top: 1px;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
div.block.listing.default {
|
|
120
|
+
div.listing-item {
|
|
121
|
+
padding-bottom: 0.5em;
|
|
122
|
+
|
|
123
|
+
h4 {
|
|
124
|
+
margin-bottom: 0.5em;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*******************************
|
|
2
2
|
Global Overrides
|
|
3
3
|
*******************************/
|
|
4
|
+
@import './mission.less';
|
|
4
5
|
|
|
5
6
|
// [class~='view-defaultview'] [id='page-document'] > *,
|
|
6
7
|
// [class~='view-viewview'] [id='page-document'] > * {
|
|
@@ -141,80 +142,6 @@ div.content-metadata {
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
// Mission subsites
|
|
145
|
-
body.subsite-mkh {
|
|
146
|
-
.top.bar .ui.container {
|
|
147
|
-
z-index: 3;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
&.subsite-root {
|
|
151
|
-
.segment.content-area {
|
|
152
|
-
padding-top: 0;
|
|
153
|
-
margin-top: 0;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
#page-document {
|
|
157
|
-
> div.styled-group:nth-child(2) {
|
|
158
|
-
margin-top: 0;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.subfooter .footer-description {
|
|
164
|
-
margin-top: 3em;
|
|
165
|
-
margin-bottom: 1em;
|
|
166
|
-
|
|
167
|
-
p {
|
|
168
|
-
font-size: 1.125rem;
|
|
169
|
-
font-weight: 600;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.ui.menu .green.active.item,
|
|
174
|
-
.ui.green.menu .active.item {
|
|
175
|
-
border-color: @green-1 !important;
|
|
176
|
-
color: @green-1 !important;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.main-menu {
|
|
180
|
-
.item a {
|
|
181
|
-
color: @blue-1;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.item a:hover {
|
|
185
|
-
border-color: @green-1;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.item.active a {
|
|
189
|
-
border-color: @green-1;
|
|
190
|
-
color: @green-1;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.search-action {
|
|
195
|
-
background-color: @green-1;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.eea.banner {
|
|
199
|
-
background: @green-1;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
#mega-menu {
|
|
203
|
-
.ui.accordion .title i,
|
|
204
|
-
.ui.accordion button.title i {
|
|
205
|
-
color: @white;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
footer,
|
|
210
|
-
.burger-action,
|
|
211
|
-
#search-box,
|
|
212
|
-
#mega-menu,
|
|
213
|
-
#mega-menu .ui.accordion .content {
|
|
214
|
-
background: @subsiteBackgroundGradient;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
145
|
body.view-viewview .full {
|
|
219
146
|
position: relative !important;
|
|
220
147
|
right: 50%;
|
|
@@ -291,61 +218,6 @@ body.view-viewview.has-toolbar:not(.has-sidebar):not(.has-sidebar-collapsed) {
|
|
|
291
218
|
}
|
|
292
219
|
}
|
|
293
220
|
|
|
294
|
-
/* Mission: Latest news updates, Latest events */
|
|
295
|
-
body.subsite-root.section-mission {
|
|
296
|
-
div.columns-view {
|
|
297
|
-
div.block.listing.default {
|
|
298
|
-
div.items {
|
|
299
|
-
div.listing-item {
|
|
300
|
-
border: none;
|
|
301
|
-
margin: 0;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.listing-body {
|
|
305
|
-
position: relative;
|
|
306
|
-
padding-left: 2em;
|
|
307
|
-
|
|
308
|
-
&:before {
|
|
309
|
-
position: absolute;
|
|
310
|
-
top: -5px;
|
|
311
|
-
left: 0;
|
|
312
|
-
color: inherit;
|
|
313
|
-
content: '\ea6c';
|
|
314
|
-
font-family: remixicon !important;
|
|
315
|
-
font-size: 1.5em;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
div.block.listing.summary {
|
|
322
|
-
.u-item {
|
|
323
|
-
padding-top: 0;
|
|
324
|
-
padding-bottom: 20px;
|
|
325
|
-
border: none;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.listing-header {
|
|
329
|
-
font-size: @h4;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.listing-body.has-icon i.icon {
|
|
333
|
-
margin-top: 1px;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
div.block.listing.default {
|
|
338
|
-
div.listing-item {
|
|
339
|
-
padding-bottom: 0.5em;
|
|
340
|
-
|
|
341
|
-
h4 {
|
|
342
|
-
margin-bottom: 0.5em;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
221
|
.listing-body-dates:empty {
|
|
350
222
|
margin-bottom: 0;
|
|
351
223
|
}
|