This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
99 lines (83 loc) · 2.48 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import {
FrequencyOfDissemination,
DataProvenance,
InstitutionalMandate,
ReadOnlyId,
} from '@eeacms/volto-ims-policy/components';
import {
Logout,
RequestPasswordReset,
PasswordReset,
} from '@plone/volto/components';
const applyConfig = (config) => {
if (process.env.NODE_ENV === 'production') {
// Restrict block-style to Layout only
config.settings.layoutOnlyBlockStyles = true;
// Restrict slate metadata mentions to Layout only
config.settings.layoutOnlySlateMetadataMentions = true;
} else {
// Enable description block for cypress
config.blocks.blocksConfig.description.restricted = false;
}
// Disable tags on View
config.settings.showTags = false;
// Enable Title block
config.blocks.blocksConfig.title.restricted = false;
config.blocks.requiredBlocks = [];
// 134485 pass faceted related popup to plone for resolving instead of volto
config.settings.virtualHostedPaths = [
...(config.settings.virtualHostedPaths || []),
'**/@@eeareferencebrowser-popup-selecteditem.html',
];
// 139558 any path that isn't static ims or controlpanel is treated as external
if (!config.settings.publicURL.includes('localhost')) {
const notInIMS = /^(?!.*(\/ims|\/static|\/controlpanel|\/cypress)).*$/;
config.settings.externalRoutes = [
{
match: {
path: notInIMS,
exact: false,
strict: false,
},
},
];
}
// 139558 allow certain volto routes to load from any url not just root of site
config.addonRoutes = [
...(config.addonRoutes || []),
{
path: '/**/logout',
component: Logout,
},
{
path: '/**/password-reset',
component: RequestPasswordReset,
exact: true,
},
{
path: '/**/password-reset/:token',
component: PasswordReset,
exact: true,
},
];
// Frequency of dissemination
if (config.widgets.views?.id) {
config.widgets.views.id.frequency_of_dissemination = FrequencyOfDissemination;
}
// Data provenance
config.widgets.id.data_provenance = DataProvenance;
// Institutional mandate
config.widgets.id.institutional_mandate = InstitutionalMandate;
// Read-only Id
config.widgets.id.id = ReadOnlyId;
// Toast
config.settings.toastConfig = {
position: 'top-center',
autoClose: 6000,
};
// Date format for EU
config.settings.dateLocale = 'en-gb';
config.settings.pdfWorkerSrc = '//www.eea.europa.eu/pdfjs/pdf.worker.min.js';
return config;
};
export default applyConfig;