@eeacms/volto-eea-website-policy 1.9.1 → 1.10.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 +20 -0
- package/DEVELOP.md +6 -7
- package/README.md +2 -2
- package/RELEASE.md +14 -14
- package/package.json +3 -3
- package/src/customizations/volto/components/manage/Toolbar/More.jsx +542 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +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
|
+
### [1.10.0](https://github.com/eea/volto-eea-website-policy/compare/1.9.2...1.10.0) - 2 November 2023
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: remove working copy and translations for ims indicators - refs #258076 [dobri1408 - [`52d588d`](https://github.com/eea/volto-eea-website-policy/commit/52d588df35dc644eba1268309d95126700c0b6e5)]
|
|
12
|
+
|
|
13
|
+
#### :house: Internal changes
|
|
14
|
+
|
|
15
|
+
- chore: husky, lint-staged use fixed versions [valentinab25 - [`44ac62e`](https://github.com/eea/volto-eea-website-policy/commit/44ac62e6f8b7e5b7d57edfbf82812c91dc5d6bba)]
|
|
16
|
+
- chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`b9a46d8`](https://github.com/eea/volto-eea-website-policy/commit/b9a46d85a64739188a3df9e8cbe645418b5d8b0a)]
|
|
17
|
+
|
|
18
|
+
#### :hammer_and_wrench: Others
|
|
19
|
+
|
|
20
|
+
- Release 1.10.0 [Alin Voinea - [`de84955`](https://github.com/eea/volto-eea-website-policy/commit/de849552ee81a311563f2d89641832abdc79c8c6)]
|
|
21
|
+
### [1.9.2](https://github.com/eea/volto-eea-website-policy/compare/1.9.1...1.9.2) - 29 September 2023
|
|
22
|
+
|
|
23
|
+
#### :house: Documentation changes
|
|
24
|
+
|
|
25
|
+
- docs: Update README and DEVELOP [Alin Voinea - [`552a79b`](https://github.com/eea/volto-eea-website-policy/commit/552a79ba30db6327bbf102e33650b24df7f71161)]
|
|
26
|
+
|
|
7
27
|
### [1.9.1](https://github.com/eea/volto-eea-website-policy/compare/1.9.0...1.9.1) - 22 September 2023
|
|
8
28
|
|
|
9
29
|
#### :bug: Bug Fixes
|
package/DEVELOP.md
CHANGED
|
@@ -16,12 +16,14 @@
|
|
|
16
16
|
|
|
17
17
|
1. Go to http://localhost:3000
|
|
18
18
|
|
|
19
|
-
1.
|
|
19
|
+
1. Initialize git hooks
|
|
20
20
|
|
|
21
21
|
```Bash
|
|
22
|
-
|
|
22
|
+
yarn prepare
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
1. Happy hacking!
|
|
26
|
+
|
|
25
27
|
### Or add @eeacms/volto-eea-website-policy to your Volto project
|
|
26
28
|
|
|
27
29
|
Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
|
|
@@ -48,18 +50,15 @@ Before starting make sure your development environment is properly set. See [Vol
|
|
|
48
50
|
|
|
49
51
|
1. Install
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
make develop
|
|
52
54
|
yarn
|
|
53
55
|
|
|
54
56
|
1. Start backend
|
|
55
57
|
|
|
56
|
-
docker pull plone
|
|
57
|
-
docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
|
|
58
|
+
docker run --pull always -it --rm --name plone -p 8080:8080 -e SITE=Plone plone/plone-backend
|
|
58
59
|
|
|
59
60
|
...wait for backend to setup and start - `Ready to handle requests`:
|
|
60
61
|
|
|
61
|
-
docker logs -f plone
|
|
62
|
-
|
|
63
62
|
...you can also check http://localhost:8080/Plone
|
|
64
63
|
|
|
65
64
|
1. Start frontend
|
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ Go to http://localhost:3000
|
|
|
50
50
|
],
|
|
51
51
|
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@eeacms/volto-eea-website-policy": "
|
|
53
|
+
"@eeacms/volto-eea-website-policy": "*"
|
|
54
54
|
}
|
|
55
55
|
```
|
|
56
56
|
|
|
@@ -58,7 +58,7 @@ Go to http://localhost:3000
|
|
|
58
58
|
|
|
59
59
|
```
|
|
60
60
|
npm install -g yo @plone/generator-volto
|
|
61
|
-
yo @plone/volto my-volto-project --addon @eeacms/volto-eea-website-policy
|
|
61
|
+
yo @plone/volto my-volto-project --canary --addon @eeacms/volto-eea-website-policy
|
|
62
62
|
cd my-volto-project
|
|
63
63
|
```
|
|
64
64
|
|
package/RELEASE.md
CHANGED
|
@@ -20,9 +20,9 @@ You need to first install the [release-it](https://github.com/release-it/release
|
|
|
20
20
|
```
|
|
21
21
|
npm install -g release-it
|
|
22
22
|
```
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
Release-it is a tool that automates 4 important steps in the release process:
|
|
27
27
|
|
|
28
28
|
1. Version increase in `package.json` ( increased from the current version in `package.json`)
|
|
@@ -30,45 +30,45 @@ Release-it is a tool that automates 4 important steps in the release process:
|
|
|
30
30
|
3. GitHub release on the commit with the changelog and package.json modification on the develop branch
|
|
31
31
|
4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
|
|
32
32
|
|
|
33
|
-
To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
|
|
33
|
+
To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
|
|
34
34
|
|
|
35
35
|
```
|
|
36
36
|
export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
|
|
37
37
|
```
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
```
|
|
42
42
|
echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
#### Using release-it tool
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
There are 3 yarn scripts that can be run to do the release
|
|
48
48
|
|
|
49
49
|
##### yarn release-beta
|
|
50
50
|
|
|
51
|
-
Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
|
|
51
|
+
Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
|
|
52
52
|
|
|
53
53
|
```
|
|
54
|
-
? Select increment (next version):
|
|
55
|
-
❯ prepatch (0.1.1-beta.0)
|
|
56
|
-
preminor (0.2.0-beta.0)
|
|
57
|
-
premajor (1.0.0-beta.0)
|
|
58
|
-
Other, please specify...
|
|
54
|
+
? Select increment (next version):
|
|
55
|
+
❯ prepatch (0.1.1-beta.0)
|
|
56
|
+
preminor (0.2.0-beta.0)
|
|
57
|
+
premajor (1.0.0-beta.0)
|
|
58
|
+
Other, please specify...
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
##### yarn release-major-beta
|
|
62
62
|
|
|
63
63
|
Same as `yarn release-beta`, but with premajor version pre-selected.
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
##### yarn release
|
|
66
66
|
|
|
67
67
|
Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
|
|
68
68
|
|
|
69
69
|
#### Important notes
|
|
70
70
|
|
|
71
|
-
> Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST.
|
|
71
|
+
> Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST.
|
|
72
72
|
|
|
73
73
|
> Do not keep Pull Requests from develop to master branches open when you are doing beta releases from the develop branch. As long as a PR to master is open, an automatic script will run on every commit and will update both the version and the changelog to a production-ready state - ( MAJOR.MINOR.PATCH mandatory format for version).
|
|
74
74
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-eea-website-policy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "@eeacms/volto-eea-website-policy: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@cypress/code-coverage": "^3.10.0",
|
|
27
27
|
"@plone/scripts": "*",
|
|
28
28
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
29
|
-
"husky": "
|
|
30
|
-
"lint-staged": "
|
|
29
|
+
"husky": "^8.0.3",
|
|
30
|
+
"lint-staged": "^14.0.1",
|
|
31
31
|
"md5": "^2.3.0"
|
|
32
32
|
},
|
|
33
33
|
"lint-staged": {
|
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* More component.
|
|
3
|
+
* @module components/manage/Toolbar/More
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { Component } from 'react';
|
|
7
|
+
import { defineMessages, injectIntl } from 'react-intl';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { connect } from 'react-redux';
|
|
10
|
+
import { compose } from 'redux';
|
|
11
|
+
import { Link, withRouter } from 'react-router-dom';
|
|
12
|
+
import { find } from 'lodash';
|
|
13
|
+
import { toast } from 'react-toastify';
|
|
14
|
+
import { Toast } from '@plone/volto/components';
|
|
15
|
+
import { Pluggable, Plug } from '@plone/volto/components/manage/Pluggable';
|
|
16
|
+
import {
|
|
17
|
+
FormattedDate,
|
|
18
|
+
Icon,
|
|
19
|
+
Display,
|
|
20
|
+
Workflow,
|
|
21
|
+
} from '@plone/volto/components';
|
|
22
|
+
import {
|
|
23
|
+
applyWorkingCopy,
|
|
24
|
+
createWorkingCopy,
|
|
25
|
+
removeWorkingCopy,
|
|
26
|
+
} from '@plone/volto/actions';
|
|
27
|
+
import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers';
|
|
28
|
+
import config from '@plone/volto/registry';
|
|
29
|
+
|
|
30
|
+
import rightArrowSVG from '@plone/volto/icons/right-key.svg';
|
|
31
|
+
import userSVG from '@plone/volto/icons/user.svg';
|
|
32
|
+
import applySVG from '@plone/volto/icons/ready.svg';
|
|
33
|
+
import removeSVG from '@plone/volto/icons/circle-dismiss.svg';
|
|
34
|
+
|
|
35
|
+
const messages = defineMessages({
|
|
36
|
+
personalTools: {
|
|
37
|
+
id: 'Personal tools',
|
|
38
|
+
defaultMessage: 'Personal tools',
|
|
39
|
+
},
|
|
40
|
+
history: {
|
|
41
|
+
id: 'History',
|
|
42
|
+
defaultMessage: 'History',
|
|
43
|
+
},
|
|
44
|
+
sharing: {
|
|
45
|
+
id: 'Sharing',
|
|
46
|
+
defaultMessage: 'Sharing',
|
|
47
|
+
},
|
|
48
|
+
rules: {
|
|
49
|
+
id: 'Rules',
|
|
50
|
+
defaultMessage: 'Rules',
|
|
51
|
+
},
|
|
52
|
+
aliases: {
|
|
53
|
+
id: 'URL Management',
|
|
54
|
+
defaultMessage: 'URL Management',
|
|
55
|
+
},
|
|
56
|
+
ManageTranslations: {
|
|
57
|
+
id: 'Manage Translations',
|
|
58
|
+
defaultMessage: 'Manage Translations',
|
|
59
|
+
},
|
|
60
|
+
manageContent: {
|
|
61
|
+
id: 'Manage content…',
|
|
62
|
+
defaultMessage: 'Manage content…',
|
|
63
|
+
},
|
|
64
|
+
CreateWorkingCopy: {
|
|
65
|
+
id: 'Create working copy',
|
|
66
|
+
defaultMessage: 'Create working copy',
|
|
67
|
+
},
|
|
68
|
+
applyWorkingCopy: {
|
|
69
|
+
id: 'Apply working copy',
|
|
70
|
+
defaultMessage: 'Apply working copy',
|
|
71
|
+
},
|
|
72
|
+
removeWorkingCopy: {
|
|
73
|
+
id: 'Remove working copy',
|
|
74
|
+
defaultMessage: 'Remove working copy',
|
|
75
|
+
},
|
|
76
|
+
viewWorkingCopy: {
|
|
77
|
+
id: 'View working copy',
|
|
78
|
+
defaultMessage: 'View working copy',
|
|
79
|
+
},
|
|
80
|
+
workingAppliedTitle: {
|
|
81
|
+
id: 'Changes applied.',
|
|
82
|
+
defaultMessage: 'Changes applied',
|
|
83
|
+
},
|
|
84
|
+
workingCopyAppliedBy: {
|
|
85
|
+
id:
|
|
86
|
+
'Made by {creator} on {date}. This is not a working copy anymore, but the main content.',
|
|
87
|
+
defaultMessage:
|
|
88
|
+
'Made by {creator} on {date}. This is not a working copy anymore, but the main content.',
|
|
89
|
+
},
|
|
90
|
+
workingCopyRemovedTitle: {
|
|
91
|
+
id: 'The working copy was discarded',
|
|
92
|
+
defaultMessage: 'The working copy was discarded',
|
|
93
|
+
},
|
|
94
|
+
Unauthorized: {
|
|
95
|
+
id: 'Unauthorized',
|
|
96
|
+
defaultMessage: 'Unauthorized',
|
|
97
|
+
},
|
|
98
|
+
workingCopyErrorUnauthorized: {
|
|
99
|
+
id: 'workingCopyErrorUnauthorized',
|
|
100
|
+
defaultMessage: 'You are not authorized to perform this operation.',
|
|
101
|
+
},
|
|
102
|
+
Error: {
|
|
103
|
+
id: 'Error',
|
|
104
|
+
defaultMessage: 'Error',
|
|
105
|
+
},
|
|
106
|
+
workingCopyGenericError: {
|
|
107
|
+
id: 'workingCopyGenericError',
|
|
108
|
+
defaultMessage: 'An error occurred while performing this operation.',
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* More container class.
|
|
114
|
+
* @class More
|
|
115
|
+
* @extends Component
|
|
116
|
+
*/
|
|
117
|
+
class More extends Component {
|
|
118
|
+
static propTypes = {
|
|
119
|
+
actions: PropTypes.shape({
|
|
120
|
+
object: PropTypes.arrayOf(PropTypes.object),
|
|
121
|
+
object_buttons: PropTypes.arrayOf(PropTypes.object),
|
|
122
|
+
user: PropTypes.arrayOf(PropTypes.object),
|
|
123
|
+
}),
|
|
124
|
+
pathname: PropTypes.string.isRequired,
|
|
125
|
+
content: PropTypes.shape({
|
|
126
|
+
title: PropTypes.string,
|
|
127
|
+
'@type': PropTypes.string,
|
|
128
|
+
is_folderish: PropTypes.bool,
|
|
129
|
+
review_state: PropTypes.string,
|
|
130
|
+
}),
|
|
131
|
+
loadComponent: PropTypes.func.isRequired,
|
|
132
|
+
closeMenu: PropTypes.func.isRequired,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Default properties.
|
|
137
|
+
* @property {Object} defaultProps Default properties.
|
|
138
|
+
* @static
|
|
139
|
+
*/
|
|
140
|
+
static defaultProps = {
|
|
141
|
+
actions: null,
|
|
142
|
+
content: null,
|
|
143
|
+
};
|
|
144
|
+
state = {
|
|
145
|
+
openManageTranslations: false,
|
|
146
|
+
pushed: false,
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
push = (selector) => {
|
|
150
|
+
this.setState(() => ({
|
|
151
|
+
pushed: true,
|
|
152
|
+
}));
|
|
153
|
+
this.props.loadComponent(selector);
|
|
154
|
+
document.removeEventListener('mousedown', this.handleClickOutside, false);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
componentDidUpdate(prevProps, prevState) {
|
|
158
|
+
let erroredAction = '';
|
|
159
|
+
if (
|
|
160
|
+
prevProps.workingCopy.apply.loading &&
|
|
161
|
+
this.props.workingCopy.apply.error
|
|
162
|
+
) {
|
|
163
|
+
erroredAction = 'apply';
|
|
164
|
+
} else if (
|
|
165
|
+
prevProps.workingCopy.create.loading &&
|
|
166
|
+
this.props.workingCopy.create.error
|
|
167
|
+
) {
|
|
168
|
+
erroredAction = 'create';
|
|
169
|
+
} else if (
|
|
170
|
+
prevProps.workingCopy.remove.loading &&
|
|
171
|
+
this.props.workingCopy.remove.error
|
|
172
|
+
) {
|
|
173
|
+
erroredAction = 'remove';
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (erroredAction) {
|
|
177
|
+
const errorStatus = this.props.workingCopy[erroredAction].error.status;
|
|
178
|
+
if (errorStatus === 401 || errorStatus === 403) {
|
|
179
|
+
toast.error(
|
|
180
|
+
<Toast
|
|
181
|
+
error
|
|
182
|
+
title={this.props.intl.formatMessage(messages.Unauthorized)}
|
|
183
|
+
content={this.props.intl.formatMessage(
|
|
184
|
+
messages.workingCopyErrorUnauthorized,
|
|
185
|
+
)}
|
|
186
|
+
/>,
|
|
187
|
+
{
|
|
188
|
+
toastId: 'workingCopyErrorUnauthorized',
|
|
189
|
+
autoClose: 10000,
|
|
190
|
+
},
|
|
191
|
+
);
|
|
192
|
+
} else {
|
|
193
|
+
toast.error(
|
|
194
|
+
<Toast
|
|
195
|
+
error
|
|
196
|
+
title={this.props.intl.formatMessage(messages.Error)}
|
|
197
|
+
content={this.props.intl.formatMessage(
|
|
198
|
+
messages.workingCopyGenericError,
|
|
199
|
+
)}
|
|
200
|
+
/>,
|
|
201
|
+
{
|
|
202
|
+
toastId: 'workingCopyGenericError',
|
|
203
|
+
autoClose: 10000,
|
|
204
|
+
},
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Render method.
|
|
212
|
+
* @method render
|
|
213
|
+
* @returns {string} Markup for the component.
|
|
214
|
+
*/
|
|
215
|
+
render() {
|
|
216
|
+
const path = getBaseUrl(this.props.pathname);
|
|
217
|
+
const editAction = find(this.props.actions.object, { id: 'edit' });
|
|
218
|
+
const historyAction = find(this.props.actions.object, { id: 'history' });
|
|
219
|
+
const sharingAction = find(this.props.actions.object, {
|
|
220
|
+
id: 'local_roles',
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
const rulesAction = find(this.props.actions.object, {
|
|
224
|
+
id: 'contentrules',
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
const aliasesAction = find(this.props.actions.object_buttons, {
|
|
228
|
+
id: 'redirection',
|
|
229
|
+
});
|
|
230
|
+
const { content, intl } = this.props;
|
|
231
|
+
|
|
232
|
+
const dateOptions = {
|
|
233
|
+
year: 'numeric',
|
|
234
|
+
month: 'long',
|
|
235
|
+
day: 'numeric',
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
return (
|
|
239
|
+
<div
|
|
240
|
+
className="menu-more pastanaga-menu"
|
|
241
|
+
style={{
|
|
242
|
+
flex: this.props.theToolbar.current
|
|
243
|
+
? `0 0 ${
|
|
244
|
+
this.props.theToolbar.current.getBoundingClientRect().width
|
|
245
|
+
}px`
|
|
246
|
+
: null,
|
|
247
|
+
}}
|
|
248
|
+
>
|
|
249
|
+
<header>
|
|
250
|
+
<h2>{this.props.content.title}</h2>
|
|
251
|
+
<button
|
|
252
|
+
className="more-user"
|
|
253
|
+
aria-label={this.props.intl.formatMessage(messages.personalTools)}
|
|
254
|
+
onClick={() => this.push('personalTools')}
|
|
255
|
+
tabIndex={0}
|
|
256
|
+
>
|
|
257
|
+
<Icon
|
|
258
|
+
name={userSVG}
|
|
259
|
+
size="30px"
|
|
260
|
+
title={this.props.intl.formatMessage(messages.personalTools)}
|
|
261
|
+
/>
|
|
262
|
+
</button>
|
|
263
|
+
</header>
|
|
264
|
+
<div className="pastanaga-menu-list">
|
|
265
|
+
<ul>
|
|
266
|
+
<Pluggable name="toolbar-more-menu-list" />
|
|
267
|
+
<Plug pluggable="toolbar-more-menu-list" id="state">
|
|
268
|
+
{this.props.content['@type'] !== 'Plone Site' && (
|
|
269
|
+
// Plone Site does not have workflow
|
|
270
|
+
<li className="state-select">
|
|
271
|
+
<Workflow pathname={path} />
|
|
272
|
+
</li>
|
|
273
|
+
)}
|
|
274
|
+
</Plug>
|
|
275
|
+
<Plug pluggable="toolbar-more-menu-list" id="view">
|
|
276
|
+
{this.props.content['@type'] !== 'Plone Site' && (
|
|
277
|
+
// Plone Site does not have view (yet)
|
|
278
|
+
<li className="display-select">
|
|
279
|
+
{editAction && <Display pathname={path} />}
|
|
280
|
+
</li>
|
|
281
|
+
)}
|
|
282
|
+
</Plug>
|
|
283
|
+
<Plug pluggable="toolbar-more-menu-list" id="history">
|
|
284
|
+
{this.props.content['@type'] !== 'Plone Site' && (
|
|
285
|
+
// Plone Site does not have history (yet)
|
|
286
|
+
<li>
|
|
287
|
+
<Link to={`${path}/historyview`}>
|
|
288
|
+
<div>
|
|
289
|
+
<span className="pastanaga-menu-label">
|
|
290
|
+
{historyAction?.title ||
|
|
291
|
+
this.props.intl.formatMessage(messages.history)}
|
|
292
|
+
</span>
|
|
293
|
+
<span className="pastanaga-menu-value" />
|
|
294
|
+
</div>
|
|
295
|
+
<Icon name={rightArrowSVG} size="24px" />
|
|
296
|
+
</Link>
|
|
297
|
+
</li>
|
|
298
|
+
)}
|
|
299
|
+
</Plug>
|
|
300
|
+
<Plug pluggable="toolbar-more-menu-list" id="sharing">
|
|
301
|
+
{sharingAction && (
|
|
302
|
+
<li>
|
|
303
|
+
<Link to={`${path}/sharing`}>
|
|
304
|
+
{this.props.intl.formatMessage(messages.sharing)}
|
|
305
|
+
<Icon name={rightArrowSVG} size="24px" />
|
|
306
|
+
</Link>
|
|
307
|
+
</li>
|
|
308
|
+
)}
|
|
309
|
+
</Plug>
|
|
310
|
+
<Plug pluggable="toolbar-more-menu-list" id="aliases">
|
|
311
|
+
{aliasesAction && (
|
|
312
|
+
<li>
|
|
313
|
+
<Link to={`${path}/aliases`}>
|
|
314
|
+
{this.props.intl.formatMessage(messages.aliases)}
|
|
315
|
+
<Icon name={rightArrowSVG} size="24px" />
|
|
316
|
+
</Link>
|
|
317
|
+
</li>
|
|
318
|
+
)}
|
|
319
|
+
</Plug>
|
|
320
|
+
<Plug pluggable="toolbar-more-menu-list" id="rules">
|
|
321
|
+
{rulesAction && (
|
|
322
|
+
<li>
|
|
323
|
+
<Link to={`${path}/rules`}>
|
|
324
|
+
{this.props.intl.formatMessage(messages.rules)}
|
|
325
|
+
<Icon name={rightArrowSVG} size="24px" />
|
|
326
|
+
</Link>
|
|
327
|
+
</li>
|
|
328
|
+
)}
|
|
329
|
+
</Plug>
|
|
330
|
+
</ul>
|
|
331
|
+
</div>
|
|
332
|
+
<Pluggable name="toolbar-more-manage-content">
|
|
333
|
+
{(pluggables) => (
|
|
334
|
+
<>
|
|
335
|
+
{pluggables.length > 0 && (
|
|
336
|
+
<>
|
|
337
|
+
<header>
|
|
338
|
+
<h2>
|
|
339
|
+
{this.props.intl.formatMessage(messages.manageContent)}
|
|
340
|
+
</h2>
|
|
341
|
+
</header>
|
|
342
|
+
<div className="pastanaga-menu-list">
|
|
343
|
+
<ul>
|
|
344
|
+
{pluggables.map((p) => (
|
|
345
|
+
<>{p()}</>
|
|
346
|
+
))}
|
|
347
|
+
</ul>
|
|
348
|
+
</div>
|
|
349
|
+
</>
|
|
350
|
+
)}
|
|
351
|
+
</>
|
|
352
|
+
)}
|
|
353
|
+
</Pluggable>
|
|
354
|
+
{config.settings.hasWorkingCopySupport &&
|
|
355
|
+
this.props.content['@type'] !== 'Plone Site' &&
|
|
356
|
+
this.props.content['@type'] !== 'ims_indicator' && (
|
|
357
|
+
<>
|
|
358
|
+
{!this.props.content.working_copy && (
|
|
359
|
+
<Plug pluggable="toolbar-more-manage-content" id="workingcopy">
|
|
360
|
+
<li>
|
|
361
|
+
<button
|
|
362
|
+
aria-label={this.props.intl.formatMessage(
|
|
363
|
+
messages.CreateWorkingCopy,
|
|
364
|
+
)}
|
|
365
|
+
onClick={() => {
|
|
366
|
+
this.props.createWorkingCopy(path).then((response) => {
|
|
367
|
+
this.props.history.push(
|
|
368
|
+
flattenToAppURL(response['@id']),
|
|
369
|
+
);
|
|
370
|
+
this.props.closeMenu();
|
|
371
|
+
});
|
|
372
|
+
}}
|
|
373
|
+
>
|
|
374
|
+
{this.props.intl.formatMessage(
|
|
375
|
+
messages.CreateWorkingCopy,
|
|
376
|
+
)}
|
|
377
|
+
|
|
378
|
+
<Icon name={rightArrowSVG} size="24px" />
|
|
379
|
+
</button>
|
|
380
|
+
</li>
|
|
381
|
+
</Plug>
|
|
382
|
+
)}
|
|
383
|
+
{this.props.content.working_copy &&
|
|
384
|
+
this.props.content.working_copy_of && (
|
|
385
|
+
<Plug
|
|
386
|
+
pluggable="toolbar-more-manage-content"
|
|
387
|
+
id="workingcopy"
|
|
388
|
+
>
|
|
389
|
+
<li>
|
|
390
|
+
<button
|
|
391
|
+
aria-label={this.props.intl.formatMessage(
|
|
392
|
+
messages.applyWorkingCopy,
|
|
393
|
+
)}
|
|
394
|
+
onClick={() => {
|
|
395
|
+
this.props.applyWorkingCopy(path).then((response) => {
|
|
396
|
+
this.props.history.push(
|
|
397
|
+
flattenToAppURL(
|
|
398
|
+
this.props.content.working_copy_of['@id'],
|
|
399
|
+
),
|
|
400
|
+
);
|
|
401
|
+
this.props.closeMenu();
|
|
402
|
+
toast.info(
|
|
403
|
+
<Toast
|
|
404
|
+
info
|
|
405
|
+
title={intl.formatMessage(
|
|
406
|
+
messages.workingAppliedTitle,
|
|
407
|
+
)}
|
|
408
|
+
content={intl.formatMessage(
|
|
409
|
+
messages.workingCopyAppliedBy,
|
|
410
|
+
{
|
|
411
|
+
creator: content.working_copy?.creator_name,
|
|
412
|
+
date: (
|
|
413
|
+
<FormattedDate
|
|
414
|
+
date={content.working_copy?.created}
|
|
415
|
+
format={dateOptions}
|
|
416
|
+
/>
|
|
417
|
+
),
|
|
418
|
+
},
|
|
419
|
+
)}
|
|
420
|
+
/>,
|
|
421
|
+
{
|
|
422
|
+
toastId: 'workingcopyapplyinfo',
|
|
423
|
+
autoClose: 10000,
|
|
424
|
+
},
|
|
425
|
+
);
|
|
426
|
+
});
|
|
427
|
+
}}
|
|
428
|
+
>
|
|
429
|
+
{this.props.intl.formatMessage(
|
|
430
|
+
messages.applyWorkingCopy,
|
|
431
|
+
)}
|
|
432
|
+
|
|
433
|
+
<Icon
|
|
434
|
+
name={applySVG}
|
|
435
|
+
size="24px"
|
|
436
|
+
title={this.props.intl.formatMessage(
|
|
437
|
+
messages.applyWorkingCopy,
|
|
438
|
+
)}
|
|
439
|
+
/>
|
|
440
|
+
</button>
|
|
441
|
+
</li>
|
|
442
|
+
<li>
|
|
443
|
+
<button
|
|
444
|
+
aria-label={this.props.intl.formatMessage(
|
|
445
|
+
messages.removeWorkingCopy,
|
|
446
|
+
)}
|
|
447
|
+
onClick={() => {
|
|
448
|
+
this.props
|
|
449
|
+
.removeWorkingCopy(path)
|
|
450
|
+
.then((response) => {
|
|
451
|
+
this.props.history.push(
|
|
452
|
+
flattenToAppURL(
|
|
453
|
+
this.props.content.working_copy_of['@id'],
|
|
454
|
+
),
|
|
455
|
+
);
|
|
456
|
+
this.props.closeMenu();
|
|
457
|
+
toast.info(
|
|
458
|
+
<Toast
|
|
459
|
+
info
|
|
460
|
+
title={intl.formatMessage(
|
|
461
|
+
messages.workingCopyRemovedTitle,
|
|
462
|
+
)}
|
|
463
|
+
/>,
|
|
464
|
+
{
|
|
465
|
+
toastId: 'workingcopyremovednotice',
|
|
466
|
+
autoClose: 10000,
|
|
467
|
+
},
|
|
468
|
+
);
|
|
469
|
+
});
|
|
470
|
+
}}
|
|
471
|
+
>
|
|
472
|
+
{this.props.intl.formatMessage(
|
|
473
|
+
messages.removeWorkingCopy,
|
|
474
|
+
)}
|
|
475
|
+
|
|
476
|
+
<Icon
|
|
477
|
+
name={removeSVG}
|
|
478
|
+
size="24px"
|
|
479
|
+
color="#e40166"
|
|
480
|
+
title={this.props.intl.formatMessage(
|
|
481
|
+
messages.removeWorkingCopy,
|
|
482
|
+
)}
|
|
483
|
+
/>
|
|
484
|
+
</button>
|
|
485
|
+
</li>
|
|
486
|
+
</Plug>
|
|
487
|
+
)}
|
|
488
|
+
{this.props.content.working_copy &&
|
|
489
|
+
!this.props.content.working_copy_of && (
|
|
490
|
+
<Plug
|
|
491
|
+
pluggable="toolbar-more-manage-content"
|
|
492
|
+
id="workingcopy"
|
|
493
|
+
>
|
|
494
|
+
<li>
|
|
495
|
+
<Link
|
|
496
|
+
to={flattenToAppURL(
|
|
497
|
+
this.props.content.working_copy['@id'],
|
|
498
|
+
)}
|
|
499
|
+
onClick={() => this.props.closeMenu()}
|
|
500
|
+
>
|
|
501
|
+
{this.props.intl.formatMessage(
|
|
502
|
+
messages.viewWorkingCopy,
|
|
503
|
+
)}
|
|
504
|
+
<Icon name={rightArrowSVG} size="24px" />
|
|
505
|
+
</Link>
|
|
506
|
+
</li>
|
|
507
|
+
</Plug>
|
|
508
|
+
)}
|
|
509
|
+
</>
|
|
510
|
+
)}
|
|
511
|
+
{editAction &&
|
|
512
|
+
config.settings.isMultilingual &&
|
|
513
|
+
this.props.content['@type'] !== 'ims_indicator' && (
|
|
514
|
+
<Plug pluggable="toolbar-more-manage-content" id="multilingual">
|
|
515
|
+
<li>
|
|
516
|
+
<Link to={`${path}/manage-translations`}>
|
|
517
|
+
{this.props.intl.formatMessage(messages.ManageTranslations)}
|
|
518
|
+
|
|
519
|
+
<Icon name={rightArrowSVG} size="24px" />
|
|
520
|
+
</Link>
|
|
521
|
+
</li>
|
|
522
|
+
</Plug>
|
|
523
|
+
)}
|
|
524
|
+
</div>
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export default compose(
|
|
530
|
+
injectIntl,
|
|
531
|
+
withRouter,
|
|
532
|
+
connect(
|
|
533
|
+
(state, props) => ({
|
|
534
|
+
actions: state.actions.actions,
|
|
535
|
+
pathname: props.pathname,
|
|
536
|
+
content: state.content.data,
|
|
537
|
+
lang: state.intl.locale,
|
|
538
|
+
workingCopy: state.workingCopy,
|
|
539
|
+
}),
|
|
540
|
+
{ applyWorkingCopy, createWorkingCopy, removeWorkingCopy },
|
|
541
|
+
),
|
|
542
|
+
)(More);
|