@eeacms/volto-eea-website-theme 1.14.1 → 1.16.0

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,38 @@ 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.16.0](https://github.com/eea/volto-eea-website-theme/compare/1.15.0...1.16.0) - 8 June 2023
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix(comments): Upgrade customization of Comments.jsx to reflect the latest updates from Volto - refs #251360 [dobri1408 - [`2687b94`](https://github.com/eea/volto-eea-website-theme/commit/2687b94b5fc8738e22548c04b64eeb3bba50a12e)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - Updated package.json [Miu Razvan - [`da82fae`](https://github.com/eea/volto-eea-website-theme/commit/da82faefe753c7fdc9f6122cc111e81a41f0e947)]
16
+ ### [1.15.0](https://github.com/eea/volto-eea-website-theme/compare/1.14.1...1.15.0) - 6 June 2023
17
+
18
+ #### :rocket: New Features
19
+
20
+ - feat: can disable all actions from footer - refs #253198 [Teodor Voicu - [`ab52ee8`](https://github.com/eea/volto-eea-website-theme/commit/ab52ee818d4343add1ac641b1a7a2e1c76ce0946)]
21
+ - feat(blocks): add body class option in layout settings block #138 from eea/layout-body-class [ichim-david - [`4409d1c`](https://github.com/eea/volto-eea-website-theme/commit/4409d1c7416ad143eafe578d55c2c9ef70433879)]
22
+ - feat(blocks): add homepage class in layout settings block [kreafox - [`979ed1e`](https://github.com/eea/volto-eea-website-theme/commit/979ed1eae9253735ad20c4558c021a1a0ec267d6)]
23
+ - feat(blocks): add body class option in layout settings block [kreafox - [`d401bd6`](https://github.com/eea/volto-eea-website-theme/commit/d401bd6651481c9e5a1fe626724d80bf7d3babed)]
24
+
25
+ #### :nail_care: Enhancements
26
+
27
+ - change(title): use portal type_title instead @type refs151851 [nileshgulia1 - [`aa38e44`](https://github.com/eea/volto-eea-website-theme/commit/aa38e4444f12cab2f80647774b3e4933053fade6)]
28
+ - change(layout-block): removed css that hid the layout settings [David Ichim - [`1e26a94`](https://github.com/eea/volto-eea-website-theme/commit/1e26a94a01fcbc44f6e07c6fa60e5e43f9545788)]
29
+ - change(layout): removed most used from layout block [David Ichim - [`31c901d`](https://github.com/eea/volto-eea-website-theme/commit/31c901d75d509d011269dee4224e0bec6b12bfe4)]
30
+ - change(blocks): remove restriction in layout settings block [kreafox - [`c3b01f6`](https://github.com/eea/volto-eea-website-theme/commit/c3b01f60b84ccc8b4ae6446a2b607615a3546ceb)]
31
+
32
+ #### :house: Internal changes
33
+
34
+
35
+ #### :hammer_and_wrench: Others
36
+
37
+ - other: group restricted blocks in an array [Miu Razvan - [`b79680d`](https://github.com/eea/volto-eea-website-theme/commit/b79680dd4162a0ee316489d15c76eab274888f74)]
38
+ - Bump to 1.15.0 [kreafox - [`48aa9d8`](https://github.com/eea/volto-eea-website-theme/commit/48aa9d8e8dd45bd1ca0a1a63b579ed3db77e7463)]
7
39
  ### [1.14.1](https://github.com/eea/volto-eea-website-theme/compare/1.14.0...1.14.1) - 22 May 2023
8
40
 
9
41
  #### :rocket: New Features
@@ -154,7 +186,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
154
186
 
155
187
  #### :hammer_and_wrench: Others
156
188
 
157
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`6c5e2f8`](https://github.com/eea/volto-eea-website-theme/commit/6c5e2f80456e2061d9e9c15fd0a0b91b9ac70568)]
158
189
  ### [1.9.1](https://github.com/eea/volto-eea-website-theme/compare/1.9.0...1.9.1) - 28 February 2023
159
190
 
160
191
  #### :bug: Bug Fixes
@@ -301,7 +332,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
301
332
 
302
333
  - For some reasons types is a string [Alin Voinea - [`3769a09`](https://github.com/eea/volto-eea-website-theme/commit/3769a0981181d5b633f3498daebbe96be8b4b833)]
303
334
  - Fix(redirect): o.filter - refs #157627 [Alin Voinea - [`deb23da`](https://github.com/eea/volto-eea-website-theme/commit/deb23da846444cc96539697fd798429ae0abe89e)]
304
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`f1fffc5`](https://github.com/eea/volto-eea-website-theme/commit/f1fffc5db96725440863d545580b4e76cce4b796)]
305
335
  ### [1.5.0](https://github.com/eea/volto-eea-website-theme/compare/1.4.2...1.5.0) - 9 January 2023
306
336
 
307
337
  #### :hammer_and_wrench: Others
@@ -335,7 +365,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
335
365
 
336
366
  - Release 1.4.0 [Alin Voinea - [`bd42a0d`](https://github.com/eea/volto-eea-website-theme/commit/bd42a0d26e928cac5d99933194755da3db06b341)]
337
367
  - bump version to use as volto-eea-design-system [David Ichim - [`f4be047`](https://github.com/eea/volto-eea-website-theme/commit/f4be047328b46399b03b612d378b18aaf82e7dc1)]
338
- - Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`9b7cfef`](https://github.com/eea/volto-eea-website-theme/commit/9b7cfefb4d34fc1c948015e491feb370f9795bd8)]
339
368
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`df252a9`](https://github.com/eea/volto-eea-website-theme/commit/df252a9bfed0bb86cadf53c59dd1603b1e2cd822)]
340
369
  ### [1.3.2](https://github.com/eea/volto-eea-website-theme/compare/1.3.1...1.3.2) - 16 December 2022
341
370
 
@@ -345,7 +374,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
345
374
 
346
375
  #### :hammer_and_wrench: Others
347
376
 
348
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`a43c658`](https://github.com/eea/volto-eea-website-theme/commit/a43c658a7920c8df95e763b9a637f38ce77eba2c)]
349
377
  - Better razzle.config [Tiberiu Ichim - [`81dbf48`](https://github.com/eea/volto-eea-website-theme/commit/81dbf48815fb27facb4f82c9b764540fdf188b2e)]
350
378
  - Better razzle.config [Tiberiu Ichim - [`7bc9da2`](https://github.com/eea/volto-eea-website-theme/commit/7bc9da2cd837ab62a95cd29979cdd9b0055b7d67)]
351
379
  ### [1.3.1](https://github.com/eea/volto-eea-website-theme/compare/1.3.0...1.3.1) - 28 November 2022
@@ -356,7 +384,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
356
384
 
357
385
  #### :hammer_and_wrench: Others
358
386
 
359
- - yarn 3 [Alin Voinea - [`ea7a709`](https://github.com/eea/volto-eea-website-theme/commit/ea7a7094945312776e9b6f44e371178603e92139)]
360
387
  ### [1.3.0](https://github.com/eea/volto-eea-website-theme/compare/1.2.0...1.3.0) - 22 November 2022
361
388
 
362
389
  #### :rocket: New Features
@@ -397,7 +424,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
397
424
  - Add subsite class to body [Tiberiu Ichim - [`74d700f`](https://github.com/eea/volto-eea-website-theme/commit/74d700fbfd6249a8604762a7e4e49cce857db0f3)]
398
425
  - Add subsite info to header [Tiberiu Ichim - [`47daf8b`](https://github.com/eea/volto-eea-website-theme/commit/47daf8bb6374a1222040626b19d4154df7ba1b83)]
399
426
  - fix eslint [Miu Razvan - [`eb8d0a7`](https://github.com/eea/volto-eea-website-theme/commit/eb8d0a790bc70c0aae256c6ff35f63c4885f338e)]
400
- - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`cc578a4`](https://github.com/eea/volto-eea-website-theme/commit/cc578a413b205a8e61e091fab3a88f94cedefc89)]
401
427
  ### [1.1.0](https://github.com/eea/volto-eea-website-theme/compare/1.0.0...1.1.0) - 28 October 2022
402
428
 
403
429
  #### :nail_care: Enhancements
@@ -445,7 +471,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
445
471
 
446
472
  #### :hammer_and_wrench: Others
447
473
 
448
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`33b56ac`](https://github.com/eea/volto-eea-website-theme/commit/33b56acb13fbaf0c5b79e8fc6e13c4b699c79c90)]
449
474
  ### [0.7.3](https://github.com/eea/volto-eea-website-theme/compare/0.7.2...0.7.3) - 22 September 2022
450
475
 
451
476
  #### :hammer_and_wrench: Others
@@ -713,7 +738,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
713
738
  - Header refactor, add custom logo #5 [ichim-david - [`4950235`](https://github.com/eea/volto-eea-website-theme/commit/49502358105437cfeac3b144e6d301cb59aa2346)]
714
739
  - Update footer.config with new publication card component [ichim-david - [`2e38e9a`](https://github.com/eea/volto-eea-website-theme/commit/2e38e9a417f835009d60c80d4eb4b30229f55e45)]
715
740
  - feature(breadcrumbs): implement eea-design-system breadcrumb as Volto component #32 #7 [ichim-david - [`181af41`](https://github.com/eea/volto-eea-website-theme/commit/181af4125ce2b9ddac56dab4723cb11c26633221)]
716
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`da8ceb6`](https://github.com/eea/volto-eea-website-theme/commit/da8ceb68ea68bfbc9504e48ccd4d68277f11ab9a)]
717
741
  - use breadcrumbs from eea-design-system [nileshgulia1 - [`db2f9e9`](https://github.com/eea/volto-eea-website-theme/commit/db2f9e9a4327420a3cce9a9903cd88549b129eab)]
718
742
  - Update theme.config [ichim-david - [`8eca4f4`](https://github.com/eea/volto-eea-website-theme/commit/8eca4f40397a4aeca6d39029c92db78968d37064)]
719
743
  - Added keyContent component to theme.config [ichim-david - [`d86f202`](https://github.com/eea/volto-eea-website-theme/commit/d86f202d0274d839487a88b51cae9a0e899beb23)]
@@ -755,5 +779,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
755
779
 
756
780
  #### :hammer_and_wrench: Others
757
781
 
758
- - yarn bootstrap [Alin Voinea - [`6995e9e`](https://github.com/eea/volto-eea-website-theme/commit/6995e9e091f21fdbbdffa8a44fc0e2c626f6d46a)]
759
782
  - Initial commit [Alin Voinea - [`6a9c03a`](https://github.com/eea/volto-eea-website-theme/commit/6a9c03a7cebe71ca87e82cf58c42904063e9d8d3)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "1.14.1",
3
+ "version": "1.16.0",
4
4
  "description": "@eeacms/volto-eea-website-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { EditSchema } from './schema';
3
3
  import { BlockDataForm, SidebarPortal } from '@plone/volto/components';
4
4
  import LayoutSettingsView from './LayoutSettingsView';
5
- import './edit.less';
6
5
 
7
6
  const LayoutSettingsEdit = (props) => {
8
7
  const schema = EditSchema();
@@ -12,10 +12,8 @@ export default (config) => {
12
12
  view: LayoutSettingsView,
13
13
  edit: LayoutSettingsEdit,
14
14
  schema: BlockSettingsSchema,
15
- restricted: ({ properties }) => {
16
- return !!properties['@type'];
17
- },
18
- mostUsed: true,
15
+ restricted: false,
16
+ mostUsed: false,
19
17
  blockHasOwnFocusManagement: true,
20
18
  sidebarTab: 1,
21
19
  };
@@ -15,7 +15,7 @@ export const EditSchema = () => {
15
15
  {
16
16
  id: 'default',
17
17
  title: 'Default',
18
- fields: ['layout_size'],
18
+ fields: ['layout_size', 'body_class'],
19
19
  },
20
20
  ],
21
21
  required: [],
@@ -26,6 +26,13 @@ export const EditSchema = () => {
26
26
  actions: Object.keys(ALIGN_INFO_MAP),
27
27
  actionsInfoMap: ALIGN_INFO_MAP,
28
28
  },
29
+ body_class: {
30
+ title: 'Body class',
31
+ choices: [
32
+ ['homepage', 'Homepage'],
33
+ ['homepage-inverse', 'Homepage inverse'],
34
+ ],
35
+ },
29
36
  },
30
37
  };
31
38
  };
@@ -3,11 +3,9 @@ import { compose } from 'redux';
3
3
  import { connect } from 'react-redux';
4
4
  import { withRouter } from 'react-router';
5
5
  import { defineMessages, injectIntl } from 'react-intl';
6
- import { startCase } from 'lodash';
7
- import qs from 'querystring';
6
+ import startCase from 'lodash/startCase';
8
7
  import { Icon } from 'semantic-ui-react';
9
8
  import Popup from '@eeacms/volto-eea-design-system/ui/Popup/Popup';
10
- import { flattenToAppURL } from '@plone/volto/helpers';
11
9
  import config from '@plone/volto/registry';
12
10
  import Banner from '@eeacms/volto-eea-design-system/ui/Banner/Banner';
13
11
  import {
@@ -62,7 +60,7 @@ const Title = ({ config = {}, properties }) => {
62
60
  };
63
61
 
64
62
  const View = (props) => {
65
- const { banner = {}, intl, location, types = [] } = props;
63
+ const { banner = {}, intl } = props;
66
64
  const metadata = props.metadata || props.properties;
67
65
  const popupRef = useRef(null);
68
66
  const {
@@ -81,11 +79,6 @@ const View = (props) => {
81
79
  const copyrightPrefix =
82
80
  config.blocks.blocksConfig.title.copyrightPrefix || '';
83
81
 
84
- // Set query parameters
85
- const parameters = useMemo(
86
- () => qs.parse(location.search.replace('?', '')) || {},
87
- [location],
88
- );
89
82
  // Set dates
90
83
  const getDate = useCallback(
91
84
  (hidden, key) => {
@@ -109,18 +102,7 @@ const View = (props) => {
109
102
  // Set image source
110
103
  const image = getImageSource(metadata['image']);
111
104
  // Get type
112
- const type = useMemo(() => {
113
- return (
114
- types?.filter?.(
115
- (type) =>
116
- flattenToAppURL(type['@id']) ===
117
- `/@types/${metadata['@type'] || parameters.type}`,
118
- )[0]?.title ||
119
- friendlyId(metadata['@type']) ||
120
- metadata['@type'] ||
121
- parameters.type
122
- );
123
- }, [types, metadata, parameters]);
105
+ const type = metadata.type_title || friendlyId(metadata['@type']);
124
106
 
125
107
  return (
126
108
  <Banner {...props} image={image}>
@@ -0,0 +1,232 @@
1
+ /**
2
+ * Contents properties modal.
3
+ * @module components/manage/Contents/ContentsPropertiesModal
4
+ */
5
+
6
+ import React, { Component } from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import { connect } from 'react-redux';
9
+ import { compose } from 'redux';
10
+ import { isEmpty, map } from 'lodash';
11
+ import { defineMessages, injectIntl } from 'react-intl';
12
+
13
+ import { updateContent } from '@plone/volto/actions';
14
+ import { ModalForm } from '@plone/volto/components';
15
+
16
+ const messages = defineMessages({
17
+ properties: {
18
+ id: 'Properties',
19
+ defaultMessage: 'Properties',
20
+ },
21
+ default: {
22
+ id: 'Default',
23
+ defaultMessage: 'Default',
24
+ },
25
+ effectiveTitle: {
26
+ id: 'Publishing Date',
27
+ defaultMessage: 'Publishing Date',
28
+ },
29
+ effectiveDescription: {
30
+ id:
31
+ 'If this date is in the future, the content will not show up in listings and searches until this date.',
32
+ defaultMessage:
33
+ 'If this date is in the future, the content will not show up in listings and searches until this date.',
34
+ },
35
+ expiresTitle: {
36
+ id: 'Expiration Date',
37
+ defaultMessage: 'Expiration Date',
38
+ },
39
+ expiresDescription: {
40
+ id:
41
+ 'When this date is reached, the content will nolonger be visible in listings and searches.',
42
+ defaultMessage:
43
+ 'When this date is reached, the content will nolonger be visible in listings and searches.',
44
+ },
45
+ rightsTitle: {
46
+ id: 'Rights',
47
+ defaultMessage: 'Rights',
48
+ },
49
+ rightsDescription: {
50
+ id: 'Copyright statement or other rights information on this item.',
51
+ defaultMessage:
52
+ 'Copyright statement or other rights information on this item.',
53
+ },
54
+ creatorsTitle: {
55
+ id: 'Creators',
56
+ defaultMessage: 'Creators',
57
+ },
58
+ creatorsDescription: {
59
+ id:
60
+ 'Persons responsible for creating the content of this item. Please enter a list of user names, one per line. The principal creator should come first.',
61
+ defaultMessage:
62
+ 'Persons responsible for creating the content of this item. Please enter a list of user names, one per line. The principal creator should come first.',
63
+ },
64
+ excludeFromNavTitle: {
65
+ id: 'Exclude from navigation',
66
+ defaultMessage: 'Exclude from navigation',
67
+ },
68
+ excludeFromNavDescription: {
69
+ id: 'If selected, this item will not appear in the navigation tree',
70
+ defaultMessage:
71
+ 'If selected, this item will not appear in the navigation tree',
72
+ },
73
+ yes: {
74
+ id: 'Yes',
75
+ defaultMessage: 'Yes',
76
+ },
77
+ no: {
78
+ id: 'No',
79
+ defaultMessage: 'No',
80
+ },
81
+ });
82
+
83
+ /**
84
+ * ContentsPropertiesModal class.
85
+ * @class ContentsPropertiesModal
86
+ * @extends Component
87
+ */
88
+ class ContentsPropertiesModal extends Component {
89
+ /**
90
+ * Property types.
91
+ * @property {Object} propTypes Property types.
92
+ * @static
93
+ */
94
+ static propTypes = {
95
+ updateContent: PropTypes.func.isRequired,
96
+ items: PropTypes.arrayOf(PropTypes.string).isRequired,
97
+ request: PropTypes.shape({
98
+ loading: PropTypes.bool,
99
+ loaded: PropTypes.bool,
100
+ }).isRequired,
101
+ open: PropTypes.bool.isRequired,
102
+ onOk: PropTypes.func.isRequired,
103
+ onCancel: PropTypes.func.isRequired,
104
+ };
105
+
106
+ /**
107
+ * Constructor
108
+ * @method constructor
109
+ * @param {Object} props Component properties
110
+ * @constructs ContentsUploadModal
111
+ */
112
+ constructor(props) {
113
+ super(props);
114
+
115
+ this.onSubmit = this.onSubmit.bind(this);
116
+ }
117
+
118
+ /**
119
+ * Component will receive props
120
+ * @method componentWillReceiveProps
121
+ * @param {Object} nextProps Next properties
122
+ * @returns {undefined}
123
+ */
124
+ UNSAFE_componentWillReceiveProps(nextProps) {
125
+ if (this.props.request.loading && nextProps.request.loaded) {
126
+ this.props.onOk();
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Submit handler
132
+ * @method onSubmit
133
+ * @param {Object} data Form data
134
+ * @returns {undefined}
135
+ */
136
+ onSubmit(data) {
137
+ if (isEmpty(data)) {
138
+ this.props.onOk();
139
+ } else {
140
+ this.props.updateContent(
141
+ this.props.items,
142
+ map(this.props.items, () => data),
143
+ );
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Render method.
149
+ * @method render
150
+ * @returns {string} Markup for the component.
151
+ */
152
+ render() {
153
+ return (
154
+ this.props.open && (
155
+ <ModalForm
156
+ open={this.props.open}
157
+ onSubmit={this.onSubmit}
158
+ onCancel={this.props.onCancel}
159
+ title={this.props.intl.formatMessage(messages.properties)}
160
+ schema={{
161
+ fieldsets: [
162
+ {
163
+ id: 'default',
164
+ title: this.props.intl.formatMessage(messages.default),
165
+ fields: [
166
+ 'effective',
167
+ 'expires',
168
+ 'rights',
169
+ 'creators',
170
+ 'exclude_from_nav',
171
+ ],
172
+ },
173
+ ],
174
+ properties: {
175
+ effective: {
176
+ description: this.props.intl.formatMessage(
177
+ messages.effectiveDescription,
178
+ ),
179
+ title: this.props.intl.formatMessage(messages.effectiveTitle),
180
+ type: 'string',
181
+ widget: 'datetime',
182
+ },
183
+ expires: {
184
+ description: this.props.intl.formatMessage(
185
+ messages.expiresDescription,
186
+ ),
187
+ title: this.props.intl.formatMessage(messages.expiresTitle),
188
+ type: 'string',
189
+ widget: 'datetime',
190
+ },
191
+ rights: {
192
+ description: this.props.intl.formatMessage(
193
+ messages.rightsDescription,
194
+ ),
195
+ title: this.props.intl.formatMessage(messages.rightsTitle),
196
+ type: 'string',
197
+ widget: 'textarea',
198
+ },
199
+ creators: {
200
+ description: this.props.intl.formatMessage(
201
+ messages.creatorsDescription,
202
+ ),
203
+ title: this.props.intl.formatMessage(messages.creatorsTitle),
204
+ type: 'array',
205
+ },
206
+ exclude_from_nav: {
207
+ description: this.props.intl.formatMessage(
208
+ messages.excludeFromNavDescription,
209
+ ),
210
+ title: this.props.intl.formatMessage(
211
+ messages.excludeFromNavTitle,
212
+ ),
213
+ type: 'boolean',
214
+ },
215
+ },
216
+ required: [],
217
+ }}
218
+ />
219
+ )
220
+ );
221
+ }
222
+ }
223
+
224
+ export default compose(
225
+ injectIntl,
226
+ connect(
227
+ (state) => ({
228
+ request: state.content.update,
229
+ }),
230
+ { updateContent },
231
+ ),
232
+ )(ContentsPropertiesModal);
@@ -18,8 +18,10 @@ import { Portal } from 'react-portal';
18
18
  import { connect } from 'react-redux';
19
19
  import { compose } from 'redux';
20
20
  import { Button, Comment, Container, Icon } from 'semantic-ui-react';
21
+ import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
21
22
  import { formatRelativeDate } from '@plone/volto/helpers/Utils/Date';
22
23
  import config from '@plone/volto/registry';
24
+ // import { Button, Grid, Segment, Container } from 'semantic-ui-react';
23
25
 
24
26
  const messages = defineMessages({
25
27
  comment: {
@@ -296,7 +298,7 @@ class Comments extends Component {
296
298
  * @returns {string} Markup for the component.
297
299
  */
298
300
  render() {
299
- const { items } = this.props;
301
+ const { items, permissions } = this.props;
300
302
  const { collapsedComments } = this.state;
301
303
  // object with comment ids, to easily verify if any comment has children
302
304
  const allCommentsWithCildren = this.addRepliesAsChildrenToComments(items);
@@ -308,7 +310,7 @@ class Comments extends Component {
308
310
  const commentElement = (comment) => (
309
311
  <Comment key={comment.comment_id}>
310
312
  <Avatar
311
- src={comment.author_image}
313
+ src={flattenToAppURL(comment.author_image)}
312
314
  title={comment.author_name || 'Anonymous'}
313
315
  color={getColor(comment.author_username)}
314
316
  />
@@ -338,13 +340,15 @@ class Comments extends Component {
338
340
  )}
339
341
  </Comment.Text>
340
342
  <Comment.Actions>
341
- <Comment.Action
342
- as="a"
343
- aria-label={this.props.intl.formatMessage(messages.reply)}
344
- onClick={() => this.setReplyTo(comment.comment_id)}
345
- >
346
- <FormattedMessage id="Reply" defaultMessage="Reply" />
347
- </Comment.Action>
343
+ {comment.can_reply && (
344
+ <Comment.Action
345
+ as="a"
346
+ aria-label={this.props.intl.formatMessage(messages.reply)}
347
+ onClick={() => this.setReplyTo(comment.comment_id)}
348
+ >
349
+ <FormattedMessage id="Reply" defaultMessage="Reply" />
350
+ </Comment.Action>
351
+ )}
348
352
  {comment.is_editable && (
349
353
  <Comment.Action
350
354
  onClick={() =>
@@ -420,6 +424,8 @@ class Comments extends Component {
420
424
  </Comment>
421
425
  );
422
426
 
427
+ if (!permissions.view_comments) return '';
428
+
423
429
  return (
424
430
  <Container className="comments">
425
431
  <CommentEditModal
@@ -429,16 +435,17 @@ class Comments extends Component {
429
435
  id={this.state.editId}
430
436
  text={this.state.editText}
431
437
  />
432
- <div id="comment-add-id">
433
- <Form
434
- onSubmit={this.onSubmit}
435
- onCancel={this.onEditCancel}
436
- submitLabel={this.props.intl.formatMessage(messages.comment)}
437
- resetAfterSubmit
438
- schema={makeFormSchema(this.props.intl)}
439
- />
440
- </div>
441
-
438
+ {permissions.can_reply && (
439
+ <div id="comment-add-id">
440
+ <Form
441
+ onSubmit={this.onSubmit}
442
+ onCancel={this.onEditCancel}
443
+ submitLabel={this.props.intl.formatMessage(messages.comment)}
444
+ resetAfterSubmit
445
+ schema={makeFormSchema(this.props.intl)}
446
+ />
447
+ </div>
448
+ )}
442
449
  {/* all comments */}
443
450
  <Comment.Group threaded={false}>
444
451
  {allPrimaryComments.map((item) => commentElement(item))}
@@ -474,11 +481,13 @@ class Comments extends Component {
474
481
 
475
482
  export default compose(
476
483
  injectIntl,
484
+ injectLazyLibs(['moment']),
477
485
  connect(
478
486
  (state) => ({
479
487
  items: state.comments.items,
480
488
  next: state.comments.next,
481
489
  items_total: state.comments.items_total,
490
+ permissions: state.comments.permissions || {},
482
491
  addRequest: state.comments.add,
483
492
  deleteRequest: state.comments.delete,
484
493
  }),
@@ -8,6 +8,7 @@ import { useSelector, shallowEqual } from 'react-redux';
8
8
  import { flattenToAppURL } from '@plone/volto/helpers';
9
9
  import EEAFooter from '@eeacms/volto-eea-design-system/ui/Footer/Footer';
10
10
  import config from '@plone/volto/registry';
11
+ import isArray from 'lodash/isArray';
11
12
 
12
13
  const Footer = () => {
13
14
  const { eea } = config.settings;
@@ -28,7 +29,7 @@ const Footer = () => {
28
29
  shallowEqual,
29
30
  );
30
31
  // ZMI > portal_actions > footer_actions
31
- const actions = footerActions.length
32
+ const actions = isArray(footerActions)
32
33
  ? footerActions.map((action) => ({
33
34
  title: action.title,
34
35
  link: flattenToAppURL(action.url),
@@ -36,7 +37,7 @@ const Footer = () => {
36
37
  : eea.footerOpts.actions;
37
38
 
38
39
  // ZMI > portal_actions > copyright_actions
39
- const copyright = copyrightActions.length
40
+ const copyright = isArray(copyrightActions)
40
41
  ? copyrightActions.map((action) => ({
41
42
  title: action.title,
42
43
  site: action.title,
@@ -45,7 +46,7 @@ const Footer = () => {
45
46
  : eea.footerOpts.copyright;
46
47
 
47
48
  // ZMI > portal_actions > social_actions
48
- const social = socialActions.length
49
+ const social = isArray(socialActions)
49
50
  ? socialActions.map((action) => ({
50
51
  name: action.id,
51
52
  icon: action.icon,
@@ -54,7 +55,7 @@ const Footer = () => {
54
55
  : eea.footerOpts.social;
55
56
 
56
57
  // ZMI > portal_actions > contact_actions
57
- const contacts = contactActions.length
58
+ const contacts = isArray(contactActions)
58
59
  ? contactActions.map((action, idx) => ({
59
60
  text: action.title,
60
61
  icon: action.icon,
package/src/index.js CHANGED
@@ -16,6 +16,12 @@ import voltoCustomMiddleware from './middleware/voltoCustom';
16
16
  import okMiddleware from './middleware/ok';
17
17
  import installSlate from './slate';
18
18
 
19
+ const restrictedBlocks = [
20
+ '__grid', // Grid/Teaser block (kitconcept)
21
+ 'imagesGrid',
22
+ 'teaser',
23
+ ];
24
+
19
25
  const applyConfig = (config) => {
20
26
  // EEA specific settings
21
27
  config.settings.eea = {
@@ -34,6 +40,13 @@ const applyConfig = (config) => {
34
40
  // Disable tags on View
35
41
  config.settings.showTags = false;
36
42
 
43
+ // Disable some blocks
44
+ restrictedBlocks.forEach((block) => {
45
+ if (config.blocks.blocksConfig[block]) {
46
+ config.blocks.blocksConfig[block].restricted = true;
47
+ }
48
+ });
49
+
37
50
  // Enable Title block
38
51
  config.blocks.blocksConfig.title.restricted = false;
39
52
 
@@ -206,17 +219,6 @@ const applyConfig = (config) => {
206
219
  },
207
220
  ];
208
221
 
209
- // Grid/Teaser block (kitconcept)
210
- if (config.blocks.blocksConfig.__grid) {
211
- config.blocks.blocksConfig.__grid.restricted = true;
212
- }
213
- if (config.blocks.blocksConfig.imagesGrid) {
214
- config.blocks.blocksConfig.imagesGrid.restricted = true;
215
- }
216
- if (config.blocks.blocksConfig.teaser) {
217
- config.blocks.blocksConfig.teaser.restricted = true;
218
- }
219
-
220
222
  // layout settings
221
223
  config = [installLayoutSettingsBlock].reduce(
222
224
  (acc, apply) => apply(acc),
@@ -1,4 +0,0 @@
1
- #page-edit .block-editor-layoutSettings,
2
- #page-add .block-editor-layoutSettings {
3
- display: none;
4
- }