@eeacms/volto-clms-theme 1.1.235 → 1.1.236
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 +26 -0
- package/package.json +10 -2
- package/src/components/Result/TechnicalLibraryItem.jsx +110 -0
- package/src/components/Result/search-styles.less +58 -0
- package/src/index.js +11 -1
- package/src/search/config.js +87 -0
- package/src/search/facets.js +22 -0
- package/src/search/index.js +15 -0
- package/src/search/utils.js +51 -0
- package/src/search/views.js +17 -0
- package/src/search/vocabulary.js +9 -0
- package/theme/site/globals/site.variables +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,32 @@ 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
|
+
### [1.1.236](https://github.com/eea/volto-clms-theme/compare/1.1.235...1.1.236) - 23 May 2025
|
|
8
|
+
|
|
9
|
+
#### :house: Internal changes
|
|
10
|
+
|
|
11
|
+
- style: Automated code fix [eea-jenkins - [`9016383`](https://github.com/eea/volto-clms-theme/commit/9016383cbfb9c0e2c1fbbc60004bb3c8f1066560)]
|
|
12
|
+
- style: Automated code fix [eea-jenkins - [`325e088`](https://github.com/eea/volto-clms-theme/commit/325e08854f08b7c520fa20a8f90a7350758fc89b)]
|
|
13
|
+
- style: Automated code fix [eea-jenkins - [`53a1163`](https://github.com/eea/volto-clms-theme/commit/53a1163aa6837b68b94f5ca6394dc28d38e44429)]
|
|
14
|
+
- style: Automated code fix [eea-jenkins - [`c635903`](https://github.com/eea/volto-clms-theme/commit/c635903ab0c27a8217a2bce36d0fa33b11a5c677)]
|
|
15
|
+
|
|
16
|
+
#### :hammer_and_wrench: Others
|
|
17
|
+
|
|
18
|
+
- Refs #286059 - Technical Library search: Set All time as default instead of Last 5 years. [GhitaB - [`b719964`](https://github.com/eea/volto-clms-theme/commit/b719964dfb2b01b7879cf0724431f144b6b6a937)]
|
|
19
|
+
- Refs #286059 - Technical Library search: reorder sort options. [GhitaB - [`f1559d5`](https://github.com/eea/volto-clms-theme/commit/f1559d5b1b8bc02e5f01519aa41b39d9742b3ce1)]
|
|
20
|
+
- Refs #286059 - Technical Library search: move styles to less file. [GhitaB - [`5ad3628`](https://github.com/eea/volto-clms-theme/commit/5ad3628601fbb92d8543d484f2a546dfe7a85c3a)]
|
|
21
|
+
- Refs #286059 - Technical Library search: fix sort by version asc and desc. [GhitaB - [`a71f66e`](https://github.com/eea/volto-clms-theme/commit/a71f66ec65694098bf312c66bdb59f6a633ffb52)]
|
|
22
|
+
- Refs #286059 - Technical Library search: fix error when no categories. [GhitaB - [`a2f9eeb`](https://github.com/eea/volto-clms-theme/commit/a2f9eeb16d41de1658931ae26c303dcb06960d1f)]
|
|
23
|
+
- Refs #286059 - Technical Library search: Categories facet. [GhitaB - [`a1cb44f`](https://github.com/eea/volto-clms-theme/commit/a1cb44f5ba60a6a9bb50572e0ae93e9001360ba2)]
|
|
24
|
+
- Refs #286059 - Technical Library search: use link to file. [GhitaB - [`b1b0ae3`](https://github.com/eea/volto-clms-theme/commit/b1b0ae356d1efb99fe79f29fa1070121004e5631)]
|
|
25
|
+
- Refs #286059 - Technical Library search: solve view if or not isAdmin. [GhitaB - [`e74f011`](https://github.com/eea/volto-clms-theme/commit/e74f011d87ad1426e76ff97bc05944ec038b8211)]
|
|
26
|
+
- Refs #286059 - Technical Library search: use new indexed fields, improve styles. [GhitaB - [`8c895ef`](https://github.com/eea/volto-clms-theme/commit/8c895efaa4f5a588690e29c86446cccacfc40933)]
|
|
27
|
+
- Refs #286059 - Technical Library search: use CLMS colors (redefine secondary color in order to simplify styling). [GhitaB - [`dea975b`](https://github.com/eea/volto-clms-theme/commit/dea975bd41789f0b59f20d2a30aa119d19c6f0dd)]
|
|
28
|
+
- Refs #286059 - Technical Library search: fix display on small screen. [GhitaB - [`93cd051`](https://github.com/eea/volto-clms-theme/commit/93cd051080fce6c9ff14bf929ed78da5bbd39561)]
|
|
29
|
+
- Refs #286059 - Add custom search result in Technical Library searchlib configuration. [GhitaB - [`b2fee24`](https://github.com/eea/volto-clms-theme/commit/b2fee24c2ea1ec567aa45fa5aa26351ef3687fcd)]
|
|
30
|
+
- Refs #286059 - Add custom search result in Technical Library searchlib configuration. [GhitaB - [`8671df1`](https://github.com/eea/volto-clms-theme/commit/8671df1f9a8db3db937b127bd7837b0c82f35dfe)]
|
|
31
|
+
- Refs #286059 - Add sort by Version in Technical Library searchlib configuration. [GhitaB - [`8e7b6e7`](https://github.com/eea/volto-clms-theme/commit/8e7b6e7973d21b266ff2ef0a04a45f586224b0a5)]
|
|
32
|
+
- Refs #286059 - WIP Technical Library searchlib configuration. [GhitaB - [`e97ea02`](https://github.com/eea/volto-clms-theme/commit/e97ea0211991d09b6657af9d7ba8b36233d57b5d)]
|
|
7
33
|
### [1.1.235](https://github.com/eea/volto-clms-theme/compare/1.1.234...1.1.235) - 21 May 2025
|
|
8
34
|
|
|
9
35
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-clms-theme",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.236",
|
|
4
4
|
"description": "volto-clms-theme: Volto theme for CLMS site",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "CodeSyntax for the European Environment Agency",
|
|
@@ -31,20 +31,27 @@
|
|
|
31
31
|
"volto-form-block",
|
|
32
32
|
"volto-cookie-banner",
|
|
33
33
|
"@eeacms/volto-tableau",
|
|
34
|
-
"@eeacms/volto-embed"
|
|
34
|
+
"@eeacms/volto-embed",
|
|
35
|
+
"@eeacms/volto-globalsearch"
|
|
35
36
|
],
|
|
37
|
+
"resolutions": {
|
|
38
|
+
"@elastic/search-ui": "1.21.2",
|
|
39
|
+
"d3-array": "^2.12.1"
|
|
40
|
+
},
|
|
36
41
|
"dependencies": {
|
|
37
42
|
"@eeacms/volto-accordion-block": "7.0.0",
|
|
38
43
|
"@eeacms/volto-arcgis-block": "0.1.336",
|
|
39
44
|
"@eeacms/volto-clms-utils": "0.1.15",
|
|
40
45
|
"@eeacms/volto-columns-block": "6.0.2",
|
|
41
46
|
"@eeacms/volto-embed": "6.0.0",
|
|
47
|
+
"@eeacms/volto-globalsearch": "*",
|
|
42
48
|
"@eeacms/volto-metadata-block": "5.0.1",
|
|
43
49
|
"@eeacms/volto-react-table-widget": "0.1.3",
|
|
44
50
|
"@eeacms/volto-resize-helper": "1.0.1",
|
|
45
51
|
"@eeacms/volto-tableau": "1.3.0",
|
|
46
52
|
"@eeacms/volto-tabs-block": "3.0.1",
|
|
47
53
|
"@eeacms/volto-taxonomy": "5.1.0",
|
|
54
|
+
"@elastic/search-ui": "1.21.2",
|
|
48
55
|
"@fortawesome/fontawesome-svg-core": "1.2.35",
|
|
49
56
|
"@fortawesome/free-brands-svg-icons": "6.4.2",
|
|
50
57
|
"@fortawesome/free-regular-svg-icons": "5.15.3",
|
|
@@ -53,6 +60,7 @@
|
|
|
53
60
|
"@ginkgo-bioworks/react-json-schema-form-builder": "2.10.1",
|
|
54
61
|
"@kitconcept/volto-blocks-grid": "7.0.2",
|
|
55
62
|
"connected-react-router": "6.8.0",
|
|
63
|
+
"d3-array": "^2.12.1",
|
|
56
64
|
"husky": "7.0.4",
|
|
57
65
|
"lightgallery": "^2.4.0",
|
|
58
66
|
"razzle-plugin-scss": "4.2.18",
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import './search-styles.less';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import penSVG from '@plone/volto/icons/pen.svg';
|
|
4
|
+
import { Icon as VoltoIcon } from '@plone/volto/components';
|
|
5
|
+
import { Label } from 'semantic-ui-react';
|
|
6
|
+
import { Link } from 'react-router-dom';
|
|
7
|
+
import { ResultContext } from '@eeacms/search';
|
|
8
|
+
import { UniversalCard } from '@eeacms/volto-listing-block';
|
|
9
|
+
import { cclDateFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
|
|
10
|
+
import { useSelector } from 'react-redux';
|
|
11
|
+
import { useState } from 'react';
|
|
12
|
+
|
|
13
|
+
function formatFileSize(bytes) {
|
|
14
|
+
if (bytes === 0) return '0 B';
|
|
15
|
+
const k = 1024;
|
|
16
|
+
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
17
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
18
|
+
const size = parseFloat((bytes / Math.pow(k, i)).toFixed(2));
|
|
19
|
+
return `${size} ${sizes[i]}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const TechnicalLibraryItem = (props) => {
|
|
23
|
+
const { result } = props;
|
|
24
|
+
const [showCategories, setShowCategories] = useState(false);
|
|
25
|
+
const user = useSelector((state) => state.users.user);
|
|
26
|
+
const isAdmin = user?.roles?.includes('Manager');
|
|
27
|
+
const item = {
|
|
28
|
+
title: (
|
|
29
|
+
<>
|
|
30
|
+
<div className="technical-library-title">
|
|
31
|
+
<Link
|
|
32
|
+
to={`${result.href}/@@download/file`}
|
|
33
|
+
title={result.title}
|
|
34
|
+
className="technical-library-title"
|
|
35
|
+
>
|
|
36
|
+
{result.title}
|
|
37
|
+
{result.isNew && <Label className="new-item">New</Label>}
|
|
38
|
+
{result.isExpired && (
|
|
39
|
+
<Label className="archived-item">Archived</Label>
|
|
40
|
+
)}
|
|
41
|
+
</Link>
|
|
42
|
+
{isAdmin && (
|
|
43
|
+
<Link
|
|
44
|
+
to={`${result.href}/edit`}
|
|
45
|
+
target="_blank"
|
|
46
|
+
rel="noopener noreferrer"
|
|
47
|
+
className="technical-library-edit"
|
|
48
|
+
>
|
|
49
|
+
<VoltoIcon
|
|
50
|
+
name={penSVG}
|
|
51
|
+
size="12px"
|
|
52
|
+
className="circled"
|
|
53
|
+
title={'Edit'}
|
|
54
|
+
/>
|
|
55
|
+
</Link>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
58
|
+
</>
|
|
59
|
+
),
|
|
60
|
+
description: <ResultContext {...props} />,
|
|
61
|
+
preview_image_url: result.hasImage ? result.thumbUrl : undefined,
|
|
62
|
+
extra: (
|
|
63
|
+
<div className="result-bottom">
|
|
64
|
+
<strong>Publication date: </strong>
|
|
65
|
+
<span>{cclDateFormat(result.issued)}</span>
|
|
66
|
+
<strong>Version: </strong> <span>{result.version.raw}</span>
|
|
67
|
+
<div className="card-doc-size">
|
|
68
|
+
{formatFileSize(result.file_size.raw)}
|
|
69
|
+
</div>
|
|
70
|
+
{isAdmin && Array.isArray(result.library_categories_values.raw) && (
|
|
71
|
+
<div className="admin-info">
|
|
72
|
+
<strong
|
|
73
|
+
className="categorization-expand"
|
|
74
|
+
onClick={() => setShowCategories((prev) => !prev)}
|
|
75
|
+
role="button"
|
|
76
|
+
tabIndex={0}
|
|
77
|
+
onKeyDown={(e) => {
|
|
78
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
setShowCategories((prev) => !prev);
|
|
81
|
+
}
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
Categorization
|
|
85
|
+
<span> {showCategories ? '▾' : '▸'}</span>
|
|
86
|
+
</strong>
|
|
87
|
+
|
|
88
|
+
{showCategories && (
|
|
89
|
+
<ul>
|
|
90
|
+
{result.library_categories_values.raw.map((categ, index) => (
|
|
91
|
+
<li key={index}>{categ}</li>
|
|
92
|
+
))}
|
|
93
|
+
</ul>
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
),
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const itemModel = {
|
|
102
|
+
hasImage: result.hasImage,
|
|
103
|
+
hasDescription: false,
|
|
104
|
+
'@type': 'searchItem',
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return <UniversalCard item={item} itemModel={itemModel} />;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export default TechnicalLibraryItem;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
@clms-primary: #a0b128;
|
|
2
|
+
|
|
3
|
+
body.clmsSearchTechnicalLibrary-view {
|
|
4
|
+
div#page-document.container {
|
|
5
|
+
width: auto !important;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.searchapp.searchapp-clmsSearchTechnicalLibrary {
|
|
10
|
+
.u-item.listing-item {
|
|
11
|
+
padding: 0.1rem;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.result-bottom {
|
|
15
|
+
display: block !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
div.card-doc-size {
|
|
19
|
+
float: right;
|
|
20
|
+
font-weight: 300;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
a {
|
|
24
|
+
color: @clms-primary;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.technical-library-title {
|
|
28
|
+
display: inline-flex !important;
|
|
29
|
+
width: 100%;
|
|
30
|
+
align-items: start;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.label {
|
|
34
|
+
max-height: fit-content;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.technical-library-edit {
|
|
38
|
+
max-width: 50px;
|
|
39
|
+
margin-left: 5px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.search-body-footer .column.grid {
|
|
43
|
+
margin-top: 0px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
div.admin-info {
|
|
47
|
+
strong.categorization-expand {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
|
|
52
|
+
span {
|
|
53
|
+
margin-left: 8px;
|
|
54
|
+
color: #d3d3d3;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
package/src/index.js
CHANGED
|
@@ -56,6 +56,10 @@ import CLMSLoginView from './components/CLMSLoginView/CLMSLogin';
|
|
|
56
56
|
//SLATE CONFIGURATION
|
|
57
57
|
import installLinkEditor from '@plone/volto-slate/editor/plugins/AdvancedLink';
|
|
58
58
|
|
|
59
|
+
// SEARCHLIB
|
|
60
|
+
import installSearchEngine from './search';
|
|
61
|
+
import TechnicalLibraryItem from './components/Result/TechnicalLibraryItem';
|
|
62
|
+
|
|
59
63
|
//APPEXTRA
|
|
60
64
|
import CustomMatomoAppExtra from './components/AppExtra/AppExtra';
|
|
61
65
|
import FeedbackSurvey from './components/AppExtra/FeedbackSurvey';
|
|
@@ -95,6 +99,9 @@ const applyConfig = (config) => {
|
|
|
95
99
|
],
|
|
96
100
|
};
|
|
97
101
|
|
|
102
|
+
const { resolve } = config.settings.searchlib;
|
|
103
|
+
resolve.TechnicalLibraryItem = { component: TechnicalLibraryItem };
|
|
104
|
+
|
|
98
105
|
config.widgets.type.checkbox_html = CheckboxHtmlWidget;
|
|
99
106
|
config.widgets.type.tabs = TabsWidget;
|
|
100
107
|
config.widgets.widget = {
|
|
@@ -244,7 +251,10 @@ const applyConfig = (config) => {
|
|
|
244
251
|
config.settings.serverConfig.extractScripts.errorPages = true;
|
|
245
252
|
}
|
|
246
253
|
|
|
247
|
-
config = installLinkEditor(
|
|
254
|
+
config = [installLinkEditor, installSearchEngine].reduce(
|
|
255
|
+
(acc, apply) => apply(acc),
|
|
256
|
+
config,
|
|
257
|
+
);
|
|
248
258
|
|
|
249
259
|
config.addonRoutes = [
|
|
250
260
|
...config.addonRoutes,
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { mergeConfig } from '@eeacms/search';
|
|
2
|
+
import { getClientProxyAddress, getSearchThumbUrl } from './utils';
|
|
3
|
+
import vocabs from './vocabulary';
|
|
4
|
+
import facets from './facets';
|
|
5
|
+
import views from './views';
|
|
6
|
+
|
|
7
|
+
const clmsConfig = {
|
|
8
|
+
title: 'CLMS Main',
|
|
9
|
+
...views,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default function install(config) {
|
|
13
|
+
const envConfig = process.env.RAZZLE_ENV_CONFIG
|
|
14
|
+
? JSON.parse(process.env.RAZZLE_ENV_CONFIG)
|
|
15
|
+
: clmsConfig;
|
|
16
|
+
|
|
17
|
+
const pjson = require('@eeacms/volto-clms-theme/../package.json');
|
|
18
|
+
|
|
19
|
+
envConfig.app_name = pjson.name;
|
|
20
|
+
envConfig.app_version = pjson.version;
|
|
21
|
+
|
|
22
|
+
config.searchui.clmsSearchTechnicalLibrary = {
|
|
23
|
+
...mergeConfig(envConfig, config.searchui.globalsearchbase),
|
|
24
|
+
elastic_index: '_es/clmsSearchTechnicalLibrary',
|
|
25
|
+
index_name: 'copernicus_searchui',
|
|
26
|
+
host: process.env.RAZZLE_ES_PROXY_ADDR || 'http://localhost:3000',
|
|
27
|
+
...vocabs,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const { clmsSearchTechnicalLibrary } = config.searchui;
|
|
31
|
+
|
|
32
|
+
clmsSearchTechnicalLibrary.permanentFilters.push({
|
|
33
|
+
term: {
|
|
34
|
+
cluster_name: 'copernicus_land',
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
clmsSearchTechnicalLibrary.facets = facets;
|
|
39
|
+
|
|
40
|
+
clmsSearchTechnicalLibrary.resultItemModel = {
|
|
41
|
+
factory: 'ResultModel',
|
|
42
|
+
urlField: 'about',
|
|
43
|
+
titleField: 'title',
|
|
44
|
+
metatypeField: 'objectProvides',
|
|
45
|
+
descriptionField: 'description',
|
|
46
|
+
tagsField: 'topic',
|
|
47
|
+
issuedField: 'issued',
|
|
48
|
+
getThumbnailUrl: 'getSearchThumbUrl',
|
|
49
|
+
getIconUrl: 'getGlobalsearchIconUrl',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
clmsSearchTechnicalLibrary.sortOptions = [
|
|
53
|
+
{
|
|
54
|
+
name: 'Relevance',
|
|
55
|
+
value: '',
|
|
56
|
+
direction: '',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'Newest',
|
|
60
|
+
value: 'issued.date',
|
|
61
|
+
direction: 'desc',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'Oldest',
|
|
65
|
+
value: 'issued.date',
|
|
66
|
+
direction: 'asc',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'Version ↑',
|
|
70
|
+
value: 'version.keyword',
|
|
71
|
+
direction: 'asc',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'Version ↓',
|
|
75
|
+
value: 'version.keyword',
|
|
76
|
+
direction: 'desc',
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
config.resolve.getSearchThumbUrl = getSearchThumbUrl();
|
|
80
|
+
|
|
81
|
+
if (typeof window !== 'undefined') {
|
|
82
|
+
config.searchui.clmsSearchTechnicalLibrary.host =
|
|
83
|
+
process.env.RAZZLE_ES_PROXY_ADDR || getClientProxyAddress();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return config;
|
|
87
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import globalSearchBaseConfig from '@eeacms/volto-globalsearch/config/global-search-base-config.js';
|
|
2
|
+
|
|
3
|
+
export const library_categories = {
|
|
4
|
+
field: 'library_categories_facet.keyword',
|
|
5
|
+
factory: 'MultiTermFacet',
|
|
6
|
+
label: 'Categories',
|
|
7
|
+
showInFacetsList: true,
|
|
8
|
+
filterType: 'any',
|
|
9
|
+
isFilterable: false,
|
|
10
|
+
show: 10000,
|
|
11
|
+
isMulti: true,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const facets = [library_categories, ...globalSearchBaseConfig.facets];
|
|
15
|
+
|
|
16
|
+
// Change default Last 5 years with All time
|
|
17
|
+
const facet = facets.find((f) => f.field === 'issued.date');
|
|
18
|
+
if (facet && facet.default && Array.isArray(facet.default.values)) {
|
|
19
|
+
facet.default.values[0] = 'All time';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default facets;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import installMainSearch from './config';
|
|
2
|
+
|
|
3
|
+
const extra = {
|
|
4
|
+
text_fields: ['title^4', 'subject^1.5', 'description^1.5'],
|
|
5
|
+
score_mode: 'sum',
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const applyConfig = (config) => {
|
|
9
|
+
config.settings.searchlib = installMainSearch(config.settings.searchlib);
|
|
10
|
+
|
|
11
|
+
config.settings.searchlib.searchui.clmsSearchTechnicalLibrary.extraQueryParams = extra;
|
|
12
|
+
|
|
13
|
+
return config;
|
|
14
|
+
};
|
|
15
|
+
export default applyConfig;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// import config from '@plone/volto/registry';
|
|
2
|
+
|
|
3
|
+
export function getTodayWithTime() {
|
|
4
|
+
const d = new Date();
|
|
5
|
+
const month = d.getMonth() + 1;
|
|
6
|
+
const day = d.getDate();
|
|
7
|
+
const hour = d.getHours();
|
|
8
|
+
const minute = d.getMinutes();
|
|
9
|
+
const second = d.getSeconds();
|
|
10
|
+
|
|
11
|
+
const output = [
|
|
12
|
+
d.getFullYear(),
|
|
13
|
+
'-',
|
|
14
|
+
month < 10 ? '0' : '',
|
|
15
|
+
month,
|
|
16
|
+
'-',
|
|
17
|
+
day < 10 ? '0' : '',
|
|
18
|
+
day,
|
|
19
|
+
'T',
|
|
20
|
+
hour < 10 ? '0' : '',
|
|
21
|
+
hour,
|
|
22
|
+
':',
|
|
23
|
+
minute < 10 ? '0' : '',
|
|
24
|
+
minute,
|
|
25
|
+
':',
|
|
26
|
+
second < 10 ? '0' : '',
|
|
27
|
+
second,
|
|
28
|
+
'Z',
|
|
29
|
+
].join('');
|
|
30
|
+
return output;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function getClientProxyAddress() {
|
|
34
|
+
const url = new URL(window.location);
|
|
35
|
+
url.pathname = '';
|
|
36
|
+
url.search = '';
|
|
37
|
+
return url.toString();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const getSearchThumbUrl = () => (result, config) => {
|
|
41
|
+
let image = `https://www.eea.europa.eu/portal_depiction/term/image_preview`;
|
|
42
|
+
const domain = window.location.origin.replace(/^https?/, '');
|
|
43
|
+
|
|
44
|
+
if (result.about?.raw?.indexOf(domain) !== -1) {
|
|
45
|
+
if (result.image_preview) {
|
|
46
|
+
image = result.image_preview.raw;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return image;
|
|
51
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const views = {
|
|
2
|
+
resultViews: [
|
|
3
|
+
{
|
|
4
|
+
id: 'technicalLibraryCards',
|
|
5
|
+
title: 'Technical Library cards',
|
|
6
|
+
icon: 'bars',
|
|
7
|
+
render: null,
|
|
8
|
+
isDefault: true,
|
|
9
|
+
factories: {
|
|
10
|
+
view: 'HorizontalCard.Group',
|
|
11
|
+
item: 'TechnicalLibraryItem',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default views;
|