@eeacms/volto-cca-policy 0.1.1

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.
Files changed (65) hide show
  1. package/.coverage.babel.config.js +9 -0
  2. package/.i18n.babel.config.js +1 -0
  3. package/.project.eslintrc.js +48 -0
  4. package/.release-it.json +17 -0
  5. package/CHANGELOG.md +30 -0
  6. package/DEVELOP.md +52 -0
  7. package/LICENSE.md +9 -0
  8. package/README.md +85 -0
  9. package/RELEASE.md +74 -0
  10. package/babel.config.js +17 -0
  11. package/bootstrap +41 -0
  12. package/cypress.config.js +26 -0
  13. package/jest-addon.config.js +36 -0
  14. package/locales/volto.pot +0 -0
  15. package/package.json +51 -0
  16. package/src/components/index.js +1 -0
  17. package/src/components/manage/Blocks/ContextNavigation/ContextNavigationEdit.jsx +31 -0
  18. package/src/components/manage/Blocks/ContextNavigation/ContextNavigationView.jsx +17 -0
  19. package/src/components/manage/Blocks/ContextNavigation/index.js +26 -0
  20. package/src/components/manage/Blocks/ContextNavigation/schema.js +81 -0
  21. package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsEdit.jsx +32 -0
  22. package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsView.jsx +15 -0
  23. package/src/components/manage/Blocks/LayoutSettings/edit.less +4 -0
  24. package/src/components/manage/Blocks/LayoutSettings/index.js +24 -0
  25. package/src/components/manage/Blocks/LayoutSettings/schema.js +32 -0
  26. package/src/components/manage/Blocks/Title/Edit.jsx +226 -0
  27. package/src/components/manage/Blocks/Title/View.jsx +35 -0
  28. package/src/components/manage/Blocks/Title/index.js +13 -0
  29. package/src/components/manage/Blocks/Title/schema.js +80 -0
  30. package/src/components/manage/Blocks/schema-utils.js +16 -0
  31. package/src/components/manage/Blocks/schema.js +52 -0
  32. package/src/components/theme/Banner/Banner.jsx +99 -0
  33. package/src/components/theme/Banner/View.jsx +241 -0
  34. package/src/components/theme/Banner/styles.less +20 -0
  35. package/src/components/theme/CustomCSS/CustomCSS.jsx +12 -0
  36. package/src/components/theme/DraftBackground/DraftBackground.jsx +16 -0
  37. package/src/components/theme/DraftBackground/draft.css +3 -0
  38. package/src/components/theme/DraftBackground/draft.png +0 -0
  39. package/src/components/theme/Homepage/HomePageInverseView.jsx +60 -0
  40. package/src/components/theme/Homepage/HomePageView.jsx +60 -0
  41. package/src/components/theme/Logo.jsx +34 -0
  42. package/src/components/theme/SubsiteClass.jsx +23 -0
  43. package/src/components/theme/Widgets/TokenWidget.jsx +16 -0
  44. package/src/config.js +307 -0
  45. package/src/customizations/@eeacms/volto-block-style/StyleWrapper/schema.js +44 -0
  46. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderSearchPopUp.js +80 -0
  47. package/src/customizations/@eeacms/volto-tabs-block/components/templates/default/schema.js +109 -0
  48. package/src/customizations/@eeacms/volto-tabs-block/components/templates/horizontal-responsive/schema.js +109 -0
  49. package/src/customizations/volto/components/manage/Form/Form.jsx +784 -0
  50. package/src/customizations/volto/components/manage/Form/ModalForm.jsx +326 -0
  51. package/src/customizations/volto/components/manage/Sharing/Sharing.jsx +495 -0
  52. package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.jsx +436 -0
  53. package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.jsx +62 -0
  54. package/src/customizations/volto/components/theme/Comments/Comments.jsx +487 -0
  55. package/src/customizations/volto/components/theme/Footer/Footer.jsx +90 -0
  56. package/src/customizations/volto/components/theme/Header/Header.jsx +258 -0
  57. package/src/customizations/volto/components/theme/Tags/Tags.jsx +53 -0
  58. package/src/customizations/volto/components/theme/Unauthorized/Unauthorized.jsx +91 -0
  59. package/src/customizations/volto/components/theme/View/EventView.jsx +90 -0
  60. package/src/helpers/index.js +44 -0
  61. package/src/icons/content-box.svg +5 -0
  62. package/src/icons/image-narrow.svg +5 -0
  63. package/src/index.js +13 -0
  64. package/src/middleware/voltoCustom.js +37 -0
  65. package/src/policy.js +136 -0
@@ -0,0 +1,9 @@
1
+ const defaultBabel = require('@plone/volto/babel');
2
+
3
+ function applyDefault(api) {
4
+ const voltoBabel = defaultBabel(api);
5
+ voltoBabel.plugins.push('istanbul');
6
+ return voltoBabel;
7
+ }
8
+
9
+ module.exports = applyDefault;
@@ -0,0 +1 @@
1
+ module.exports = require('@plone/volto/babel');
@@ -0,0 +1,48 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const projectRootPath = fs.existsSync('./project')
5
+ ? fs.realpathSync('./project')
6
+ : fs.realpathSync('./../../../');
7
+ const packageJson = require(path.join(projectRootPath, 'package.json'));
8
+ const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
9
+
10
+ const pathsConfig = jsConfig.paths;
11
+
12
+ let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
13
+
14
+ Object.keys(pathsConfig).forEach(pkg => {
15
+ if (pkg === '@plone/volto') {
16
+ voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
17
+ }
18
+ });
19
+ const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
20
+ const reg = new AddonConfigurationRegistry(projectRootPath);
21
+
22
+ // Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
23
+ const addonAliases = Object.keys(reg.packages).map(o => [
24
+ o,
25
+ reg.packages[o].modulePath,
26
+ ]);
27
+
28
+
29
+ module.exports = {
30
+ extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
31
+ settings: {
32
+ 'import/resolver': {
33
+ alias: {
34
+ map: [
35
+ ['@plone/volto', '@plone/volto/src'],
36
+ ...addonAliases,
37
+ ['@package', `${__dirname}/src`],
38
+ ['~', `${__dirname}/src`],
39
+ ],
40
+ extensions: ['.js', '.jsx', '.json'],
41
+ },
42
+ 'babel-plugin-root-import': {
43
+ rootPathSuffix: 'src',
44
+ },
45
+ },
46
+ },
47
+ };
48
+
@@ -0,0 +1,17 @@
1
+ {
2
+ "npm": {
3
+ "publish": false
4
+ },
5
+ "git": {
6
+ "changelog": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs",
7
+ "tagName": "${version}"
8
+ },
9
+ "github": {
10
+ "release": true,
11
+ "releaseName": "${version}",
12
+ "releaseNotes": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs"
13
+ },
14
+ "hooks": {
15
+ "after:bump": "npx auto-changelog --commit-limit false -p"
16
+ }
17
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ ### Changelog
2
+
3
+ All notable changes to this project will be documented in this file. Dates are displayed in UTC.
4
+
5
+ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
+
7
+ ### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Refs #158294 - Try fix Jenkins errors - Unable to resolve path to module 'volto-subsites. [GhitaB - [`a6a80be`](https://github.com/eea/volto-cca-policy/commit/a6a80be79e9c2a763f170da5fcb5b9e016473756)]
12
+ - Refs #158294 - Try fix Jenkins errors - Unable to resolve path to module 'volto-subsites. [GhitaB - [`941b76f`](https://github.com/eea/volto-cca-policy/commit/941b76f8a6b43c4517ecd9e26fe2f0f593bec71d)]
13
+ - Refs #158294 - Try fix Jenkins errors - Unable to resolve path to module '@eeacms/volto-eea-design-system. [GhitaB - [`9f25f9a`](https://github.com/eea/volto-cca-policy/commit/9f25f9a0f1e107c85b27d809485f2875a515374d)]
14
+ - Refs #158294 - Try fix Jenkins errors - fix package.json. [GhitaB - [`eb1a26a`](https://github.com/eea/volto-cca-policy/commit/eb1a26af23b4f3b2de9673df32da7d1cd8736d27)]
15
+ - Refs #158294 - Try fix Jenkins errors. [GhitaB - [`b3063ac`](https://github.com/eea/volto-cca-policy/commit/b3063ac32424fd91683ccdbe776f3b2eab33b403)]
16
+ - Refs #158294 - Try fix Jenkins errors. [GhitaB - [`c3ceeb9`](https://github.com/eea/volto-cca-policy/commit/c3ceeb95a6759b0c75c7f39a8972919b5b4486fe)]
17
+ - Update Jenkinsfile [Laszlo Cseh - [`e1dd864`](https://github.com/eea/volto-cca-policy/commit/e1dd8643028603214b8247a04d36a50ef897e67e)]
18
+ - Update Jenkinsfile [Laszlo Cseh - [`d20da61`](https://github.com/eea/volto-cca-policy/commit/d20da61c8cae592aa951d353c7c9a58081521062)]
19
+ - Adjustments [Tiberiu Ichim - [`025e684`](https://github.com/eea/volto-cca-policy/commit/025e684665b63ee48b12becfd3e8cff3abbd87e3)]
20
+ - WIP [Tiberiu Ichim - [`25ce073`](https://github.com/eea/volto-cca-policy/commit/25ce073f5f802bb0e71ff366afe1325f32ddca95)]
21
+ - WIP [Tiberiu Ichim - [`10aff31`](https://github.com/eea/volto-cca-policy/commit/10aff3107beadede673d1ebbdb73c1885dd35899)]
22
+ - WIP [Tiberiu Ichim - [`f56124c`](https://github.com/eea/volto-cca-policy/commit/f56124c4605a001d711ddee30de11124ccd2facf)]
23
+ - Add files from EEA Website theme [Tiberiu Ichim - [`7041b92`](https://github.com/eea/volto-cca-policy/commit/7041b92c606090d263d57eb9cd307dd0a464a639)]
24
+ - Run bootstrap [Tiberiu Ichim - [`b765f56`](https://github.com/eea/volto-cca-policy/commit/b765f567c47f134f1ea0e14ec27a5732cd2c190d)]
25
+ ### 0.1.0 - 13 December 2022
26
+
27
+ #### :hammer_and_wrench: Others
28
+
29
+ - Update Jenkinsfile [Laszlo Cseh - [`9ea4425`](https://github.com/eea/volto-cca-policy/commit/9ea4425c08029208abd0c6cd18de35d2f6158c89)]
30
+ - Initial commit [Tiberiu Ichim - [`75d4824`](https://github.com/eea/volto-cca-policy/commit/75d4824c496f4fb6ab2c7567515e7f4ad4eeba39)]
package/DEVELOP.md ADDED
@@ -0,0 +1,52 @@
1
+ # volto-cca-policy
2
+
3
+ ## Develop
4
+
5
+ Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
6
+
7
+ 1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer`
8
+
9
+ npm install -g yo @plone/generator-volto mrs-developer
10
+
11
+ 1. Create new volto app
12
+
13
+ yo @plone/volto my-volto-project --addon @eeacms/volto-cca-policy --skip-install
14
+ cd my-volto-project
15
+
16
+ 1. Add the following to `mrs.developer.json`:
17
+
18
+ {
19
+ "volto-cca-policy": {
20
+ "url": "https://github.com/eea/volto-cca-policy.git",
21
+ "package": "@eeacms/volto-cca-policy",
22
+ "branch": "develop",
23
+ "path": "src"
24
+ }
25
+ }
26
+
27
+ 1. Install
28
+
29
+ yarn develop
30
+ yarn
31
+
32
+ 1. Start backend
33
+
34
+ docker pull plone
35
+ docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
36
+
37
+ ...wait for backend to setup and start - `Ready to handle requests`:
38
+
39
+ docker logs -f plone
40
+
41
+ ...you can also check http://localhost:8080/Plone
42
+
43
+ 1. Start frontend
44
+
45
+ yarn start
46
+
47
+ 1. Go to http://localhost:3000
48
+
49
+ 1. Happy hacking!
50
+
51
+ cd src/addons/volto-cca-policy/
52
+ s/volto-addon-template/
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 European Environment Agency
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # volto-cca-policy
2
+
3
+ [![Releases](https://img.shields.io/github/v/release/eea/volto-cca-policy)](https://github.com/eea/volto-cca-policy/releases)
4
+
5
+ [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-cca-policy%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-cca-policy/job/master/display/redirect)
6
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-cca-policy-master&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-cca-policy-master)
7
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-cca-policy-master&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-cca-policy-master)
8
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-cca-policy-master&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-cca-policy-master)
9
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-cca-policy-master&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-cca-policy-master)
10
+
11
+ [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-cca-policy%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-cca-policy/job/develop/display/redirect)
12
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-cca-policy-develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-cca-policy-develop)
13
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-cca-policy-develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-cca-policy-develop)
14
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-cca-policy-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-cca-policy-develop)
15
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-cca-policy-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-cca-policy-develop)
16
+
17
+
18
+ [Volto](https://github.com/plone/volto) add-on
19
+
20
+ ## Features
21
+
22
+ Demo GIF
23
+
24
+ ## Getting started
25
+
26
+ ### Add volto-cca-policy to your Volto project
27
+
28
+ 1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
29
+
30
+ 1. Start Volto frontend
31
+
32
+ * If you already have a volto project, just update `package.json`:
33
+
34
+ ```JSON
35
+ "addons": [
36
+ "@eeacms/volto-cca-policy"
37
+ ],
38
+
39
+ "dependencies": {
40
+ "@eeacms/volto-cca-policy": "*"
41
+ }
42
+ ```
43
+
44
+ * If not, create one:
45
+
46
+ ```
47
+ npm install -g yo @plone/generator-volto
48
+ yo @plone/volto my-volto-project --canary --addon @eeacms/volto-cca-policy
49
+ cd my-volto-project
50
+ ```
51
+
52
+ 1. Install new add-ons and restart Volto:
53
+
54
+ ```
55
+ yarn
56
+ yarn start
57
+ ```
58
+
59
+ 1. Go to http://localhost:3000
60
+
61
+ 1. Happy editing!
62
+
63
+ ## Release
64
+
65
+ See [RELEASE.md](https://github.com/eea/volto-cca-policy/blob/master/RELEASE.md).
66
+
67
+ ## How to contribute
68
+
69
+ See [DEVELOP.md](https://github.com/eea/volto-cca-policy/blob/master/DEVELOP.md).
70
+
71
+ ## Copyright and license
72
+
73
+ The Initial Owner of the Original Code is European Environment Agency (EEA).
74
+ All Rights Reserved.
75
+
76
+ See [LICENSE.md](https://github.com/eea/volto-cca-policy/blob/master/LICENSE.md) for details.
77
+
78
+ ## Funding
79
+
80
+ [European Environment Agency (EU)](http://eea.europa.eu)
81
+ don-template/blob/master/LICENSE.md) for details.
82
+
83
+ ## Funding
84
+
85
+ [European Environment Agency (EU)](http://eea.europa.eu)
package/RELEASE.md ADDED
@@ -0,0 +1,74 @@
1
+ ## Release
2
+
3
+ ### Automatic release using Jenkins
4
+
5
+ * The automatic release is started by creating a [Pull Request](../../compare/master...develop) from `develop` to `master`. The pull request status checks correlated to the branch and PR Jenkins jobs need to be processed successfully. 1 review from a github user with rights is mandatory.
6
+ * It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
7
+ * The automatic release is done by [Jenkins](https://ci.eionet.europa.eu). The status of the release job can be seen both in the Readme.md badges and the green check/red cross/yellow circle near the last commit information. If you click on the icon, you will have the list of checks that were run. The `continuous-integration/jenkins/branch` link goes to the Jenkins job execution webpage.
8
+ * Automated release scripts are located in the `eeacms/gitflow` docker image, specifically [js-release.sh](https://github.com/eea/eea.docker.gitflow/blob/master/src/js-release.sh) script. It uses the `release-it` tool.
9
+ * As long as a PR request is open from develop to master, the PR Jenkins job will automatically re-create the CHANGELOG.md and package.json files to be production-ready.
10
+ * The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
11
+ * You can manually change the version in `package.json`. The new version must not be already present in the tags/releases of the repository, otherwise it will be automatically increased by the script. Any changes to the version will trigger a `CHANGELOG.md` re-generation.
12
+ * Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
13
+
14
+ ### Manual release from the develop branch ( beta release )
15
+
16
+ #### Installation and configuration of release-it
17
+
18
+ You need to first install the [release-it](https://github.com/release-it/release-it) client.
19
+
20
+ ```
21
+ npm install -g release-it
22
+ ```
23
+
24
+ Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
25
+
26
+ Release-it is a tool that automates 4 important steps in the release process:
27
+
28
+ 1. Version increase in `package.json` ( increased from the current version in `package.json`)
29
+ 2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
30
+ 3. GitHub release on the commit with the changelog and package.json modification on the develop branch
31
+ 4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
32
+
33
+ To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
34
+
35
+ ```
36
+ export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
37
+ ```
38
+
39
+ To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
40
+
41
+ ```
42
+ echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
43
+ ```
44
+
45
+ #### Using release-it tool
46
+
47
+ There are 3 yarn scripts that can be run to do the release
48
+
49
+ ##### yarn release-beta
50
+
51
+ Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
52
+
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...
59
+ ```
60
+
61
+ ##### yarn release-major-beta
62
+
63
+ Same as `yarn release-beta`, but with premajor version pre-selected.
64
+
65
+ ##### yarn release
66
+
67
+ Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
68
+
69
+ #### Important notes
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.
72
+
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
+
@@ -0,0 +1,17 @@
1
+ module.exports = function (api) {
2
+ api.cache(true);
3
+ const presets = ['razzle'];
4
+ const plugins = [
5
+ [
6
+ 'react-intl', // React Intl extractor, required for the whole i18n infrastructure to work
7
+ {
8
+ messagesDir: './build/messages/',
9
+ },
10
+ ],
11
+ ];
12
+
13
+ return {
14
+ plugins,
15
+ presets,
16
+ };
17
+ };
package/bootstrap ADDED
@@ -0,0 +1,41 @@
1
+ const path = require('path');
2
+ const fs = require('fs');
3
+ const ejs = require('ejs');
4
+
5
+ const currentDir = path.basename(process.cwd());
6
+
7
+ const bootstrap = function (ofile) {
8
+ fs.readFile(ofile, 'utf8', function (err, data) {
9
+ if (err) {
10
+ return console.log(err);
11
+ }
12
+ const result = ejs.render(data, {
13
+ addonName: `@eeacms/${currentDir}`,
14
+ name: currentDir
15
+ });
16
+ const output = ofile.replace('.tpl', '');
17
+ fs.writeFile(output, result, 'utf8', function (err) {
18
+ if (err) {
19
+ return console.log(err);
20
+ }
21
+ });
22
+ if (ofile.includes('.tpl')) {
23
+ fs.unlink(ofile, (err) => {
24
+ if (err) {
25
+ return console.error(err);
26
+ }
27
+ });
28
+ }
29
+ });
30
+ }
31
+
32
+ fs.readdir(".", { withFileTypes: true }, (err, dirents) => {
33
+ const files = dirents
34
+ .filter(dirent => dirent.isFile())
35
+ .map(dirent => dirent.name);
36
+ files.forEach(function (file) {
37
+ if (file != 'bootstrap') {
38
+ bootstrap(file);
39
+ }
40
+ });
41
+ });
@@ -0,0 +1,26 @@
1
+ const { defineConfig } = require('cypress');
2
+
3
+ module.exports = defineConfig({
4
+ viewportWidth: 1280,
5
+ defaultCommandTimeout: 8888,
6
+ chromeWebSecurity: false,
7
+ reporter: 'junit',
8
+ video: true,
9
+ retries: {
10
+ runMode: 8,
11
+ openMode: 0,
12
+ },
13
+ reporterOptions: {
14
+ mochaFile: 'cypress/reports/cypress-[hash].xml',
15
+ jenkinsMode: true,
16
+ toConsole: true,
17
+ },
18
+ e2e: {
19
+ setupNodeEvents(on, config) {
20
+ // e2e testing node events setup code
21
+ require('@cypress/code-coverage/task')(on, config);
22
+ return config;
23
+ },
24
+ baseUrl: 'http://localhost:3000',
25
+ },
26
+ });
@@ -0,0 +1,36 @@
1
+ module.exports = {
2
+ testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
3
+ collectCoverageFrom: [
4
+ 'src/addons/**/src/**/*.{js,jsx,ts,tsx}',
5
+ '!src/**/*.d.ts',
6
+ ],
7
+ moduleNameMapper: {
8
+ '@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
9
+ '@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
10
+ '@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
11
+ '@package/(.*)$': '<rootDir>/src/$1',
12
+ '@root/(.*)$': '<rootDir>/src/$1',
13
+ '@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
14
+ '@eeacms/(.*?)/(.*)$': '<rootDir>/src/addons/$1/src/$2',
15
+ '@plone/volto-slate':
16
+ '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
17
+ '~/(.*)$': '<rootDir>/src/$1',
18
+ 'load-volto-addons':
19
+ '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
20
+ '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
21
+ },
22
+ transform: {
23
+ '^.+\\.js(x)?$': 'babel-jest',
24
+ '^.+\\.(png)$': 'jest-file',
25
+ '^.+\\.(jpg)$': 'jest-file',
26
+ '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
27
+ },
28
+ coverageThreshold: {
29
+ global: {
30
+ branches: 5,
31
+ functions: 5,
32
+ lines: 5,
33
+ statements: 5,
34
+ },
35
+ },
36
+ };
File without changes
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@eeacms/volto-cca-policy",
3
+ "version": "0.1.1",
4
+ "description": "@eeacms/volto-cca-policy: Volto add-on",
5
+ "main": "src/index.js",
6
+ "author": "European Environment Agency: IDM2 A-Team",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/eea/volto-cca-policy",
9
+ "keywords": [
10
+ "volto-addon",
11
+ "volto",
12
+ "plone",
13
+ "react"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git@github.com:eea/volto-cca-policy.git"
18
+ },
19
+ "addons": [
20
+ "@eeacms/volto-eea-design-system",
21
+ "volto-subsites"
22
+ ],
23
+ "devDependencies": {
24
+ "@cypress/code-coverage": "^3.10.0",
25
+ "@plone/scripts": "*",
26
+ "@eeacms/volto-eea-design-system": "*",
27
+ "volto-subsites": "*",
28
+ "babel-plugin-transform-class-properties": "^6.24.1",
29
+ "cypress-fail-fast": "^5.0.1",
30
+ "md5": "^2.3.0"
31
+ },
32
+ "scripts": {
33
+ "release": "release-it",
34
+ "release-major-beta": "release-it major --preRelease=beta",
35
+ "release-beta": "release-it --preRelease=beta",
36
+ "bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
37
+ "test": "make test",
38
+ "test:fix": "make test-update",
39
+ "pre-commit": "yarn stylelint:fix && yarn prettier:fix && yarn lint:fix",
40
+ "stylelint": "make stylelint",
41
+ "stylelint:overrides": "make stylelint-overrides",
42
+ "stylelint:fix": "make stylelint-fix",
43
+ "prettier": "make prettier",
44
+ "prettier:fix": "make prettier-fix",
45
+ "lint": "make lint",
46
+ "lint:fix": "make lint-fix",
47
+ "i18n": "make i18n",
48
+ "cypress:run": "make cypress-run",
49
+ "cypress:open": "make cypress-open"
50
+ }
51
+ }
@@ -0,0 +1 @@
1
+ export BannerView from './theme/Banner/View';
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { EditSchema } from './schema';
3
+ import { InlineForm, SidebarPortal } from '@plone/volto/components';
4
+ import ContextNavigationView from './ContextNavigationView';
5
+
6
+ const ContextNavigationFillView = (props) => {
7
+ const schema = EditSchema();
8
+ return (
9
+ <>
10
+ <h3>Context navigation</h3>
11
+ <ContextNavigationView {...props} />{' '}
12
+ <SidebarPortal selected={props.selected}>
13
+ {props.selected && (
14
+ <InlineForm
15
+ title={schema.title}
16
+ schema={schema}
17
+ formData={props.data}
18
+ onChangeField={(id, value) => {
19
+ props.onChangeBlock(props.block, {
20
+ ...props.data,
21
+ [id]: value,
22
+ });
23
+ }}
24
+ />
25
+ )}
26
+ </SidebarPortal>
27
+ </>
28
+ );
29
+ };
30
+
31
+ export default ContextNavigationFillView;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import ConnectedContextNavigation from '@plone/volto/components/theme/Navigation/ContextNavigation';
3
+ import { flattenToAppURL } from '@plone/volto/helpers';
4
+
5
+ const ContextNavigationView = ({ data = {} }) => {
6
+ const navProps = { ...data };
7
+ const root_path = data?.root_node?.[0]?.['@id'];
8
+ if (root_path) navProps['root_path'] = flattenToAppURL(root_path);
9
+
10
+ return (
11
+ <>
12
+ <ConnectedContextNavigation params={navProps} />
13
+ </>
14
+ );
15
+ };
16
+
17
+ export default ContextNavigationView;
@@ -0,0 +1,26 @@
1
+ import codeSVG from '@plone/volto/icons/code.svg';
2
+ import ContextNavigationEdit from './ContextNavigationEdit';
3
+ import ContextNavigationView from './ContextNavigationView';
4
+ import BlockSettingsSchema from '@plone/volto/components/manage/Blocks/Block/Schema';
5
+
6
+ export default (config) => {
7
+ config.blocks.blocksConfig.contextNavigation = {
8
+ id: 'contextNavigation',
9
+ title: 'Navigation',
10
+ icon: codeSVG,
11
+ group: 'site',
12
+ view: ContextNavigationView,
13
+ edit: ContextNavigationEdit,
14
+ schema: BlockSettingsSchema,
15
+ restricted: true,
16
+ mostUsed: true,
17
+ blockHasOwnFocusManagement: true,
18
+ sidebarTab: 1,
19
+ security: {
20
+ addPermission: [],
21
+ view: [],
22
+ },
23
+ };
24
+
25
+ return config;
26
+ };