@eeacms/volto-eea-website-policy 1.14.1-beta.1 → 2.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-policy",
3
- "version": "1.14.1-beta.1",
3
+ "version": "2.0.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",
@@ -17,15 +17,10 @@
17
17
  "url": "git@github.com:eea/volto-eea-website-policy.git"
18
18
  },
19
19
  "addons": [
20
- "@eeacms/volto-widget-dataprovenance",
21
- "@plone-collective/volto-authomatic"
20
+ "@eeacms/volto-widget-dataprovenance"
22
21
  ],
23
22
  "dependencies": {
24
- "@eeacms/volto-widget-dataprovenance": "*",
25
- "@plone-collective/volto-authomatic": "2.0.1"
26
- },
27
- "resolutions": {
28
- "@plone-collective/volto-authomatic": "2.0.1"
23
+ "@eeacms/volto-widget-dataprovenance": "*"
29
24
  },
30
25
  "devDependencies": {
31
26
  "@cypress/code-coverage": "^3.10.0",
package/src/index.js CHANGED
@@ -2,9 +2,6 @@ import { runtimeConfig } from '@plone/volto/runtime_config';
2
2
  import installContextNavigationBlock from '@eeacms/volto-eea-website-policy/components/Blocks/ContextNavigation';
3
3
  import { appendGroup } from './helpers';
4
4
  import { FrequencyOfDissemination } from '@eeacms/volto-eea-website-policy/components/Widgets/FrequencyOfDissemination';
5
- import Login from '@plone-collective/volto-authomatic/components/Login/Login.jsx';
6
- import Logout from '@plone-collective/volto-authomatic/components/Logout/Logout.jsx';
7
- import { Login as VoltoLogin } from '@plone/volto/components';
8
5
 
9
6
  const restrictedBlocks = [
10
7
  'imagecards',
@@ -55,25 +52,6 @@ const applyConfig = (config) => {
55
52
  },
56
53
  ];
57
54
 
58
- //Make azure login to be at route azure_login, and ldap login to be at /login
59
-
60
- config.addonRoutes = config.addonRoutes.filter(
61
- (route) =>
62
- !route.path.includes('/login') && !route.path.includes('/logout'),
63
- );
64
-
65
- config.addonRoutes.push(
66
- {
67
- path: '/**/azure_login',
68
- component: Login,
69
- },
70
- { path: '/**/azure_login', component: Login },
71
- { path: '/login', component: VoltoLogin },
72
- { path: '/**/login', component: VoltoLogin },
73
- { path: '/logout', component: Logout },
74
- { path: '/**/logout', component: Logout },
75
- );
76
-
77
55
  // #160689 Redirect contact-form to contact-us
78
56
  config.settings.contactForm = '/en/about/contact-us';
79
57
 
@@ -115,6 +93,12 @@ const applyConfig = (config) => {
115
93
  if (config.settings.eea) {
116
94
  config.settings.eea.logoTargetUrl = '/en';
117
95
  }
96
+ // #268249 - only allow managers to change layout from more menu
97
+ config.settings.eea = {
98
+ ...config.settings.eea,
99
+ rolesWhoCanChangeLayout: ['Manager'],
100
+ };
101
+ // config.settings.eea.rolesWhoCanChangeLayout = ['Manager'];
118
102
 
119
103
  // Custom blocks
120
104
  // context navigation
@@ -1,541 +0,0 @@
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: 'Made by {creator} on {date}. This is not a working copy anymore, but the main content.',
86
- defaultMessage:
87
- 'Made by {creator} on {date}. This is not a working copy anymore, but the main content.',
88
- },
89
- workingCopyRemovedTitle: {
90
- id: 'The working copy was discarded',
91
- defaultMessage: 'The working copy was discarded',
92
- },
93
- Unauthorized: {
94
- id: 'Unauthorized',
95
- defaultMessage: 'Unauthorized',
96
- },
97
- workingCopyErrorUnauthorized: {
98
- id: 'workingCopyErrorUnauthorized',
99
- defaultMessage: 'You are not authorized to perform this operation.',
100
- },
101
- Error: {
102
- id: 'Error',
103
- defaultMessage: 'Error',
104
- },
105
- workingCopyGenericError: {
106
- id: 'workingCopyGenericError',
107
- defaultMessage: 'An error occurred while performing this operation.',
108
- },
109
- });
110
-
111
- /**
112
- * More container class.
113
- * @class More
114
- * @extends Component
115
- */
116
- class More extends Component {
117
- static propTypes = {
118
- actions: PropTypes.shape({
119
- object: PropTypes.arrayOf(PropTypes.object),
120
- object_buttons: PropTypes.arrayOf(PropTypes.object),
121
- user: PropTypes.arrayOf(PropTypes.object),
122
- }),
123
- pathname: PropTypes.string.isRequired,
124
- content: PropTypes.shape({
125
- title: PropTypes.string,
126
- '@type': PropTypes.string,
127
- is_folderish: PropTypes.bool,
128
- review_state: PropTypes.string,
129
- }),
130
- loadComponent: PropTypes.func.isRequired,
131
- closeMenu: PropTypes.func.isRequired,
132
- };
133
-
134
- /**
135
- * Default properties.
136
- * @property {Object} defaultProps Default properties.
137
- * @static
138
- */
139
- static defaultProps = {
140
- actions: null,
141
- content: null,
142
- };
143
- state = {
144
- openManageTranslations: false,
145
- pushed: false,
146
- };
147
-
148
- push = (selector) => {
149
- this.setState(() => ({
150
- pushed: true,
151
- }));
152
- this.props.loadComponent(selector);
153
- document.removeEventListener('mousedown', this.handleClickOutside, false);
154
- };
155
-
156
- componentDidUpdate(prevProps, prevState) {
157
- let erroredAction = '';
158
- if (
159
- prevProps.workingCopy.apply.loading &&
160
- this.props.workingCopy.apply.error
161
- ) {
162
- erroredAction = 'apply';
163
- } else if (
164
- prevProps.workingCopy.create.loading &&
165
- this.props.workingCopy.create.error
166
- ) {
167
- erroredAction = 'create';
168
- } else if (
169
- prevProps.workingCopy.remove.loading &&
170
- this.props.workingCopy.remove.error
171
- ) {
172
- erroredAction = 'remove';
173
- }
174
-
175
- if (erroredAction) {
176
- const errorStatus = this.props.workingCopy[erroredAction].error.status;
177
- if (errorStatus === 401 || errorStatus === 403) {
178
- toast.error(
179
- <Toast
180
- error
181
- title={this.props.intl.formatMessage(messages.Unauthorized)}
182
- content={this.props.intl.formatMessage(
183
- messages.workingCopyErrorUnauthorized,
184
- )}
185
- />,
186
- {
187
- toastId: 'workingCopyErrorUnauthorized',
188
- autoClose: 10000,
189
- },
190
- );
191
- } else {
192
- toast.error(
193
- <Toast
194
- error
195
- title={this.props.intl.formatMessage(messages.Error)}
196
- content={this.props.intl.formatMessage(
197
- messages.workingCopyGenericError,
198
- )}
199
- />,
200
- {
201
- toastId: 'workingCopyGenericError',
202
- autoClose: 10000,
203
- },
204
- );
205
- }
206
- }
207
- }
208
-
209
- /**
210
- * Render method.
211
- * @method render
212
- * @returns {string} Markup for the component.
213
- */
214
- render() {
215
- const path = getBaseUrl(this.props.pathname);
216
- const editAction = find(this.props.actions.object, { id: 'edit' });
217
- const historyAction = find(this.props.actions.object, { id: 'history' });
218
- const sharingAction = find(this.props.actions.object, {
219
- id: 'local_roles',
220
- });
221
-
222
- const rulesAction = find(this.props.actions.object, {
223
- id: 'contentrules',
224
- });
225
-
226
- const aliasesAction = find(this.props.actions.object_buttons, {
227
- id: 'redirection',
228
- });
229
- const { content, intl } = this.props;
230
-
231
- const dateOptions = {
232
- year: 'numeric',
233
- month: 'long',
234
- day: 'numeric',
235
- };
236
-
237
- return (
238
- <div
239
- className="menu-more pastanaga-menu"
240
- style={{
241
- flex: this.props.theToolbar.current
242
- ? `0 0 ${
243
- this.props.theToolbar.current.getBoundingClientRect().width
244
- }px`
245
- : null,
246
- }}
247
- >
248
- <header>
249
- <h2>{this.props.content.title}</h2>
250
- <button
251
- className="more-user"
252
- aria-label={this.props.intl.formatMessage(messages.personalTools)}
253
- onClick={() => this.push('personalTools')}
254
- tabIndex={0}
255
- >
256
- <Icon
257
- name={userSVG}
258
- size="30px"
259
- title={this.props.intl.formatMessage(messages.personalTools)}
260
- />
261
- </button>
262
- </header>
263
- <div className="pastanaga-menu-list">
264
- <ul>
265
- <Pluggable name="toolbar-more-menu-list" />
266
- <Plug pluggable="toolbar-more-menu-list" id="state">
267
- {this.props.content['@type'] !== 'Plone Site' && (
268
- // Plone Site does not have workflow
269
- <li className="state-select">
270
- <Workflow pathname={path} />
271
- </li>
272
- )}
273
- </Plug>
274
- <Plug pluggable="toolbar-more-menu-list" id="view">
275
- {this.props.content['@type'] !== 'Plone Site' && (
276
- // Plone Site does not have view (yet)
277
- <li className="display-select">
278
- {editAction && <Display pathname={path} />}
279
- </li>
280
- )}
281
- </Plug>
282
- <Plug pluggable="toolbar-more-menu-list" id="history">
283
- {this.props.content['@type'] !== 'Plone Site' && (
284
- // Plone Site does not have history (yet)
285
- <li>
286
- <Link to={`${path}/historyview`}>
287
- <div>
288
- <span className="pastanaga-menu-label">
289
- {historyAction?.title ||
290
- this.props.intl.formatMessage(messages.history)}
291
- </span>
292
- <span className="pastanaga-menu-value" />
293
- </div>
294
- <Icon name={rightArrowSVG} size="24px" />
295
- </Link>
296
- </li>
297
- )}
298
- </Plug>
299
- <Plug pluggable="toolbar-more-menu-list" id="sharing">
300
- {sharingAction && (
301
- <li>
302
- <Link to={`${path}/sharing`}>
303
- {this.props.intl.formatMessage(messages.sharing)}
304
- <Icon name={rightArrowSVG} size="24px" />
305
- </Link>
306
- </li>
307
- )}
308
- </Plug>
309
- <Plug pluggable="toolbar-more-menu-list" id="aliases">
310
- {aliasesAction && (
311
- <li>
312
- <Link to={`${path}/aliases`}>
313
- {this.props.intl.formatMessage(messages.aliases)}
314
- <Icon name={rightArrowSVG} size="24px" />
315
- </Link>
316
- </li>
317
- )}
318
- </Plug>
319
- <Plug pluggable="toolbar-more-menu-list" id="rules">
320
- {rulesAction && (
321
- <li>
322
- <Link to={`${path}/rules`}>
323
- {this.props.intl.formatMessage(messages.rules)}
324
- <Icon name={rightArrowSVG} size="24px" />
325
- </Link>
326
- </li>
327
- )}
328
- </Plug>
329
- </ul>
330
- </div>
331
- <Pluggable name="toolbar-more-manage-content">
332
- {(pluggables) => (
333
- <>
334
- {pluggables.length > 0 && (
335
- <>
336
- <header>
337
- <h2>
338
- {this.props.intl.formatMessage(messages.manageContent)}
339
- </h2>
340
- </header>
341
- <div className="pastanaga-menu-list">
342
- <ul>
343
- {pluggables.map((p) => (
344
- <>{p()}</>
345
- ))}
346
- </ul>
347
- </div>
348
- </>
349
- )}
350
- </>
351
- )}
352
- </Pluggable>
353
- {config.settings.hasWorkingCopySupport &&
354
- this.props.content['@type'] !== 'Plone Site' &&
355
- this.props.content['@type'] !== 'ims_indicator' && (
356
- <>
357
- {!this.props.content.working_copy && (
358
- <Plug pluggable="toolbar-more-manage-content" id="workingcopy">
359
- <li>
360
- <button
361
- aria-label={this.props.intl.formatMessage(
362
- messages.CreateWorkingCopy,
363
- )}
364
- onClick={() => {
365
- this.props.createWorkingCopy(path).then((response) => {
366
- this.props.history.push(
367
- flattenToAppURL(response['@id']),
368
- );
369
- this.props.closeMenu();
370
- });
371
- }}
372
- >
373
- {this.props.intl.formatMessage(
374
- messages.CreateWorkingCopy,
375
- )}
376
-
377
- <Icon name={rightArrowSVG} size="24px" />
378
- </button>
379
- </li>
380
- </Plug>
381
- )}
382
- {this.props.content.working_copy &&
383
- this.props.content.working_copy_of && (
384
- <Plug
385
- pluggable="toolbar-more-manage-content"
386
- id="workingcopy"
387
- >
388
- <li>
389
- <button
390
- aria-label={this.props.intl.formatMessage(
391
- messages.applyWorkingCopy,
392
- )}
393
- onClick={() => {
394
- this.props.applyWorkingCopy(path).then((response) => {
395
- this.props.history.push(
396
- flattenToAppURL(
397
- this.props.content.working_copy_of['@id'],
398
- ),
399
- );
400
- this.props.closeMenu();
401
- toast.info(
402
- <Toast
403
- info
404
- title={intl.formatMessage(
405
- messages.workingAppliedTitle,
406
- )}
407
- content={intl.formatMessage(
408
- messages.workingCopyAppliedBy,
409
- {
410
- creator: content.working_copy?.creator_name,
411
- date: (
412
- <FormattedDate
413
- date={content.working_copy?.created}
414
- format={dateOptions}
415
- />
416
- ),
417
- },
418
- )}
419
- />,
420
- {
421
- toastId: 'workingcopyapplyinfo',
422
- autoClose: 10000,
423
- },
424
- );
425
- });
426
- }}
427
- >
428
- {this.props.intl.formatMessage(
429
- messages.applyWorkingCopy,
430
- )}
431
-
432
- <Icon
433
- name={applySVG}
434
- size="24px"
435
- title={this.props.intl.formatMessage(
436
- messages.applyWorkingCopy,
437
- )}
438
- />
439
- </button>
440
- </li>
441
- <li>
442
- <button
443
- aria-label={this.props.intl.formatMessage(
444
- messages.removeWorkingCopy,
445
- )}
446
- onClick={() => {
447
- this.props
448
- .removeWorkingCopy(path)
449
- .then((response) => {
450
- this.props.history.push(
451
- flattenToAppURL(
452
- this.props.content.working_copy_of['@id'],
453
- ),
454
- );
455
- this.props.closeMenu();
456
- toast.info(
457
- <Toast
458
- info
459
- title={intl.formatMessage(
460
- messages.workingCopyRemovedTitle,
461
- )}
462
- />,
463
- {
464
- toastId: 'workingcopyremovednotice',
465
- autoClose: 10000,
466
- },
467
- );
468
- });
469
- }}
470
- >
471
- {this.props.intl.formatMessage(
472
- messages.removeWorkingCopy,
473
- )}
474
-
475
- <Icon
476
- name={removeSVG}
477
- size="24px"
478
- color="#e40166"
479
- title={this.props.intl.formatMessage(
480
- messages.removeWorkingCopy,
481
- )}
482
- />
483
- </button>
484
- </li>
485
- </Plug>
486
- )}
487
- {this.props.content.working_copy &&
488
- !this.props.content.working_copy_of && (
489
- <Plug
490
- pluggable="toolbar-more-manage-content"
491
- id="workingcopy"
492
- >
493
- <li>
494
- <Link
495
- to={flattenToAppURL(
496
- this.props.content.working_copy['@id'],
497
- )}
498
- onClick={() => this.props.closeMenu()}
499
- >
500
- {this.props.intl.formatMessage(
501
- messages.viewWorkingCopy,
502
- )}
503
- <Icon name={rightArrowSVG} size="24px" />
504
- </Link>
505
- </li>
506
- </Plug>
507
- )}
508
- </>
509
- )}
510
- {editAction &&
511
- config.settings.isMultilingual &&
512
- this.props.content['@type'] !== 'ims_indicator' && (
513
- <Plug pluggable="toolbar-more-manage-content" id="multilingual">
514
- <li>
515
- <Link to={`${path}/manage-translations`}>
516
- {this.props.intl.formatMessage(messages.ManageTranslations)}
517
-
518
- <Icon name={rightArrowSVG} size="24px" />
519
- </Link>
520
- </li>
521
- </Plug>
522
- )}
523
- </div>
524
- );
525
- }
526
- }
527
-
528
- export default compose(
529
- injectIntl,
530
- withRouter,
531
- connect(
532
- (state, props) => ({
533
- actions: state.actions.actions,
534
- pathname: props.pathname,
535
- content: state.content.data,
536
- lang: state.intl.locale,
537
- workingCopy: state.workingCopy,
538
- }),
539
- { applyWorkingCopy, createWorkingCopy, removeWorkingCopy },
540
- ),
541
- )(More);
@@ -1 +0,0 @@
1
- Workflow.jsx - copied from @plone/volto 16.22.2 - refs #256563