@eeacms/volto-cca-policy 0.1.86 → 0.1.87

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 CHANGED
@@ -4,6 +4,22 @@ 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.87](https://github.com/eea/volto-cca-policy/compare/0.1.86...0.1.87) - 1 March 2024
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix(news): replace banner component [kreafox - [`ff8daf9`](https://github.com/eea/volto-cca-policy/commit/ff8daf901feff11fad95099a302014a25fbbd501)]
12
+ - fix(views): show logo on organisation view; split CSS in separate files [kreafox - [`5666679`](https://github.com/eea/volto-cca-policy/commit/5666679bd55072f2d61c8e83681846f2ce0b1f7f)]
13
+
14
+ #### :nail_care: Enhancements
15
+
16
+ - change(banner): more improvements on banner component [kreafox - [`f341525`](https://github.com/eea/volto-cca-policy/commit/f341525f53048d461fcc6d9c79bba7dbfb9e7cdc)]
17
+
18
+ #### :hammer_and_wrench: Others
19
+
20
+ - test: update tests on db items [kreafox - [`9d3a03d`](https://github.com/eea/volto-cca-policy/commit/9d3a03d364d0143be5efb3dc0793a6ff9c4807f3)]
21
+ - Cleanup [Tiberiu Ichim - [`a6581bf`](https://github.com/eea/volto-cca-policy/commit/a6581bf00dba2c99bd1ab4622c7a4f14a55b24c2)]
22
+ - Expand siblings on country profiles [Tiberiu Ichim - [`4cc075a`](https://github.com/eea/volto-cca-policy/commit/4cc075aca6be95a266b732c8ca836de7b39f7d4e)]
7
23
  ### [0.1.86](https://github.com/eea/volto-cca-policy/compare/0.1.85...0.1.86) - 1 March 2024
8
24
 
9
25
  #### :nail_care: Enhancements
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.1.86",
3
+ "version": "0.1.87",
4
4
  "description": "@eeacms/volto-cca-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,11 +1,22 @@
1
1
  import config from '@plone/volto/registry';
2
2
 
3
- const hasTypeOfBlock = (type, blocks) => {
4
- const block = blocks
5
- ? Object.keys(blocks).find((id) => blocks?.[id]?.['@type'] === type)
6
- : null;
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
+ }
7
10
 
8
- return block;
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;
9
20
  };
10
21
 
11
22
  const BannerTitle = (props) => {
@@ -15,8 +26,8 @@ const BannerTitle = (props) => {
15
26
  blocks: { blocksConfig },
16
27
  } = config;
17
28
  const TitleBlockView = blocksConfig?.title?.view;
18
- const hasTitleBlock = hasTypeOfBlock('title', blocks);
19
- const hasCountryFlagBlock = hasTypeOfBlock('countryFlag', blocks);
29
+ const hasTitleBlock = hasTypeOfBlock(blocks, '@type', 'title');
30
+ const hasCountryFlagBlock = hasTypeOfBlock(blocks, '@type', 'countryFlag');
20
31
  const types = ['Subsite', 'LRF', 'Plone Site'];
21
32
  const isHomePage = types.indexOf(content?.['@type']) > -1;
22
33
 
@@ -8,19 +8,17 @@ import {
8
8
  ShareInfo,
9
9
  BannerTitle,
10
10
  } from '@eeacms/volto-cca-policy/helpers';
11
- import { Divider, Segment, Grid, Icon } from 'semantic-ui-react';
11
+ import { Divider, Segment, Grid, Icon, Image } from 'semantic-ui-react';
12
12
  import { ImageGallery } from '@eeacms/volto-cca-policy/components';
13
13
 
14
14
  const PrimaryPhoto = (props) => {
15
15
  const { content } = props;
16
+ const { primary_photo, primary_photo_copyright, title } = content;
16
17
 
17
- return content.primary_photo !== null ? (
18
+ return primary_photo !== null ? (
18
19
  <div className="case-studies-review-image-wrapper">
19
- <img
20
- src={content?.primary_photo?.scales?.mini?.download}
21
- alt={content.title}
22
- />
23
- <p>{content.primary_photo_copyright}</p>
20
+ <Image src={primary_photo?.scales?.mini?.download} alt={title} />
21
+ <p>{primary_photo_copyright}</p>
24
22
  </div>
25
23
  ) : null;
26
24
  };
@@ -2,8 +2,8 @@
2
2
  import React from 'react';
3
3
  import { HTMLField } from '@eeacms/volto-cca-policy/helpers';
4
4
  import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
5
- import config from '@plone/volto/registry';
6
5
  import { Label } from 'semantic-ui-react';
6
+ import { BannerTitle } from '@eeacms/volto-cca-policy/components';
7
7
 
8
8
  // const Date = (props) => {
9
9
  // const date = props.content?.effective;
@@ -27,19 +27,11 @@ const SubjectTags = (props) => {
27
27
  };
28
28
 
29
29
  function CcaEventView(props) {
30
- const {
31
- blocks: { blocksConfig },
32
- } = config;
33
- const TitleBlockView = blocksConfig?.title?.view;
34
30
  const { content } = props;
35
31
 
36
32
  return (
37
33
  <div className="cca-newsitem-view">
38
- <TitleBlockView
39
- {...props}
40
- data={{ info: [{ description: '' }] }}
41
- metadata={content}
42
- />
34
+ <BannerTitle content={content} />
43
35
  <div className="ui container">
44
36
  <p>{content.description}</p>
45
37
  <HTMLField value={content.text} className="long_description" />
@@ -8,11 +8,12 @@ import {
8
8
  ShareInfo,
9
9
  BannerTitle,
10
10
  } from '@eeacms/volto-cca-policy/helpers';
11
- import { Segment, Divider } from 'semantic-ui-react';
11
+ import { Segment, Divider, Image } from 'semantic-ui-react';
12
+ import cx from 'classnames';
12
13
 
13
14
  function OrganisationView(props) {
14
15
  const { content } = props;
15
- const { long_description, websites, relatedItems } = content;
16
+ const { long_description, websites, relatedItems, logo } = content;
16
17
 
17
18
  let organisationDocuments = [];
18
19
  let contentRelatedItems = [];
@@ -32,7 +33,16 @@ function OrganisationView(props) {
32
33
 
33
34
  <div className="ui container">
34
35
  <div>
35
- <h2>Description</h2>
36
+ <div className={cx({ 'has-logo': logo })}>
37
+ <h2>Description</h2>
38
+
39
+ <Image
40
+ src={logo?.scales?.mini?.download}
41
+ alt={content.title}
42
+ className="org-logo"
43
+ />
44
+ </div>
45
+
36
46
  <HTMLField value={long_description} />
37
47
  <Divider />
38
48
  <h2>Reference information</h2>
@@ -50,7 +50,10 @@ export function addExpandersToPath(path, type, isAnonymous) {
50
50
  } = qs.parseUrl(path, { decode: false });
51
51
 
52
52
  const expandersFromConfig = apiExpanders
53
- .filter((expand) => matchPath(url, expand.match) && expand[type])
53
+ .filter((expand) => {
54
+ const res = matchPath(url, expand.match) && expand[type];
55
+ return res;
56
+ })
54
57
  .map((expand) => expand[type]);
55
58
 
56
59
  const expandMerge = compact(
package/src/index.js CHANGED
@@ -485,6 +485,16 @@ const applyConfig = (config) => {
485
485
  },
486
486
  ];
487
487
 
488
+ config.settings.apiExpanders = [
489
+ ...config.settings.apiExpanders,
490
+ {
491
+ match: {
492
+ path: /(.*)\/policy-context\/country-profiles\/(.*)/,
493
+ },
494
+ GET_CONTENT: ['siblings'],
495
+ },
496
+ ];
497
+
488
498
  return compose(installBlocks, installSearchEngine, installStore)(config);
489
499
  };
490
500
 
@@ -0,0 +1,18 @@
1
+ .section-search-the-database .block.call-to-action.align.center a {
2
+ display: block;
3
+ }
4
+
5
+ body.searchlib-page .searchlib-block {
6
+ .ui.secondary.pointing.content-section-tabs.menu {
7
+ .active.item .tab-icon .count {
8
+ border-color: @ccaGreenColor;
9
+ background-color: @ccaGreenColor;
10
+ }
11
+ }
12
+ }
13
+
14
+ .searchlib-page .content-section-tabs.menu .item i.icon.small {
15
+ width: 32px;
16
+ height: 32px;
17
+ font-size: 32px;
18
+ }
@@ -3,6 +3,8 @@
3
3
  *******************************/
4
4
  @import './mission.less';
5
5
  @import './observatory.less';
6
+ @import './views.less';
7
+ @import './search.less';
6
8
 
7
9
  // [class~='view-defaultview'] [id='page-document'] > *,
8
10
  // [class~='view-viewview'] [id='page-document'] > * {
@@ -15,8 +17,11 @@
15
17
  @green-2 97.12%
16
18
  );
17
19
 
18
- .section-search-the-database .block.call-to-action.align.center a {
19
- display: block;
20
+ .ui.ordered.list,
21
+ .ui.ordered.list .list,
22
+ ol.ui.list,
23
+ ol.ui.list ol {
24
+ padding-left: 1.25rem;
20
25
  }
21
26
 
22
27
  body.subsite-root .content-area {
@@ -79,216 +84,7 @@ p.has--clear--both:empty {
79
84
  // // }
80
85
  // }
81
86
 
82
- // Case study view styles
83
- .case-study-view {
84
- .case-studies-review-image-wrapper {
85
- position: relative;
86
- margin-right: 1.5em;
87
- float: left;
88
-
89
- p {
90
- font-size: 90%;
91
- }
92
- }
93
- }
94
-
95
- // Video view styles
96
- div.video-view {
97
- video {
98
- margin-top: 1.5em;
99
- }
100
-
101
- div.external-video {
102
- margin-top: 1.5em;
103
- }
104
- }
105
-
106
- // C3S Indicator view styles
107
- div.c3sindicator-view {
108
- iframe {
109
- border: none;
110
- }
111
-
112
- .ui.accordion {
113
- margin: 1.5em 0;
114
- }
115
- }
116
-
117
- // Geochars widget
118
- div.geochars-field {
119
- div.checkbox {
120
- margin-right: 1em;
121
-
122
- label {
123
- padding-left: 1.5em;
124
- }
125
- }
126
- }
127
-
128
- .section-metadata {
129
- .content-area {
130
- margin-bottom: 0 !important;
131
- }
132
- }
133
-
134
- hr {
135
- height: 1px;
136
- border: none;
137
- margin: 2em 0;
138
- background-color: #e6e7e8;
139
- }
140
-
141
- .ui.modal.slider-modal {
142
- .content {
143
- padding: 2em;
144
- }
145
-
146
- .slick-slider {
147
- padding: 1em 2em;
148
- }
149
-
150
- .slide-image-count {
151
- text-align: center;
152
- }
153
-
154
- .slick-arrow {
155
- width: 35px;
156
- height: 35px;
157
-
158
- &:before {
159
- font-size: 30px;
160
- }
161
- }
162
-
163
- .slick-prev {
164
- left: -13px;
165
- }
166
-
167
- .slick-next {
168
- right: -13px;
169
- }
170
- }
171
-
172
- .db-item-view {
173
- .ui.divider {
174
- margin: 2em 0;
175
- }
176
-
177
- .casetstudy-gallery {
178
- cursor: pointer;
179
-
180
- .gallery-title {
181
- padding: 2px 4px;
182
- background-color: #f2c94c;
183
- font-weight: bold;
184
- text-align: center;
185
- }
186
- }
187
-
188
- .bottom-text {
189
- margin-bottom: 2em;
190
- }
191
-
192
- .c3s-buttons {
193
- display: flex;
194
- flex-direction: row;
195
- justify-content: space-between;
196
- }
197
-
198
- .adaptation-details {
199
- display: flex;
200
- flex-direction: row;
201
- margin: 2em 0;
202
- gap: 5em;
203
- }
204
-
205
- .ui.segment {
206
- margin-bottom: 1.5em;
207
- }
208
-
209
- .section {
210
- .section-title {
211
- margin-top: 1em;
212
- }
213
- }
214
-
215
- .documents-list {
216
- padding: 0;
217
- list-style-type: none;
218
-
219
- li a:before {
220
- content: '' !important;
221
- }
222
- }
223
-
224
- .share-info {
225
- margin: 3.5em 0 !important;
226
-
227
- .ui.button {
228
- margin: 0 !important;
229
- }
230
- }
231
-
232
- .ui.button {
233
- margin: 1.5em 0 !important;
234
- }
235
-
236
- .content-box {
237
- margin: 0;
238
-
239
- h5 {
240
- color: @secondaryColor;
241
- }
242
-
243
- .content-box-inner {
244
- padding: 3.5em 0;
245
- }
246
- }
247
-
248
- .video-wrapper {
249
- margin-bottom: 2em;
250
- }
251
-
252
- .content-metadata {
253
- h5 {
254
- margin: 1em 0 0.5em 0;
255
- color: @secondaryColor;
256
-
257
- &:first-child {
258
- margin-top: 0;
259
- }
260
- }
261
-
262
- p,
263
- span {
264
- color: @grey-4;
265
- }
266
- }
267
- }
268
-
269
87
  // General styles
270
- .btn-right {
271
- margin: calc(2rem - 0.1em) 0em 1rem;
272
- float: right;
273
- }
274
-
275
- .published-modified-info {
276
- margin: 2em 0;
277
- font-size: 0.8em;
278
- }
279
-
280
- .content-metadata {
281
- .columned.related-case-studies {
282
- column-count: 2;
283
- column-gap: 4em;
284
- }
285
-
286
- .related-case-studies {
287
- li {
288
- margin-bottom: 0.5em;
289
- }
290
- }
291
- }
292
88
 
293
89
  .listing-body-dates:empty {
294
90
  margin-bottom: 0;
@@ -346,21 +142,6 @@ body.subsite {
346
142
  margin-right: auto;
347
143
  }
348
144
 
349
- body.searchlib-page .searchlib-block {
350
- .ui.secondary.pointing.content-section-tabs.menu {
351
- .active.item .tab-icon .count {
352
- border-color: @ccaGreenColor;
353
- background-color: @ccaGreenColor;
354
- }
355
- }
356
- }
357
-
358
- .searchlib-page .content-section-tabs.menu .item i.icon.small {
359
- width: 32px;
360
- height: 32px;
361
- font-size: 32px;
362
- }
363
-
364
145
  // Fix margin in simple item listing
365
146
  .u-item.listing-item.simple-listing-item .listing-body {
366
147
  margin-top: 0;
@@ -0,0 +1,223 @@
1
+ // Case study view styles
2
+ .case-study-view {
3
+ .case-studies-review-image-wrapper {
4
+ position: relative;
5
+ margin-right: 1.5em;
6
+ float: left;
7
+
8
+ p {
9
+ font-size: 90%;
10
+ }
11
+ }
12
+ }
13
+
14
+ // Video view styles
15
+ div.video-view {
16
+ video {
17
+ margin-top: 1.5em;
18
+ }
19
+
20
+ div.external-video {
21
+ margin-top: 1.5em;
22
+ }
23
+ }
24
+
25
+ // C3S Indicator view styles
26
+ div.c3sindicator-view {
27
+ iframe {
28
+ border: none;
29
+ }
30
+
31
+ .ui.accordion {
32
+ margin: 1.5em 0;
33
+ }
34
+ }
35
+
36
+ // Geochars widget
37
+ div.geochars-field {
38
+ div.checkbox {
39
+ margin-right: 1em;
40
+
41
+ label {
42
+ padding-left: 1.5em;
43
+ }
44
+ }
45
+ }
46
+
47
+ .content-metadata {
48
+ .columned.related-case-studies {
49
+ column-count: 2;
50
+ column-gap: 4em;
51
+ }
52
+
53
+ .related-case-studies {
54
+ li {
55
+ margin-bottom: 0.5em;
56
+ }
57
+ }
58
+ }
59
+
60
+ .btn-right {
61
+ margin: calc(2rem - 0.1em) 0em 1rem;
62
+ float: right;
63
+ }
64
+
65
+ .published-modified-info {
66
+ margin: 2em 0;
67
+ font-size: 0.8em;
68
+ }
69
+
70
+ .section-metadata,
71
+ .section-\+\+aq\+\+metadata {
72
+ .content-area {
73
+ margin-bottom: 0 !important;
74
+ }
75
+ }
76
+
77
+ hr {
78
+ height: 1px;
79
+ border: none;
80
+ margin: 2em 0;
81
+ background-color: #e6e7e8;
82
+ }
83
+
84
+ .ui.modal.slider-modal {
85
+ .content {
86
+ padding: 2em;
87
+ }
88
+
89
+ .slick-slider {
90
+ padding: 1em 2em;
91
+ }
92
+
93
+ .slide-image-count {
94
+ text-align: center;
95
+ }
96
+
97
+ .slick-arrow {
98
+ width: 35px;
99
+ height: 35px;
100
+
101
+ &:before {
102
+ font-size: 30px;
103
+ }
104
+ }
105
+
106
+ .slick-prev {
107
+ left: -13px;
108
+ }
109
+
110
+ .slick-next {
111
+ right: -13px;
112
+ }
113
+ }
114
+
115
+ .db-item-view.organisation-view {
116
+ .has-logo {
117
+ display: flex;
118
+ align-items: flex-start;
119
+ justify-content: space-between;
120
+ }
121
+
122
+ .org-logo {
123
+ max-width: 150px;
124
+ margin-bottom: 1em;
125
+ }
126
+ }
127
+
128
+ .db-item-view {
129
+ .ui.divider {
130
+ margin: 2em 0;
131
+ }
132
+
133
+ .casetstudy-gallery {
134
+ cursor: pointer;
135
+
136
+ .gallery-title {
137
+ padding: 2px 4px;
138
+ background-color: #f2c94c;
139
+ font-weight: bold;
140
+ text-align: center;
141
+ }
142
+ }
143
+
144
+ .bottom-text {
145
+ margin-bottom: 2em;
146
+ }
147
+
148
+ .c3s-buttons {
149
+ display: flex;
150
+ flex-direction: row;
151
+ justify-content: space-between;
152
+ }
153
+
154
+ .adaptation-details {
155
+ display: flex;
156
+ flex-direction: row;
157
+ margin: 2em 0;
158
+ gap: 5em;
159
+ }
160
+
161
+ .ui.segment {
162
+ margin-bottom: 1.5em;
163
+ }
164
+
165
+ .section {
166
+ .section-title {
167
+ margin-top: 1em;
168
+ }
169
+ }
170
+
171
+ .documents-list {
172
+ padding: 0;
173
+ list-style-type: none;
174
+
175
+ li a:before {
176
+ content: '' !important;
177
+ }
178
+ }
179
+
180
+ .share-info {
181
+ margin: 3.5em 0 !important;
182
+
183
+ .ui.button {
184
+ margin: 0 !important;
185
+ }
186
+ }
187
+
188
+ .ui.button {
189
+ margin: 1.5em 0 !important;
190
+ }
191
+
192
+ .content-box {
193
+ margin: 0;
194
+
195
+ h5 {
196
+ color: @secondaryColor;
197
+ }
198
+
199
+ .content-box-inner {
200
+ padding: 3.5em 0;
201
+ }
202
+ }
203
+
204
+ .video-wrapper {
205
+ margin-bottom: 2em;
206
+ }
207
+
208
+ .content-metadata {
209
+ h5 {
210
+ margin: 1em 0 0.5em 0;
211
+ color: @secondaryColor;
212
+
213
+ &:first-child {
214
+ margin-top: 0;
215
+ }
216
+ }
217
+
218
+ p,
219
+ span {
220
+ color: @grey-4;
221
+ }
222
+ }
223
+ }