@eeacms/volto-eea-website-policy 0.3.2 → 0.3.3
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,106 +4,89 @@ 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
|
-
|
|
7
|
+
### [0.3.3](https://github.com/eea/volto-eea-website-policy/compare/0.3.2...0.3.3) - 5 September 2022
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- Customize Blocks helper - copy unchanged from @plone/volto 16.alpha.12 [`368ffa8`](https://github.com/eea/volto-eea-website-policy/commit/368ffa8c9ebfc54d364d7bf13b60f4016f1c90e8)
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
- override(ContentTypeLayout): Enable volto.blocks.editable.layout - refs #153858 [Alin Voinea - [`a07d3f5`](https://github.com/eea/volto-eea-website-policy/commit/a07d3f5f175925fdcd600e3c99620b4c0f42cb69)]
|
|
12
|
+
- override(ContentTypeLayout) - from @plone/volto 16 alpha 12 [Alin Voinea - [`777068d`](https://github.com/eea/volto-eea-website-policy/commit/777068d4b41d4c94863e2c34ea274f150ead7875)]
|
|
13
|
+
### [0.3.2](https://github.com/eea/volto-eea-website-policy/compare/0.3.1...0.3.2) - 10 August 2022
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
#### :hammer_and_wrench: Others
|
|
15
16
|
|
|
16
|
-
-
|
|
17
|
+
- Safely get data - refs #153018 [Alin Voinea - [`aefc689`](https://github.com/eea/volto-eea-website-policy/commit/aefc68979f6aad86ea02952f82e639dfe8c566f2)]
|
|
18
|
+
- Customize Blocks helper - copy unchanged from @plone/volto 16.alpha.12 [Alin Voinea - [`368ffa8`](https://github.com/eea/volto-eea-website-policy/commit/368ffa8c9ebfc54d364d7bf13b60f4016f1c90e8)]
|
|
19
|
+
### [0.3.1](https://github.com/eea/volto-eea-website-policy/compare/0.3.0...0.3.1) - 1 August 2022
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
### [0.3.0](https://github.com/eea/volto-eea-website-policy/compare/0.2.6...0.3.0) - 6 July 2022
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
#### :nail_care: Enhancements
|
|
21
24
|
|
|
22
|
-
- change(
|
|
23
|
-
- change(
|
|
24
|
-
- change(item):
|
|
25
|
-
- change(item): commented sizes too small for item icons and enabled tertiary theme [`0f02d7d`](https://github.com/eea/volto-eea-website-policy/commit/0f02d7d6204b068b78c3f977a561782a19b6f79e)
|
|
25
|
+
- change(package): bump release version [David Ichim - [`1b00439`](https://github.com/eea/volto-eea-website-policy/commit/1b0043933442bb73c1042dce644a2c09e5f210f4)]
|
|
26
|
+
- change(item): enable theming for icon and text color and added tertiary option [David Ichim - [`58c2d28`](https://github.com/eea/volto-eea-website-policy/commit/58c2d2864fe94c9e7808064b61d3b6c4e6fccbb1)]
|
|
27
|
+
- change(item): commented sizes too small for item icons and enabled tertiary theme [David Ichim - [`0f02d7d`](https://github.com/eea/volto-eea-website-policy/commit/0f02d7d6204b068b78c3f977a561782a19b6f79e)]
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
### [0.2.6](https://github.com/eea/volto-eea-website-policy/compare/0.2.5...0.2.6) - 1 July 2022
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
#### :hammer_and_wrench: Others
|
|
30
32
|
|
|
31
|
-
- Fix Cannot read properties of undefined (reading 'translations') [`8e7b8b8`](https://github.com/eea/volto-eea-website-policy/commit/8e7b8b8533b14f173d77783fe2d0b517c29c5937)
|
|
32
|
-
- Customize Toolbar.jsx - copied unchanged from @plone/volto 16.0.0.alpha.11 [`b7add4f`](https://github.com/eea/volto-eea-website-policy/commit/b7add4faa8ef2dde7d77489fc8bc431cbb023314)
|
|
33
|
+
- Fix Cannot read properties of undefined (reading 'translations') [Alin Voinea - [`8e7b8b8`](https://github.com/eea/volto-eea-website-policy/commit/8e7b8b8533b14f173d77783fe2d0b517c29c5937)]
|
|
34
|
+
- Customize Toolbar.jsx - copied unchanged from @plone/volto 16.0.0.alpha.11 [Alin Voinea - [`b7add4f`](https://github.com/eea/volto-eea-website-policy/commit/b7add4faa8ef2dde7d77489fc8bc431cbb023314)]
|
|
35
|
+
### [0.2.5](https://github.com/eea/volto-eea-website-policy/compare/0.2.4...0.2.5) - 23 June 2022
|
|
33
36
|
|
|
34
|
-
####
|
|
37
|
+
#### :hammer_and_wrench: Others
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
- Rounded card via style wrapper [Alin Voinea - [`6728684`](https://github.com/eea/volto-eea-website-policy/commit/67286844b00902aa4c6b316b50be35db95c531f0)]
|
|
40
|
+
- Revert "Rounded Card variation - refs #148723" [Alin Voinea - [`0168a86`](https://github.com/eea/volto-eea-website-policy/commit/0168a86fa644a9b848e37c7f5054eb4308c36784)]
|
|
41
|
+
- Disable Image Cards block [Alin Voinea - [`3ed8dc3`](https://github.com/eea/volto-eea-website-policy/commit/3ed8dc311cad8e30a8c918ecec7b21cc99260c50)]
|
|
42
|
+
- Rounded Card variation - refs #148723 [Alin Voinea - [`4b46731`](https://github.com/eea/volto-eea-website-policy/commit/4b46731e25962bbb6e7159d0db8a9a642a95eb53)]
|
|
43
|
+
### [0.2.4](https://github.com/eea/volto-eea-website-policy/compare/0.2.3...0.2.4) - 13 June 2022
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
- Rounded card via style wrapper [`6728684`](https://github.com/eea/volto-eea-website-policy/commit/67286844b00902aa4c6b316b50be35db95c531f0)
|
|
40
|
-
- Revert "Rounded Card variation - refs #148723" [`0168a86`](https://github.com/eea/volto-eea-website-policy/commit/0168a86fa644a9b848e37c7f5054eb4308c36784)
|
|
41
|
-
- Disable Image Cards block [`3ed8dc3`](https://github.com/eea/volto-eea-website-policy/commit/3ed8dc311cad8e30a8c918ecec7b21cc99260c50)
|
|
42
|
-
- Rounded Card variation - refs #148723 [`4b46731`](https://github.com/eea/volto-eea-website-policy/commit/4b46731e25962bbb6e7159d0db8a9a642a95eb53)
|
|
45
|
+
#### :hammer_and_wrench: Others
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
- Fix listing block title: Listing (Content) [Alin Voinea - [`cec2760`](https://github.com/eea/volto-eea-website-policy/commit/cec276082c3fc1b5486c996c3746a6958fb3a1a9)]
|
|
48
|
+
- Add theme to teaser stylewrapper [Alin Voinea - [`60eeb28`](https://github.com/eea/volto-eea-website-policy/commit/60eeb28b7793708c59d0af73ffb09895e8f2c87d)]
|
|
49
|
+
- Fix className vs class warning [Alin Voinea - [`fea1603`](https://github.com/eea/volto-eea-website-policy/commit/fea1603eefd628d57640a6b94ddbbb7edfb0d841)]
|
|
50
|
+
- Custom card view for teaser [Alin Voinea - [`c8eded0`](https://github.com/eea/volto-eea-website-policy/commit/c8eded011b8317cce9f842526f5d86771f54797b)]
|
|
51
|
+
### [0.2.3](https://github.com/eea/volto-eea-website-policy/compare/0.2.2...0.2.3) - 10 June 2022
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
#### :hammer_and_wrench: Others
|
|
47
54
|
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
55
|
+
- prettier fix [David Ichim - [`c2a6d2d`](https://github.com/eea/volto-eea-website-policy/commit/c2a6d2d3b12ce771b9b4413c5a6db157ccd9d1fc)]
|
|
56
|
+
- Update index.js [ichim-david - [`fb73895`](https://github.com/eea/volto-eea-website-policy/commit/fb7389509bc7e207942762c5e02a93d0168a6fba)]
|
|
57
|
+
- removed change from commit 719e3778 [ichim-david - [`29e636b`](https://github.com/eea/volto-eea-website-policy/commit/29e636b34ab02992c67cc5960f4dc6b21b1b4e71)]
|
|
58
|
+
- added navDepth to level 4 in order to fill mega menu [ichim-david - [`719e377`](https://github.com/eea/volto-eea-website-policy/commit/719e37785cfa2ed37568c82a34dc470b52483d04)]
|
|
59
|
+
- Rearrange Block Chooser [Alin Voinea - [`9a5c118`](https://github.com/eea/volto-eea-website-policy/commit/9a5c1187ba21fa1898394a4b6cf6dd68bd68f258)]
|
|
60
|
+
- Move Item block un components folder [Miu Razvan - [`9fb6ab2`](https://github.com/eea/volto-eea-website-policy/commit/9fb6ab2fb02cc5c1a7e25367de5ebe7109bd3dc4)]
|
|
61
|
+
- Set default sizes for image & icon in Item block [Miu Razvan - [`af22ec7`](https://github.com/eea/volto-eea-website-policy/commit/af22ec78b2c6fd1d033dc1acfec5e64f8926cd77)]
|
|
62
|
+
- Add helpers functions [Miu Razvan - [`353581c`](https://github.com/eea/volto-eea-website-policy/commit/353581cc6602b5e573eee93c74a67656203c0968)]
|
|
63
|
+
- Add Teaser block folder's structure [Alin Voinea - [`9457dd4`](https://github.com/eea/volto-eea-website-policy/commit/9457dd4ffaa2631eceb46bfd1ec2d201e8b3d7a8)]
|
|
64
|
+
### [0.2.2](https://github.com/eea/volto-eea-website-policy/compare/0.2.1...0.2.2) - 24 May 2022
|
|
53
65
|
|
|
54
|
-
|
|
66
|
+
### [0.2.1](https://github.com/eea/volto-eea-website-policy/compare/0.2.0...0.2.1) - 25 March 2022
|
|
55
67
|
|
|
56
|
-
|
|
68
|
+
### [0.2.0](https://github.com/eea/volto-eea-website-policy/compare/0.1.1...0.2.0) - 18 March 2022
|
|
57
69
|
|
|
58
|
-
|
|
59
|
-
- prettier fix [`c2a6d2d`](https://github.com/eea/volto-eea-website-policy/commit/c2a6d2d3b12ce771b9b4413c5a6db157ccd9d1fc)
|
|
60
|
-
- Update index.js [`fb73895`](https://github.com/eea/volto-eea-website-policy/commit/fb7389509bc7e207942762c5e02a93d0168a6fba)
|
|
61
|
-
- removed change from commit 719e3778 [`29e636b`](https://github.com/eea/volto-eea-website-policy/commit/29e636b34ab02992c67cc5960f4dc6b21b1b4e71)
|
|
62
|
-
- added navDepth to level 4 in order to fill mega menu [`719e377`](https://github.com/eea/volto-eea-website-policy/commit/719e37785cfa2ed37568c82a34dc470b52483d04)
|
|
63
|
-
- Rearrange Block Chooser [`9a5c118`](https://github.com/eea/volto-eea-website-policy/commit/9a5c1187ba21fa1898394a4b6cf6dd68bd68f258)
|
|
64
|
-
- Move Item block un components folder [`9fb6ab2`](https://github.com/eea/volto-eea-website-policy/commit/9fb6ab2fb02cc5c1a7e25367de5ebe7109bd3dc4)
|
|
65
|
-
- Set default sizes for image & icon in Item block [`af22ec7`](https://github.com/eea/volto-eea-website-policy/commit/af22ec78b2c6fd1d033dc1acfec5e64f8926cd77)
|
|
66
|
-
- Add helpers functions [`353581c`](https://github.com/eea/volto-eea-website-policy/commit/353581cc6602b5e573eee93c74a67656203c0968)
|
|
67
|
-
- Add Teaser block folder's structure [`9457dd4`](https://github.com/eea/volto-eea-website-policy/commit/9457dd4ffaa2631eceb46bfd1ec2d201e8b3d7a8)
|
|
70
|
+
#### :hammer_and_wrench: Others
|
|
68
71
|
|
|
69
|
-
|
|
72
|
+
- Release 0.2.0 [Alin Voinea - [`4b72206`](https://github.com/eea/volto-eea-website-policy/commit/4b72206675ab13ed81567df590849613581d7f10)]
|
|
73
|
+
- Update index.js [Alexandru Ghica - [`0f5be15`](https://github.com/eea/volto-eea-website-policy/commit/0f5be1553b608f49c9a61bbc69a0f90219260a83)]
|
|
74
|
+
- Update index.js [Alexandru Ghica - [`03dd3b1`](https://github.com/eea/volto-eea-website-policy/commit/03dd3b162d3175df00048339bed4f9a7d097a896)]
|
|
75
|
+
- format index.js [Andrei Grigore - [`db4481a`](https://github.com/eea/volto-eea-website-policy/commit/db4481aeeba59a769272659f33278c902fc69bec)]
|
|
76
|
+
- Update index.js [Alexandru Ghica - [`dc09886`](https://github.com/eea/volto-eea-website-policy/commit/dc0988640a76a9914381b120f58bb61a9ab1eb39)]
|
|
77
|
+
- Added externalRoutes [Alexandru Ghica - [`b68135b`](https://github.com/eea/volto-eea-website-policy/commit/b68135b013fafa93a41ea602ea2fad30879abe0f)]
|
|
78
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`575cca6`](https://github.com/eea/volto-eea-website-policy/commit/575cca674602ca2e1c2a41300c47ba594ff49aa0)]
|
|
79
|
+
### [0.1.1](https://github.com/eea/volto-eea-website-policy/compare/0.1.0...0.1.1) - 4 March 2022
|
|
70
80
|
|
|
71
|
-
|
|
81
|
+
#### :hammer_and_wrench: Others
|
|
72
82
|
|
|
73
|
-
-
|
|
83
|
+
- Enable description block by default [Alin Voinea - [`b3d6534`](https://github.com/eea/volto-eea-website-policy/commit/b3d6534a57f7288899c4f59b5cec553370363d8b)]
|
|
84
|
+
- Prepare for first release [Alin Voinea - [`69e36b1`](https://github.com/eea/volto-eea-website-policy/commit/69e36b1c82b75b0917ef3d433581c50cdcf6c341)]
|
|
85
|
+
- Enable working copy support [Alin Voinea - [`7c6269d`](https://github.com/eea/volto-eea-website-policy/commit/7c6269d75df915f39c15e8ed0893cc062601e7a7)]
|
|
86
|
+
- Enable multilingual [Alin Voinea - [`73210b9`](https://github.com/eea/volto-eea-website-policy/commit/73210b90ad968909da0c15583992f8f58e99e632)]
|
|
87
|
+
### 0.1.0 - 4 March 2022
|
|
74
88
|
|
|
75
|
-
####
|
|
89
|
+
#### :hammer_and_wrench: Others
|
|
76
90
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
- 137187 keycloak integration for plone6 (#3) [`#6`](https://github.com/eea/volto-eea-website-policy/pull/6)
|
|
80
|
-
- 137187 keycloak integration for plone6 [`#3`](https://github.com/eea/volto-eea-website-policy/pull/3)
|
|
81
|
-
|
|
82
|
-
#### [0.2.0](https://github.com/eea/volto-eea-website-policy/compare/0.1.1...0.2.0)
|
|
83
|
-
|
|
84
|
-
> 18 March 2022
|
|
85
|
-
|
|
86
|
-
- Release [`#5`](https://github.com/eea/volto-eea-website-policy/pull/5)
|
|
87
|
-
- Enable multilingual - refs #146771 [`#4`](https://github.com/eea/volto-eea-website-policy/pull/4)
|
|
88
|
-
- Release 0.2.0 [`4b72206`](https://github.com/eea/volto-eea-website-policy/commit/4b72206675ab13ed81567df590849613581d7f10)
|
|
89
|
-
- Update index.js [`0f5be15`](https://github.com/eea/volto-eea-website-policy/commit/0f5be1553b608f49c9a61bbc69a0f90219260a83)
|
|
90
|
-
- Update index.js [`03dd3b1`](https://github.com/eea/volto-eea-website-policy/commit/03dd3b162d3175df00048339bed4f9a7d097a896)
|
|
91
|
-
- format index.js [`db4481a`](https://github.com/eea/volto-eea-website-policy/commit/db4481aeeba59a769272659f33278c902fc69bec)
|
|
92
|
-
- Update index.js [`dc09886`](https://github.com/eea/volto-eea-website-policy/commit/dc0988640a76a9914381b120f58bb61a9ab1eb39)
|
|
93
|
-
- Added externalRoutes [`b68135b`](https://github.com/eea/volto-eea-website-policy/commit/b68135b013fafa93a41ea602ea2fad30879abe0f)
|
|
94
|
-
|
|
95
|
-
#### [0.1.1](https://github.com/eea/volto-eea-website-policy/compare/0.1.0...0.1.1)
|
|
96
|
-
|
|
97
|
-
> 4 March 2022
|
|
98
|
-
|
|
99
|
-
- Release [`#1`](https://github.com/eea/volto-eea-website-policy/pull/1)
|
|
100
|
-
- Enable description block by default [`b3d6534`](https://github.com/eea/volto-eea-website-policy/commit/b3d6534a57f7288899c4f59b5cec553370363d8b)
|
|
101
|
-
- Prepare for first release [`69e36b1`](https://github.com/eea/volto-eea-website-policy/commit/69e36b1c82b75b0917ef3d433581c50cdcf6c341)
|
|
102
|
-
- Enable working copy support [`7c6269d`](https://github.com/eea/volto-eea-website-policy/commit/7c6269d75df915f39c15e8ed0893cc062601e7a7)
|
|
103
|
-
- Enable multilingual [`73210b9`](https://github.com/eea/volto-eea-website-policy/commit/73210b90ad968909da0c15583992f8f58e99e632)
|
|
104
|
-
|
|
105
|
-
#### 0.1.0
|
|
106
|
-
|
|
107
|
-
> 4 March 2022
|
|
108
|
-
|
|
109
|
-
- Initial commit [`3800692`](https://github.com/eea/volto-eea-website-policy/commit/3800692f7a4de6460815bd6061facacb986cbef0)
|
|
91
|
+
- yarn bootstrap [Alin Voinea - [`9b4d197`](https://github.com/eea/volto-eea-website-policy/commit/9b4d197cbc7992566cb36524d190078d5ad21a44)]
|
|
92
|
+
- Initial commit [Alin Voinea - [`3800692`](https://github.com/eea/volto-eea-website-policy/commit/3800692f7a4de6460815bd6061facacb986cbef0)]
|
package/package.json
CHANGED
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Type component.
|
|
3
|
+
* @module components/manage/Controlpanels/ContentTypeLayout
|
|
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 { Link } from 'react-router-dom';
|
|
11
|
+
import {
|
|
12
|
+
getParentUrl,
|
|
13
|
+
hasBlocksData,
|
|
14
|
+
getBlocksFieldname,
|
|
15
|
+
getBlocksLayoutFieldname,
|
|
16
|
+
} from '@plone/volto/helpers';
|
|
17
|
+
import { Portal } from 'react-portal';
|
|
18
|
+
import { Button, Segment } from 'semantic-ui-react';
|
|
19
|
+
import { toast } from 'react-toastify';
|
|
20
|
+
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
|
21
|
+
import { nth, join } from 'lodash';
|
|
22
|
+
import {
|
|
23
|
+
Error,
|
|
24
|
+
Form,
|
|
25
|
+
Icon,
|
|
26
|
+
Toolbar,
|
|
27
|
+
Sidebar,
|
|
28
|
+
Toast,
|
|
29
|
+
} from '@plone/volto/components';
|
|
30
|
+
import {
|
|
31
|
+
getSchema,
|
|
32
|
+
updateSchema,
|
|
33
|
+
getControlpanel,
|
|
34
|
+
updateControlpanel,
|
|
35
|
+
} from '@plone/volto/actions';
|
|
36
|
+
|
|
37
|
+
import saveSVG from '@plone/volto/icons/save.svg';
|
|
38
|
+
import clearSVG from '@plone/volto/icons/clear.svg';
|
|
39
|
+
import backSVG from '@plone/volto/icons/back.svg';
|
|
40
|
+
|
|
41
|
+
const messages = defineMessages({
|
|
42
|
+
changesSaved: {
|
|
43
|
+
id: 'Changes saved.',
|
|
44
|
+
defaultMessage: 'Changes saved.',
|
|
45
|
+
},
|
|
46
|
+
back: {
|
|
47
|
+
id: 'Back',
|
|
48
|
+
defaultMessage: 'Back',
|
|
49
|
+
},
|
|
50
|
+
save: {
|
|
51
|
+
id: 'Save',
|
|
52
|
+
defaultMessage: 'Save',
|
|
53
|
+
},
|
|
54
|
+
cancel: {
|
|
55
|
+
id: 'Cancel',
|
|
56
|
+
defaultMessage: 'Cancel',
|
|
57
|
+
},
|
|
58
|
+
info: {
|
|
59
|
+
id: 'Info',
|
|
60
|
+
defaultMessage: 'Info',
|
|
61
|
+
},
|
|
62
|
+
enable: {
|
|
63
|
+
id: 'Enable editable Blocks',
|
|
64
|
+
defaultMessage: 'Enable editable Blocks',
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* ContentTypeLayout class.
|
|
70
|
+
* @class ContentTypeLayout
|
|
71
|
+
* @extends Component
|
|
72
|
+
*/
|
|
73
|
+
class ContentTypeLayout extends Component {
|
|
74
|
+
/**
|
|
75
|
+
* Property types.
|
|
76
|
+
* @property {Object} propTypes Property types.
|
|
77
|
+
* @static
|
|
78
|
+
*/
|
|
79
|
+
static propTypes = {
|
|
80
|
+
updateControlpanel: PropTypes.func.isRequired,
|
|
81
|
+
getControlpanel: PropTypes.func.isRequired,
|
|
82
|
+
getSchema: PropTypes.func.isRequired,
|
|
83
|
+
updateSchema: PropTypes.func.isRequired,
|
|
84
|
+
id: PropTypes.string.isRequired,
|
|
85
|
+
parent: PropTypes.string.isRequired,
|
|
86
|
+
pathname: PropTypes.string.isRequired,
|
|
87
|
+
schemaRequest: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
88
|
+
cpanelRequest: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
89
|
+
schema: PropTypes.objectOf(PropTypes.any),
|
|
90
|
+
controlpanel: PropTypes.shape({
|
|
91
|
+
'@id': PropTypes.string,
|
|
92
|
+
data: PropTypes.object,
|
|
93
|
+
schema: PropTypes.object,
|
|
94
|
+
title: PropTypes.string,
|
|
95
|
+
}),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Default properties.
|
|
100
|
+
* @property {Object} defaultProps Default properties.
|
|
101
|
+
* @static
|
|
102
|
+
*/
|
|
103
|
+
static defaultProps = {
|
|
104
|
+
schema: {},
|
|
105
|
+
controlpanel: null,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Constructor
|
|
110
|
+
* @method constructor
|
|
111
|
+
* @param {Object} props Component properties
|
|
112
|
+
* @constructs ContentTypeLayout
|
|
113
|
+
*/
|
|
114
|
+
constructor(props) {
|
|
115
|
+
super(props);
|
|
116
|
+
|
|
117
|
+
this.state = {
|
|
118
|
+
visual: false,
|
|
119
|
+
content: null,
|
|
120
|
+
readOnlyBehavior: null,
|
|
121
|
+
error: null,
|
|
122
|
+
isClient: false,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
this.onCancel = this.onCancel.bind(this);
|
|
126
|
+
this.onSubmit = this.onSubmit.bind(this);
|
|
127
|
+
this.onEnableBlocks = this.onEnableBlocks.bind(this);
|
|
128
|
+
this.onEnableBlocksBehavior = this.onEnableBlocksBehavior.bind(this);
|
|
129
|
+
this.onDisableBlocksBehavior = this.onDisableBlocksBehavior.bind(this);
|
|
130
|
+
this.form = React.createRef();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Component did mount
|
|
135
|
+
* @method componentDidMount
|
|
136
|
+
* @returns {undefined}
|
|
137
|
+
*/
|
|
138
|
+
componentDidMount() {
|
|
139
|
+
this.props.getControlpanel(join([this.props.parent, this.props.id], '/'));
|
|
140
|
+
this.props.getSchema(this.props.id);
|
|
141
|
+
this.setState({ isClient: true });
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Component will receive props
|
|
146
|
+
* @method componentWillReceiveProps
|
|
147
|
+
* @param {Object} nextProps Next properties
|
|
148
|
+
* @returns {undefined}
|
|
149
|
+
*/
|
|
150
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
151
|
+
// Control Panel GET
|
|
152
|
+
if (
|
|
153
|
+
this.props.cpanelRequest.get.loading &&
|
|
154
|
+
nextProps.cpanelRequest.get.error
|
|
155
|
+
) {
|
|
156
|
+
this.setState({
|
|
157
|
+
error: nextProps.cpanelRequest.get.error,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Schema GET
|
|
162
|
+
if (this.props.schemaRequest.loading && nextProps.schemaRequest.loaded) {
|
|
163
|
+
const properties = nextProps.schema?.properties || {};
|
|
164
|
+
const content = {};
|
|
165
|
+
for (const key in properties) {
|
|
166
|
+
const value = properties[key].default;
|
|
167
|
+
if (value) {
|
|
168
|
+
content[key] = value;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (hasBlocksData(properties)) {
|
|
173
|
+
this.setState({
|
|
174
|
+
visual: true,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const blocksFieldName = getBlocksFieldname(properties);
|
|
178
|
+
const blocksLayoutFieldname = getBlocksLayoutFieldname(properties);
|
|
179
|
+
content[blocksFieldName] = properties[blocksFieldName]?.default || {};
|
|
180
|
+
content[blocksLayoutFieldname] = properties[blocksLayoutFieldname]
|
|
181
|
+
?.default || { items: [] };
|
|
182
|
+
|
|
183
|
+
const blocksBehavior = properties[blocksFieldName]?.behavior || '';
|
|
184
|
+
this.setState({
|
|
185
|
+
readOnlyBehavior: !blocksBehavior.includes('generated')
|
|
186
|
+
? blocksBehavior
|
|
187
|
+
: '',
|
|
188
|
+
});
|
|
189
|
+
} else {
|
|
190
|
+
this.setState({
|
|
191
|
+
visual: false,
|
|
192
|
+
readOnlyBehavior: '',
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
this.setState({
|
|
197
|
+
content: content,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Schema updated
|
|
202
|
+
if (
|
|
203
|
+
this.props.schemaRequest.update.loading &&
|
|
204
|
+
nextProps.schemaRequest.update.loaded
|
|
205
|
+
) {
|
|
206
|
+
this.props.getSchema(this.props.id);
|
|
207
|
+
toast.info(
|
|
208
|
+
<Toast
|
|
209
|
+
info
|
|
210
|
+
title={this.props.intl.formatMessage(messages.info)}
|
|
211
|
+
content={this.props.intl.formatMessage(messages.changesSaved)}
|
|
212
|
+
/>,
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Blocks behavior disabled
|
|
217
|
+
if (
|
|
218
|
+
this.props.cpanelRequest.update.loading &&
|
|
219
|
+
nextProps.cpanelRequest.update.loaded
|
|
220
|
+
) {
|
|
221
|
+
this.onEnableBlocks();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Submit handler
|
|
227
|
+
* @method onSubmit
|
|
228
|
+
* @param {object} data Form data.
|
|
229
|
+
* @returns {undefined}
|
|
230
|
+
*/
|
|
231
|
+
onSubmit(data) {
|
|
232
|
+
const schema = { properties: {} };
|
|
233
|
+
Object.keys(data)
|
|
234
|
+
.filter((k) => data[k])
|
|
235
|
+
.forEach((k) => (schema.properties[k] = { default: data[k] }));
|
|
236
|
+
this.props.updateSchema(this.props.id, schema);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Cancel handler
|
|
241
|
+
* @method onCancel
|
|
242
|
+
* @returns {undefined}
|
|
243
|
+
*/
|
|
244
|
+
onCancel() {
|
|
245
|
+
const url = getParentUrl(this.props.pathname);
|
|
246
|
+
this.props.history.push(getParentUrl(url));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Enable blocks handler
|
|
251
|
+
* @method onEnableBlocks
|
|
252
|
+
* @returns {undefined}
|
|
253
|
+
*/
|
|
254
|
+
onEnableBlocks() {
|
|
255
|
+
const { properties = {} } = this.props.schema;
|
|
256
|
+
const blocksFieldName = getBlocksFieldname(properties);
|
|
257
|
+
const blocksLayoutFieldname = getBlocksLayoutFieldname(properties);
|
|
258
|
+
const schema = {
|
|
259
|
+
fieldsets: [
|
|
260
|
+
{
|
|
261
|
+
id: 'layout',
|
|
262
|
+
title: 'Layout',
|
|
263
|
+
fields: ['blocks', 'blocks_layout'],
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
properties: {
|
|
267
|
+
blocks: {
|
|
268
|
+
title: 'Blocks',
|
|
269
|
+
type: 'dict',
|
|
270
|
+
widget: 'json',
|
|
271
|
+
factory: 'JSONField',
|
|
272
|
+
default: properties[blocksFieldName]?.default || {},
|
|
273
|
+
},
|
|
274
|
+
blocks_layout: {
|
|
275
|
+
title: 'Blocks Layout',
|
|
276
|
+
type: 'dict',
|
|
277
|
+
widget: 'json',
|
|
278
|
+
factory: 'JSONField',
|
|
279
|
+
default: properties[blocksLayoutFieldname]?.default || { items: [] },
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
this.props.updateSchema(this.props.id, schema);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Disable Blocks behavior handler
|
|
288
|
+
* @method onDisableBlocksBehavior
|
|
289
|
+
* @returns {undefined}
|
|
290
|
+
*/
|
|
291
|
+
onDisableBlocksBehavior() {
|
|
292
|
+
this.props.updateControlpanel(this.props.controlpanel['@id'], {
|
|
293
|
+
[this.state.readOnlyBehavior]: false,
|
|
294
|
+
'volto.blocks.editable.layout': true,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Enable Blocks behavior handler
|
|
300
|
+
* @method onEnableBlocksBehavior
|
|
301
|
+
* @returns {undefined}
|
|
302
|
+
*/
|
|
303
|
+
onEnableBlocksBehavior() {
|
|
304
|
+
this.props.updateControlpanel(this.props.controlpanel['@id'], {
|
|
305
|
+
'volto.blocks.editable.layout': true,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Render method.
|
|
311
|
+
* @method render
|
|
312
|
+
* @returns {string} Markup for the component.
|
|
313
|
+
*/
|
|
314
|
+
render() {
|
|
315
|
+
// Error
|
|
316
|
+
if (this.state.error) {
|
|
317
|
+
return <Error error={this.state.error} />;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (!this.state.visual) {
|
|
321
|
+
// Still loading
|
|
322
|
+
if (!this.state.content) {
|
|
323
|
+
return <div />;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Blocks are not enabled
|
|
327
|
+
return (
|
|
328
|
+
<>
|
|
329
|
+
<Segment
|
|
330
|
+
placeholder
|
|
331
|
+
id="page-controlpanel-layout"
|
|
332
|
+
className="ui container center aligned"
|
|
333
|
+
>
|
|
334
|
+
<div>
|
|
335
|
+
<FormattedMessage
|
|
336
|
+
id="Can not edit Layout for <strong>{type}</strong> content-type as it doesn't have support for <strong>Volto Blocks</strong> enabled"
|
|
337
|
+
defaultMessage="Can not edit Layout for <strong>{type}</strong> content-type as it doesn't have support for <strong>Volto Blocks</strong> enabled"
|
|
338
|
+
values={{
|
|
339
|
+
strong: (...chunks) => <strong>{chunks}</strong>,
|
|
340
|
+
type: this.props?.controlpanel?.title || this.props.id,
|
|
341
|
+
}}
|
|
342
|
+
/>
|
|
343
|
+
</div>
|
|
344
|
+
<div className="ui divider"></div>
|
|
345
|
+
<Button
|
|
346
|
+
primary
|
|
347
|
+
onClick={this.onEnableBlocksBehavior}
|
|
348
|
+
content={this.props.intl.formatMessage(messages.enable)}
|
|
349
|
+
/>
|
|
350
|
+
</Segment>
|
|
351
|
+
<Portal
|
|
352
|
+
node={this.state.isClient && document.getElementById('toolbar')}
|
|
353
|
+
>
|
|
354
|
+
<Toolbar
|
|
355
|
+
pathname={this.props.pathname}
|
|
356
|
+
hideDefaultViewButtons
|
|
357
|
+
inner={
|
|
358
|
+
<>
|
|
359
|
+
<Link className="item" to="#" onClick={() => this.onCancel()}>
|
|
360
|
+
<Icon
|
|
361
|
+
name={backSVG}
|
|
362
|
+
size="30px"
|
|
363
|
+
className="contents circled"
|
|
364
|
+
title={this.props.intl.formatMessage(messages.back)}
|
|
365
|
+
/>
|
|
366
|
+
</Link>
|
|
367
|
+
</>
|
|
368
|
+
}
|
|
369
|
+
/>
|
|
370
|
+
</Portal>
|
|
371
|
+
</>
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (this.state.readOnlyBehavior) {
|
|
376
|
+
return (
|
|
377
|
+
<>
|
|
378
|
+
<Segment
|
|
379
|
+
placeholder
|
|
380
|
+
id="page-controlpanel-layout"
|
|
381
|
+
className="ui container center aligned"
|
|
382
|
+
>
|
|
383
|
+
<div>
|
|
384
|
+
<FormattedMessage
|
|
385
|
+
id="Can not edit Layout for <strong>{type}</strong> content-type as the <strong>Blocks behavior</strong> is enabled and <strong>read-only</strong>"
|
|
386
|
+
defaultMessage="Can not edit Layout for <strong>{type}</strong> content-type as the <strong>Blocks behavior</strong> is enabled and <strong>read-only</strong>"
|
|
387
|
+
values={{
|
|
388
|
+
strong: (...chunks) => <strong>{chunks}</strong>,
|
|
389
|
+
type: this.props?.controlpanel?.title || this.props.id,
|
|
390
|
+
}}
|
|
391
|
+
/>
|
|
392
|
+
</div>
|
|
393
|
+
<div className="ui divider"></div>
|
|
394
|
+
<Button
|
|
395
|
+
primary
|
|
396
|
+
onClick={this.onDisableBlocksBehavior}
|
|
397
|
+
content={this.props.intl.formatMessage(messages.enable)}
|
|
398
|
+
/>
|
|
399
|
+
</Segment>
|
|
400
|
+
<Portal
|
|
401
|
+
node={this.state.isClient && document.getElementById('toolbar')}
|
|
402
|
+
>
|
|
403
|
+
<Toolbar
|
|
404
|
+
pathname={this.props.pathname}
|
|
405
|
+
hideDefaultViewButtons
|
|
406
|
+
inner={
|
|
407
|
+
<>
|
|
408
|
+
<Link className="item" to="#" onClick={() => this.onCancel()}>
|
|
409
|
+
<Icon
|
|
410
|
+
name={backSVG}
|
|
411
|
+
size="30px"
|
|
412
|
+
className="contents circled"
|
|
413
|
+
title={this.props.intl.formatMessage(messages.back)}
|
|
414
|
+
/>
|
|
415
|
+
</Link>
|
|
416
|
+
</>
|
|
417
|
+
}
|
|
418
|
+
/>
|
|
419
|
+
</Portal>
|
|
420
|
+
</>
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Render layout editor
|
|
425
|
+
const blocksFieldName = getBlocksFieldname(
|
|
426
|
+
this.props.schema?.properties || {},
|
|
427
|
+
);
|
|
428
|
+
const blocksLayoutFieldname = getBlocksLayoutFieldname(
|
|
429
|
+
this.props.schema?.properties || {},
|
|
430
|
+
);
|
|
431
|
+
return (
|
|
432
|
+
<div id="page-controlpanel-layout">
|
|
433
|
+
<Form
|
|
434
|
+
isAdminForm
|
|
435
|
+
ref={this.form}
|
|
436
|
+
schema={{
|
|
437
|
+
fieldsets: [
|
|
438
|
+
{
|
|
439
|
+
id: 'layout',
|
|
440
|
+
title: 'Layout',
|
|
441
|
+
fields: [blocksFieldName, blocksLayoutFieldname],
|
|
442
|
+
},
|
|
443
|
+
],
|
|
444
|
+
properties: {
|
|
445
|
+
...this.props.schema.properties[blocksFieldName],
|
|
446
|
+
...this.props.schema.properties[blocksLayoutFieldname],
|
|
447
|
+
},
|
|
448
|
+
required: [],
|
|
449
|
+
}}
|
|
450
|
+
formData={this.state.content}
|
|
451
|
+
onSubmit={this.onSubmit}
|
|
452
|
+
onCancel={this.onCancel}
|
|
453
|
+
pathname={this.props.pathname}
|
|
454
|
+
visual={this.state.visual}
|
|
455
|
+
hideActions
|
|
456
|
+
/>
|
|
457
|
+
<Portal
|
|
458
|
+
node={this.state.isClient && document.getElementById('sidebar')}
|
|
459
|
+
>
|
|
460
|
+
<Sidebar settingsTab={true} documentTab={false} />
|
|
461
|
+
</Portal>
|
|
462
|
+
<Portal
|
|
463
|
+
node={this.state.isClient && document.getElementById('toolbar')}
|
|
464
|
+
>
|
|
465
|
+
<Toolbar
|
|
466
|
+
pathname={this.props.pathname}
|
|
467
|
+
hideDefaultViewButtons
|
|
468
|
+
inner={
|
|
469
|
+
<>
|
|
470
|
+
<Button
|
|
471
|
+
id="toolbar-save"
|
|
472
|
+
className="save"
|
|
473
|
+
aria-label={this.props.intl.formatMessage(messages.save)}
|
|
474
|
+
onClick={() => this.form.current.onSubmit()}
|
|
475
|
+
disabled={this.props.schemaRequest.update.loading}
|
|
476
|
+
loading={this.props.schemaRequest.update.loading}
|
|
477
|
+
>
|
|
478
|
+
<Icon
|
|
479
|
+
name={saveSVG}
|
|
480
|
+
className="circled"
|
|
481
|
+
size="30px"
|
|
482
|
+
title={this.props.intl.formatMessage(messages.save)}
|
|
483
|
+
/>
|
|
484
|
+
</Button>
|
|
485
|
+
<Button
|
|
486
|
+
className="cancel"
|
|
487
|
+
aria-label={this.props.intl.formatMessage(messages.cancel)}
|
|
488
|
+
onClick={() => this.onCancel()}
|
|
489
|
+
>
|
|
490
|
+
<Icon
|
|
491
|
+
name={clearSVG}
|
|
492
|
+
className="circled"
|
|
493
|
+
size="30px"
|
|
494
|
+
title={this.props.intl.formatMessage(messages.cancel)}
|
|
495
|
+
/>
|
|
496
|
+
</Button>
|
|
497
|
+
</>
|
|
498
|
+
}
|
|
499
|
+
/>
|
|
500
|
+
</Portal>
|
|
501
|
+
</div>
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export default compose(
|
|
507
|
+
injectIntl,
|
|
508
|
+
connect(
|
|
509
|
+
(state, props) => ({
|
|
510
|
+
schema: state.schema.schema,
|
|
511
|
+
schemaRequest: state.schema,
|
|
512
|
+
cpanelRequest: state.controlpanels,
|
|
513
|
+
controlpanel: state.controlpanels.controlpanel,
|
|
514
|
+
pathname: props.location.pathname,
|
|
515
|
+
id: nth(props.location.pathname.split('/'), -2),
|
|
516
|
+
parent: nth(props.location.pathname.split('/'), -3),
|
|
517
|
+
}),
|
|
518
|
+
{ getSchema, updateSchema, getControlpanel, updateControlpanel },
|
|
519
|
+
),
|
|
520
|
+
)(ContentTypeLayout);
|