@eeacms/volto-cca-policy 0.1.98 → 0.1.99
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 -2
- package/package.json +1 -1
- package/src/components/MigrationButtons.jsx +1 -0
- package/src/components/theme/BannerTitle/BannerTitle.jsx +5 -23
- package/src/components/theme/Views/AdaptationOptionView.jsx +10 -1
- package/src/components/theme/Views/C3SIndicatorView.jsx +12 -1
- package/src/components/theme/Views/CaseStudyView.jsx +13 -1
- package/src/components/theme/Views/CcaEventView.jsx +16 -13
- package/src/components/theme/Views/DatabaseItemView.jsx +80 -3
- package/src/components/theme/Views/EventView.jsx +0 -10
- package/src/components/theme/Views/NewsItemView.jsx +3 -5
- package/src/components/theme/Views/ProjectView.jsx +3 -3
- package/src/helpers/Utils.jsx +6 -19
- package/src/helpers/index.js +8 -0
- package/src/index.js +1 -2
- package/src/search/common.js +1 -1
- package/src/utils.js +19 -0
- package/src/components/theme/Views/VideoView.jsx +0 -118
- package/src/components/theme/Views/VideoView.test.jsx +0 -50
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,26 @@ 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.
|
|
7
|
+
### [0.1.99](https://github.com/eea/volto-cca-policy/compare/0.1.98...0.1.99) - 22 March 2024
|
|
8
|
+
|
|
9
|
+
#### :bug: Bug Fixes
|
|
10
|
+
|
|
11
|
+
- fix(test): duplicated code [kreafox - [`c209673`](https://github.com/eea/volto-cca-policy/commit/c209673344363c43fe136bbc5824a2a312de7ae3)]
|
|
12
|
+
- fix: banner on event and update snapshot [kreafox - [`6ad2ea2`](https://github.com/eea/volto-cca-policy/commit/6ad2ea24e013745afa9a71f006cdf7c05106f470)]
|
|
13
|
+
- fix: duplicated title on cca event view as well [kreafox - [`af57d8d`](https://github.com/eea/volto-cca-policy/commit/af57d8d2c00488c82bc57db5d4c6c9e4e39c50d6)]
|
|
14
|
+
- fix: duplicated title on event view [kreafox - [`2892c1d`](https://github.com/eea/volto-cca-policy/commit/2892c1d074de4f49079580b00512a890a50188ea)]
|
|
15
|
+
- fix: events and news duplicated content [kreafox - [`cbca24d`](https://github.com/eea/volto-cca-policy/commit/cbca24d309b51f36478c07cadd7b5da24897f6bd)]
|
|
16
|
+
|
|
17
|
+
#### :nail_care: Enhancements
|
|
18
|
+
|
|
19
|
+
- change: hide dates on banner for database items [kreafox - [`2c83574`](https://github.com/eea/volto-cca-policy/commit/2c835749d2cd996fdd5661491e9f292e8115b775)]
|
|
8
20
|
|
|
9
21
|
#### :hammer_and_wrench: Others
|
|
10
22
|
|
|
11
|
-
-
|
|
23
|
+
- Add key to migration buttons [Tiberiu Ichim - [`b958ec9`](https://github.com/eea/volto-cca-policy/commit/b958ec999aa193a79ed67834478397681cfd7af7)]
|
|
24
|
+
- i18n on database item [kreafox - [`8341cf3`](https://github.com/eea/volto-cca-policy/commit/8341cf385e9853faa7818ae9abc59665456abda6)]
|
|
25
|
+
### [0.1.98](https://github.com/eea/volto-cca-policy/compare/0.1.97...0.1.98) - 21 March 2024
|
|
26
|
+
|
|
12
27
|
### [0.1.97](https://github.com/eea/volto-cca-policy/compare/0.1.96...0.1.97) - 20 March 2024
|
|
13
28
|
|
|
14
29
|
#### :rocket: New Features
|
package/package.json
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
import config from '@plone/volto/registry';
|
|
2
|
-
|
|
3
|
-
const hasTypeOfBlock = (obj, targetKey, targetValue) => {
|
|
4
|
-
for (const key in obj) {
|
|
5
|
-
if (obj.hasOwnProperty(key)) {
|
|
6
|
-
if (key === targetKey && obj[key] === targetValue) {
|
|
7
|
-
// console.log(`Key "${targetKey}" with value "${targetValue}" found`);
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
12
|
-
if (hasTypeOfBlock(obj[key], targetKey, targetValue)) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return false;
|
|
20
|
-
};
|
|
2
|
+
import { hasTypeOfBlock } from '@eeacms/volto-cca-policy/utils';
|
|
21
3
|
|
|
22
4
|
const BannerTitle = (props) => {
|
|
23
5
|
const { content } = props;
|
|
@@ -38,10 +20,10 @@ const BannerTitle = (props) => {
|
|
|
38
20
|
{...props}
|
|
39
21
|
data={{
|
|
40
22
|
info: [{ description: '' }],
|
|
41
|
-
hideContentType:
|
|
42
|
-
hideCreationDate:
|
|
43
|
-
hideModificationDate:
|
|
44
|
-
hidePublishingDate:
|
|
23
|
+
hideContentType: false,
|
|
24
|
+
hideCreationDate: false,
|
|
25
|
+
hideModificationDate: false,
|
|
26
|
+
hidePublishingDate: false,
|
|
45
27
|
hideDownloadButton: false,
|
|
46
28
|
hideShareButton: false,
|
|
47
29
|
}}
|
|
@@ -163,7 +163,16 @@ function AdaptationOptionView(props) {
|
|
|
163
163
|
<div className="db-item-view adaptation-option-view">
|
|
164
164
|
<BannerTitle
|
|
165
165
|
content={{ ...content, image: '' }}
|
|
166
|
-
|
|
166
|
+
data={{
|
|
167
|
+
info: [{ description: '' }],
|
|
168
|
+
hideContentType: true,
|
|
169
|
+
hideCreationDate: true,
|
|
170
|
+
hideModificationDate: true,
|
|
171
|
+
hidePublishingDate: true,
|
|
172
|
+
hideDownloadButton: false,
|
|
173
|
+
hideShareButton: false,
|
|
174
|
+
subtitle: 'Adaptation Option',
|
|
175
|
+
}}
|
|
167
176
|
/>
|
|
168
177
|
<TranslationDisclaimer />
|
|
169
178
|
|
|
@@ -155,7 +155,18 @@ function C3SIndicatorView(props) {
|
|
|
155
155
|
|
|
156
156
|
return (
|
|
157
157
|
<div className="db-item-view c3sindicator-view">
|
|
158
|
-
<BannerTitle
|
|
158
|
+
<BannerTitle
|
|
159
|
+
content={{ ...content, image: '' }}
|
|
160
|
+
data={{
|
|
161
|
+
info: [{ description: '' }],
|
|
162
|
+
hideContentType: true,
|
|
163
|
+
hideCreationDate: true,
|
|
164
|
+
hideModificationDate: true,
|
|
165
|
+
hidePublishingDate: true,
|
|
166
|
+
hideDownloadButton: false,
|
|
167
|
+
hideShareButton: false,
|
|
168
|
+
}}
|
|
169
|
+
/>
|
|
159
170
|
<TranslationDisclaimer />
|
|
160
171
|
|
|
161
172
|
<div className="ui container">
|
|
@@ -328,7 +328,19 @@ function CaseStudyView(props) {
|
|
|
328
328
|
|
|
329
329
|
return (
|
|
330
330
|
<div className="db-item-view case-study-view">
|
|
331
|
-
<BannerTitle
|
|
331
|
+
<BannerTitle
|
|
332
|
+
content={{ ...content, image: '' }}
|
|
333
|
+
data={{
|
|
334
|
+
info: [{ description: '' }],
|
|
335
|
+
hideContentType: true,
|
|
336
|
+
hideCreationDate: true,
|
|
337
|
+
hideModificationDate: true,
|
|
338
|
+
hidePublishingDate: true,
|
|
339
|
+
hideDownloadButton: false,
|
|
340
|
+
hideShareButton: false,
|
|
341
|
+
subtitle: 'Case Studies',
|
|
342
|
+
}}
|
|
343
|
+
/>
|
|
332
344
|
<TranslationDisclaimer />
|
|
333
345
|
|
|
334
346
|
<div className="ui container">
|
|
@@ -37,7 +37,18 @@ function CcaEventView(props) {
|
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<div className="cca-event-view">
|
|
40
|
-
<BannerTitle
|
|
40
|
+
<BannerTitle
|
|
41
|
+
content={{ ...content, '@type': 'Climate adapt event' }}
|
|
42
|
+
data={{
|
|
43
|
+
info: [{ description: '' }],
|
|
44
|
+
hideContentType: false,
|
|
45
|
+
hideCreationDate: false,
|
|
46
|
+
hideModificationDate: false,
|
|
47
|
+
hidePublishingDate: false,
|
|
48
|
+
hideDownloadButton: false,
|
|
49
|
+
hideShareButton: false,
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
41
52
|
<TranslationDisclaimer />
|
|
42
53
|
|
|
43
54
|
<div className="ui container">
|
|
@@ -50,16 +61,11 @@ function CcaEventView(props) {
|
|
|
50
61
|
computer={9}
|
|
51
62
|
className="col-left"
|
|
52
63
|
>
|
|
53
|
-
{content
|
|
54
|
-
<>
|
|
55
|
-
<div className="ui label">Climate adapt event</div>
|
|
56
|
-
<h1>{content.title}</h1>
|
|
57
|
-
</>
|
|
58
|
-
)}
|
|
59
|
-
<HTMLField value={content.text} className="long_description" />
|
|
64
|
+
<HTMLField value={content.text} />
|
|
60
65
|
|
|
61
66
|
<h2>Agenda and supporting documents</h2>
|
|
62
|
-
<HTMLField value={content.agenda}
|
|
67
|
+
<HTMLField value={content.agenda} />
|
|
68
|
+
|
|
63
69
|
{content?.agenda_file && <DocumentsList content={agenda_files} />}
|
|
64
70
|
{content?.background_documents && (
|
|
65
71
|
<DocumentsList content={background_documents} />
|
|
@@ -67,10 +73,7 @@ function CcaEventView(props) {
|
|
|
67
73
|
|
|
68
74
|
<h2>Practical information</h2>
|
|
69
75
|
<h3>Participation</h3>
|
|
70
|
-
<HTMLField
|
|
71
|
-
value={content.participation}
|
|
72
|
-
className="long_description"
|
|
73
|
-
/>
|
|
76
|
+
<HTMLField value={content.participation} />
|
|
74
77
|
|
|
75
78
|
<h2>Contact</h2>
|
|
76
79
|
<p>
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
INFORMATION_PORTAL,
|
|
7
7
|
PUBICATION_REPORT,
|
|
8
8
|
ORGANISATION,
|
|
9
|
+
VIDEO,
|
|
9
10
|
} from '@eeacms/volto-cca-policy/helpers/Constants';
|
|
10
11
|
import {
|
|
11
12
|
HTMLField,
|
|
@@ -15,6 +16,7 @@ import {
|
|
|
15
16
|
ItemLogo,
|
|
16
17
|
ContentRelatedItems,
|
|
17
18
|
DocumentsList,
|
|
19
|
+
ExternalLink,
|
|
18
20
|
BannerTitle,
|
|
19
21
|
} from '@eeacms/volto-cca-policy/helpers';
|
|
20
22
|
import {
|
|
@@ -22,11 +24,16 @@ import {
|
|
|
22
24
|
PortalMessage,
|
|
23
25
|
TranslationDisclaimer,
|
|
24
26
|
} from '@eeacms/volto-cca-policy/components';
|
|
25
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
isObservatoryMetadataURL,
|
|
29
|
+
fixEmbedURL,
|
|
30
|
+
} from '@eeacms/volto-cca-policy/helpers';
|
|
26
31
|
import { Divider, Grid } from 'semantic-ui-react';
|
|
27
32
|
import { useLocation } from 'react-router-dom';
|
|
28
33
|
import { FormattedMessage } from 'react-intl';
|
|
29
34
|
|
|
35
|
+
const share_eea = ['https://cmshare.eea.eu', 'shareit.eea.europa.eu'];
|
|
36
|
+
|
|
30
37
|
const DatabaseItemView = (props) => {
|
|
31
38
|
const { content } = props;
|
|
32
39
|
const type = content['@type'];
|
|
@@ -35,11 +42,13 @@ const DatabaseItemView = (props) => {
|
|
|
35
42
|
const {
|
|
36
43
|
title,
|
|
37
44
|
acronym,
|
|
45
|
+
embed_url,
|
|
38
46
|
map_graphs,
|
|
39
47
|
long_description,
|
|
40
48
|
organisational_websites,
|
|
41
49
|
organisational_key_activities,
|
|
42
50
|
organisational_contact_information,
|
|
51
|
+
related_documents_presentations,
|
|
43
52
|
} = content;
|
|
44
53
|
const item_title = acronym ? title + ' (' + acronym + ')' : title;
|
|
45
54
|
|
|
@@ -63,6 +72,9 @@ const DatabaseItemView = (props) => {
|
|
|
63
72
|
case ORGANISATION:
|
|
64
73
|
subtitle = 'Organisation';
|
|
65
74
|
break;
|
|
75
|
+
case VIDEO:
|
|
76
|
+
subtitle = 'Video';
|
|
77
|
+
break;
|
|
66
78
|
default:
|
|
67
79
|
subtitle = '';
|
|
68
80
|
}
|
|
@@ -81,11 +93,24 @@ const DatabaseItemView = (props) => {
|
|
|
81
93
|
return null;
|
|
82
94
|
};
|
|
83
95
|
|
|
96
|
+
const is_cmshare_video = share_eea.some((domain) =>
|
|
97
|
+
content?.embed_url?.includes(domain),
|
|
98
|
+
);
|
|
99
|
+
|
|
84
100
|
return (
|
|
85
101
|
<div className="db-item-view">
|
|
86
102
|
<BannerTitle
|
|
87
103
|
content={{ ...content, image: '', title: item_title }}
|
|
88
|
-
|
|
104
|
+
data={{
|
|
105
|
+
info: [{ description: '' }],
|
|
106
|
+
hideContentType: true,
|
|
107
|
+
hideCreationDate: true,
|
|
108
|
+
hideModificationDate: true,
|
|
109
|
+
hidePublishingDate: true,
|
|
110
|
+
hideDownloadButton: false,
|
|
111
|
+
hideShareButton: false,
|
|
112
|
+
subtitle: subtitle,
|
|
113
|
+
}}
|
|
89
114
|
/>
|
|
90
115
|
<TranslationDisclaimer />
|
|
91
116
|
|
|
@@ -100,8 +125,60 @@ const DatabaseItemView = (props) => {
|
|
|
100
125
|
className="col-left"
|
|
101
126
|
>
|
|
102
127
|
<ItemLogo {...props}></ItemLogo>
|
|
128
|
+
|
|
129
|
+
{type === VIDEO && (
|
|
130
|
+
<>
|
|
131
|
+
{is_cmshare_video && (
|
|
132
|
+
<div className="video-wrapper">
|
|
133
|
+
<center>
|
|
134
|
+
<video
|
|
135
|
+
controls="controls"
|
|
136
|
+
preload="metadata"
|
|
137
|
+
width="100%"
|
|
138
|
+
height="480"
|
|
139
|
+
src={fixEmbedURL(embed_url, is_cmshare_video)}
|
|
140
|
+
>
|
|
141
|
+
<track default kind="captions" srcLang="en" src="" />
|
|
142
|
+
</video>
|
|
143
|
+
</center>
|
|
144
|
+
</div>
|
|
145
|
+
)}
|
|
146
|
+
</>
|
|
147
|
+
)}
|
|
148
|
+
|
|
103
149
|
<HTMLField value={long_description} />
|
|
104
150
|
|
|
151
|
+
{type === VIDEO && (
|
|
152
|
+
<>
|
|
153
|
+
{!is_cmshare_video && (
|
|
154
|
+
<div className="external-video">
|
|
155
|
+
<ExternalLink
|
|
156
|
+
url={embed_url}
|
|
157
|
+
text={
|
|
158
|
+
<FormattedMessage
|
|
159
|
+
id="See video outside Climate-ADAPT"
|
|
160
|
+
defaultMessage="See video outside Climate-ADAPT"
|
|
161
|
+
/>
|
|
162
|
+
}
|
|
163
|
+
/>
|
|
164
|
+
</div>
|
|
165
|
+
)}
|
|
166
|
+
</>
|
|
167
|
+
)}
|
|
168
|
+
|
|
169
|
+
{related_documents_presentations && (
|
|
170
|
+
<>
|
|
171
|
+
<Divider />
|
|
172
|
+
<h2 className="reference-title">
|
|
173
|
+
<FormattedMessage
|
|
174
|
+
id="Related documents and presentations"
|
|
175
|
+
defaultMessage="Related documents and presentations"
|
|
176
|
+
/>
|
|
177
|
+
</h2>
|
|
178
|
+
<HTMLField value={related_documents_presentations} />
|
|
179
|
+
</>
|
|
180
|
+
)}
|
|
181
|
+
|
|
105
182
|
{isObservatoryItem && (
|
|
106
183
|
<>
|
|
107
184
|
{organisational_key_activities && (
|
|
@@ -109,7 +186,7 @@ const DatabaseItemView = (props) => {
|
|
|
109
186
|
<h3>
|
|
110
187
|
<FormattedMessage
|
|
111
188
|
id="Key activities within climate change and health"
|
|
112
|
-
defaultMessage="
|
|
189
|
+
defaultMessage="Key activities within climate change and health"
|
|
113
190
|
/>
|
|
114
191
|
</h3>
|
|
115
192
|
<HTMLField value={organisational_key_activities} />
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { HTMLField } from '@eeacms/volto-cca-policy/helpers';
|
|
3
2
|
import {
|
|
4
3
|
BannerTitle,
|
|
5
4
|
PortalMessage,
|
|
@@ -12,7 +11,6 @@ import { FormattedMessage } from 'react-intl';
|
|
|
12
11
|
|
|
13
12
|
function CcaEventView(props) {
|
|
14
13
|
const { content } = props;
|
|
15
|
-
// cca_files: [content.agenda_file]}
|
|
16
14
|
|
|
17
15
|
return (
|
|
18
16
|
<div className="cca-event-view">
|
|
@@ -29,14 +27,6 @@ function CcaEventView(props) {
|
|
|
29
27
|
computer={9}
|
|
30
28
|
className="col-left"
|
|
31
29
|
>
|
|
32
|
-
{content?.image === null && (
|
|
33
|
-
<>
|
|
34
|
-
<div className="ui label">Climate adapt event</div>
|
|
35
|
-
<h1>{content.title}</h1>
|
|
36
|
-
</>
|
|
37
|
-
)}
|
|
38
|
-
<p>{content.description}</p>
|
|
39
|
-
<HTMLField value={content.text} className="long_description" />
|
|
40
30
|
<RenderBlocks {...props} />
|
|
41
31
|
</Grid.Column>
|
|
42
32
|
<Grid.Column
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// import { When } from '@plone/volto/components/theme/View/EventDatesInfo';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { HTMLField } from '@eeacms/volto-cca-policy/helpers';
|
|
4
3
|
import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
|
|
5
4
|
import { Label } from 'semantic-ui-react';
|
|
6
5
|
import {
|
|
@@ -30,17 +29,16 @@ const SubjectTags = (props) => {
|
|
|
30
29
|
) : null;
|
|
31
30
|
};
|
|
32
31
|
|
|
33
|
-
function
|
|
32
|
+
function NewsItemView(props) {
|
|
34
33
|
const { content } = props;
|
|
35
34
|
|
|
36
35
|
return (
|
|
37
36
|
<div className="cca-newsitem-view">
|
|
38
37
|
<BannerTitle content={content} />
|
|
39
38
|
<TranslationDisclaimer />
|
|
39
|
+
|
|
40
40
|
<div className="ui container">
|
|
41
41
|
<PortalMessage content={content} />
|
|
42
|
-
<p>{content.description}</p>
|
|
43
|
-
<HTMLField value={content.text} className="long_description" />
|
|
44
42
|
<RenderBlocks {...props} />
|
|
45
43
|
{/* <Date {...props} /> */}
|
|
46
44
|
<SubjectTags {...props} />
|
|
@@ -49,4 +47,4 @@ function CcaEventView(props) {
|
|
|
49
47
|
);
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
export default
|
|
50
|
+
export default NewsItemView;
|
|
@@ -34,9 +34,9 @@ function ProjectView(props) {
|
|
|
34
34
|
data={{
|
|
35
35
|
info: [{ description: '' }],
|
|
36
36
|
hideContentType: true,
|
|
37
|
-
hideCreationDate:
|
|
38
|
-
hideModificationDate:
|
|
39
|
-
hidePublishingDate:
|
|
37
|
+
hideCreationDate: true,
|
|
38
|
+
hideModificationDate: true,
|
|
39
|
+
hidePublishingDate: true,
|
|
40
40
|
hideDownloadButton: false,
|
|
41
41
|
hideShareButton: false,
|
|
42
42
|
subtitle: 'Project',
|
package/src/helpers/Utils.jsx
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
ORGANISATION,
|
|
18
18
|
ADAPTATION_OPTION,
|
|
19
19
|
ACE_PROJECT,
|
|
20
|
+
VIDEO,
|
|
20
21
|
} from '@eeacms/volto-cca-policy/helpers/Constants';
|
|
21
22
|
import { makeContributionsSearchQuery } from '@eeacms/volto-cca-policy/helpers';
|
|
22
23
|
|
|
@@ -84,28 +85,13 @@ export const LinksList = (props) => {
|
|
|
84
85
|
};
|
|
85
86
|
|
|
86
87
|
export const BannerTitle = (props) => {
|
|
87
|
-
const { content,
|
|
88
|
+
const { content, data } = props;
|
|
88
89
|
const {
|
|
89
90
|
blocks: { blocksConfig },
|
|
90
91
|
} = config;
|
|
91
92
|
const TitleBlockView = blocksConfig?.title?.view;
|
|
92
93
|
|
|
93
|
-
return
|
|
94
|
-
<TitleBlockView
|
|
95
|
-
{...props}
|
|
96
|
-
data={{
|
|
97
|
-
info: [{ description: '' }],
|
|
98
|
-
hideContentType: true,
|
|
99
|
-
hideCreationDate: false,
|
|
100
|
-
hideModificationDate: false,
|
|
101
|
-
hidePublishingDate: false,
|
|
102
|
-
hideDownloadButton: false,
|
|
103
|
-
hideShareButton: false,
|
|
104
|
-
subtitle: type,
|
|
105
|
-
}}
|
|
106
|
-
metadata={content}
|
|
107
|
-
/>
|
|
108
|
-
);
|
|
94
|
+
return <TitleBlockView {...props} data={data} metadata={content} />;
|
|
109
95
|
};
|
|
110
96
|
|
|
111
97
|
export const ReferenceInfo = (props) => {
|
|
@@ -393,6 +379,7 @@ export const LogoWrapper = ({ logo, children }) =>
|
|
|
393
379
|
|
|
394
380
|
export const ItemLogo = (props) => {
|
|
395
381
|
const { content } = props;
|
|
382
|
+
const type = content['@type'];
|
|
396
383
|
const { image, logo, title } = content;
|
|
397
384
|
|
|
398
385
|
let logo_image;
|
|
@@ -404,7 +391,7 @@ export const ItemLogo = (props) => {
|
|
|
404
391
|
logo_image = null;
|
|
405
392
|
}
|
|
406
393
|
|
|
407
|
-
return (
|
|
394
|
+
return type !== VIDEO ? (
|
|
408
395
|
<LogoWrapper logo={logo_image}>
|
|
409
396
|
<h2>
|
|
410
397
|
<FormattedMessage id="Description" defaultMessage="Description" />
|
|
@@ -417,5 +404,5 @@ export const ItemLogo = (props) => {
|
|
|
417
404
|
/>
|
|
418
405
|
)}
|
|
419
406
|
</LogoWrapper>
|
|
420
|
-
);
|
|
407
|
+
) : null;
|
|
421
408
|
};
|
package/src/helpers/index.js
CHANGED
|
@@ -61,3 +61,11 @@ export const isObservatoryMetadataURL = (url) => {
|
|
|
61
61
|
export const makeObservatoryMetadataURL = (url) => {
|
|
62
62
|
return url.replace('/metadata/', '/observatory/++aq++metadata/');
|
|
63
63
|
};
|
|
64
|
+
|
|
65
|
+
export const fixEmbedURL = (url, is_cmshare_video) => {
|
|
66
|
+
const suffix = '/download';
|
|
67
|
+
if (is_cmshare_video && !url.includes(suffix)) {
|
|
68
|
+
return url + suffix;
|
|
69
|
+
}
|
|
70
|
+
return url;
|
|
71
|
+
};
|
package/src/index.js
CHANGED
|
@@ -7,7 +7,6 @@ import EventView from './components/theme/Views/EventView';
|
|
|
7
7
|
import AdaptationOptionView from './components/theme/Views/AdaptationOptionView';
|
|
8
8
|
import CaseStudyView from './components/theme/Views/CaseStudyView';
|
|
9
9
|
import ProjectView from './components/theme/Views/ProjectView';
|
|
10
|
-
import VideoView from './components/theme/Views/VideoView';
|
|
11
10
|
import C3SIndicatorView from './components/theme/Views/C3SIndicatorView';
|
|
12
11
|
import DatabaseItemView from './components/theme/Views/DatabaseItemView';
|
|
13
12
|
|
|
@@ -268,7 +267,7 @@ const applyConfig = (config) => {
|
|
|
268
267
|
'eea.climateadapt.guidancedocument': DatabaseItemView,
|
|
269
268
|
'eea.climateadapt.informationportal': DatabaseItemView,
|
|
270
269
|
'eea.climateadapt.publicationreport': DatabaseItemView,
|
|
271
|
-
'eea.climateadapt.video':
|
|
270
|
+
'eea.climateadapt.video': DatabaseItemView,
|
|
272
271
|
'eea.climateadapt.aceproject': ProjectView,
|
|
273
272
|
'eea.climateadapt.casestudy': CaseStudyView,
|
|
274
273
|
'eea.climateadapt.c3sindicator': C3SIndicatorView,
|
package/src/search/common.js
CHANGED
package/src/utils.js
CHANGED
|
@@ -31,3 +31,22 @@ export function getBaseUrl(props) {
|
|
|
31
31
|
}
|
|
32
32
|
return path;
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
export const hasTypeOfBlock = (obj, type, name) => {
|
|
36
|
+
for (const key in obj) {
|
|
37
|
+
if (obj.hasOwnProperty(key)) {
|
|
38
|
+
if (key === type && obj[key] === name) {
|
|
39
|
+
// console.log(`Key "${type}" with value "${name}" found`);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
44
|
+
if (hasTypeOfBlock(obj[key], type, name)) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return false;
|
|
52
|
+
};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
HTMLField,
|
|
4
|
-
ReferenceInfo,
|
|
5
|
-
ContentMetadata,
|
|
6
|
-
ExternalLink,
|
|
7
|
-
BannerTitle,
|
|
8
|
-
} from '@eeacms/volto-cca-policy/helpers';
|
|
9
|
-
import { Divider, Image, Grid } from 'semantic-ui-react';
|
|
10
|
-
import {
|
|
11
|
-
ShareInfoButton,
|
|
12
|
-
PortalMessage,
|
|
13
|
-
TranslationDisclaimer,
|
|
14
|
-
} from '@eeacms/volto-cca-policy/components';
|
|
15
|
-
|
|
16
|
-
function VideoView(props) {
|
|
17
|
-
const { content } = props;
|
|
18
|
-
const {
|
|
19
|
-
logo,
|
|
20
|
-
title,
|
|
21
|
-
embed_url,
|
|
22
|
-
long_description,
|
|
23
|
-
related_documents_presentations,
|
|
24
|
-
} = content;
|
|
25
|
-
|
|
26
|
-
const share_eea = ['https://cmshare.eea.eu', 'shareit.eea.europa.eu'];
|
|
27
|
-
const is_cmshare_video = share_eea.some((domain) =>
|
|
28
|
-
content?.embed_url?.includes(domain),
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const fixEmbedURL = (url) => {
|
|
32
|
-
const suffix = '/download';
|
|
33
|
-
if (is_cmshare_video && !url.includes(suffix)) {
|
|
34
|
-
return url + suffix;
|
|
35
|
-
}
|
|
36
|
-
return url;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<div className="db-item-view video-view">
|
|
41
|
-
<BannerTitle content={{ ...content, image: '' }} type="Video" />
|
|
42
|
-
<TranslationDisclaimer />
|
|
43
|
-
|
|
44
|
-
<div className="ui container">
|
|
45
|
-
<PortalMessage content={content} />
|
|
46
|
-
<Grid columns="12">
|
|
47
|
-
<div className="row">
|
|
48
|
-
<Grid.Column
|
|
49
|
-
mobile={12}
|
|
50
|
-
tablet={12}
|
|
51
|
-
computer={8}
|
|
52
|
-
className="col-left"
|
|
53
|
-
>
|
|
54
|
-
{is_cmshare_video && (
|
|
55
|
-
<div className="video-wrapper">
|
|
56
|
-
<center>
|
|
57
|
-
<video
|
|
58
|
-
controls="controls"
|
|
59
|
-
preload="metadata"
|
|
60
|
-
width="100%"
|
|
61
|
-
height="480"
|
|
62
|
-
src={fixEmbedURL(embed_url)}
|
|
63
|
-
>
|
|
64
|
-
<track default kind="captions" srcLang="en" src="" />
|
|
65
|
-
</video>
|
|
66
|
-
</center>
|
|
67
|
-
</div>
|
|
68
|
-
)}
|
|
69
|
-
|
|
70
|
-
<HTMLField value={long_description} />
|
|
71
|
-
|
|
72
|
-
{!is_cmshare_video && (
|
|
73
|
-
<div className="external-video">
|
|
74
|
-
<ExternalLink
|
|
75
|
-
url={embed_url}
|
|
76
|
-
text="See video outside Climate-ADAPT"
|
|
77
|
-
/>
|
|
78
|
-
</div>
|
|
79
|
-
)}
|
|
80
|
-
|
|
81
|
-
<Divider />
|
|
82
|
-
|
|
83
|
-
{related_documents_presentations && (
|
|
84
|
-
<>
|
|
85
|
-
<h2 className="reference-title">
|
|
86
|
-
Related documents and presentations
|
|
87
|
-
</h2>
|
|
88
|
-
<HTMLField value={related_documents_presentations} />
|
|
89
|
-
</>
|
|
90
|
-
)}
|
|
91
|
-
|
|
92
|
-
<ReferenceInfo content={content} />
|
|
93
|
-
<ShareInfoButton {...props} />
|
|
94
|
-
</Grid.Column>
|
|
95
|
-
<Grid.Column
|
|
96
|
-
mobile={12}
|
|
97
|
-
tablet={12}
|
|
98
|
-
computer={4}
|
|
99
|
-
className="col-right"
|
|
100
|
-
>
|
|
101
|
-
<ContentMetadata {...props} />
|
|
102
|
-
|
|
103
|
-
{logo && (
|
|
104
|
-
<Image
|
|
105
|
-
src={logo?.scales?.mini?.download}
|
|
106
|
-
alt={title}
|
|
107
|
-
className="db-logo"
|
|
108
|
-
/>
|
|
109
|
-
)}
|
|
110
|
-
</Grid.Column>
|
|
111
|
-
</div>
|
|
112
|
-
</Grid>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export default VideoView;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MemoryRouter } from 'react-router-dom';
|
|
3
|
-
import configureStore from 'redux-mock-store';
|
|
4
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
5
|
-
import { Provider } from 'react-intl-redux';
|
|
6
|
-
import VideoView from './VideoView';
|
|
7
|
-
import renderer from 'react-test-renderer';
|
|
8
|
-
import config from '@plone/volto/registry';
|
|
9
|
-
|
|
10
|
-
config.blocks = {
|
|
11
|
-
blocksConfig: {
|
|
12
|
-
title: {
|
|
13
|
-
view: () => <div>Title Block Component</div>,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const mockStore = configureStore();
|
|
19
|
-
|
|
20
|
-
jest.mock('semantic-ui-react', () => ({
|
|
21
|
-
...jest.requireActual('semantic-ui-react'),
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
describe('VideoView', () => {
|
|
25
|
-
it('should render the component', () => {
|
|
26
|
-
const content = {
|
|
27
|
-
title: 'My VideoView',
|
|
28
|
-
geochars:
|
|
29
|
-
'{\r\n "geoElements":{"element":"GLOBAL",\r\n "macrotrans":null,"biotrans":null,"countries":[],\r\n "subnational":[],"city":""}}',
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const store = mockStore({
|
|
33
|
-
userSession: { token: '1234' },
|
|
34
|
-
intl: {
|
|
35
|
-
locale: 'en',
|
|
36
|
-
messages: {},
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const component = renderer.create(
|
|
41
|
-
<Provider store={store}>
|
|
42
|
-
<MemoryRouter>
|
|
43
|
-
<VideoView content={content} />
|
|
44
|
-
</MemoryRouter>
|
|
45
|
-
</Provider>,
|
|
46
|
-
);
|
|
47
|
-
const json = component.toJSON();
|
|
48
|
-
expect(json).toMatchSnapshot();
|
|
49
|
-
});
|
|
50
|
-
});
|