@eeacms/volto-marine-policy 2.0.29 → 2.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,23 @@ 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
+ ### [2.0.31](https://github.com/eea/volto-marine-policy/compare/2.0.30...2.0.31) - 10 October 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - refs #293080 added volto/actions/vocabularies/vocabularies.js customization to fix error [laszlocseh - [`485e27a`](https://github.com/eea/volto-marine-policy/commit/485e27a7a33661830531d105febbdad4cb58bbe4)]
12
+ ### [2.0.30](https://github.com/eea/volto-marine-policy/compare/2.0.29...2.0.30) - 22 September 2025
13
+
14
+ #### :house: Internal changes
15
+
16
+ - style: Automated code fix [eea-jenkins - [`5d52587`](https://github.com/eea/volto-marine-policy/commit/5d525877d8d3f93b75ac0f2f71853e754a0f1b3b)]
17
+
18
+ #### :hammer_and_wrench: Others
19
+
20
+ - fix eslint [laszlocseh - [`da4441c`](https://github.com/eea/volto-marine-policy/commit/da4441ca4a77b97d0aebc967120a61e2b87e14ca)]
21
+ - fix eslint [laszlocseh - [`390c0ad`](https://github.com/eea/volto-marine-policy/commit/390c0addf4a174f1fe452302a88df978cb24b684)]
22
+ - fix eslint [laszlocseh - [`c704506`](https://github.com/eea/volto-marine-policy/commit/c7045065771916ba77437143e1916875537687e3)]
23
+ - fix msfd data explorer scripts loading [laszlocseh - [`cb5d9ea`](https://github.com/eea/volto-marine-policy/commit/cb5d9eab1efb988f523b579ca4fa193fdaaf64bd)]
7
24
  ### [2.0.29](https://github.com/eea/volto-marine-policy/compare/2.0.28...2.0.29) - 22 September 2025
8
25
 
9
26
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-marine-policy",
3
- "version": "2.0.29",
3
+ "version": "2.0.31",
4
4
  "description": "@eeacms/volto-marine-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -39,41 +39,76 @@ const MsfdDataExplorerBlockView = (props) => {
39
39
  window.jQuery = $;
40
40
  global.jQuery = $;
41
41
 
42
- const scripts = [
43
- 'https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.4/select2.min.js',
44
- '/marine/++api++/++resource++msfd/js/jquery-ui.js',
45
- '/marine/++api++/++resource++msfd/js/tabs.js',
46
- '/marine/++api++/++resource++msfd/js/msfd_search.js',
47
- '/marine/++api++/++resource++msfd/bs3/js/bootstrap.min.js',
48
- ];
49
-
50
42
  if (!loading) {
51
- $.getScript(scripts[0], () => {
52
- $.getScript(scripts[1], () => {
53
- $.getScript(scripts[2], () => {
54
- $.getScript(scripts[3], () => {
55
- $.getScript(scripts[4]);
56
- });
43
+ const scripts = [
44
+ 'https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.4/select2.min.js',
45
+ '/marine/++api++/++resource++msfd/js/jquery-ui.js',
46
+ '/marine/++api++/++resource++msfd/js/tabs.js',
47
+ '/marine/++api++/++resource++msfd/js/msfd_search.js',
48
+ '/marine/++api++/++resource++msfd/bs3/js/bootstrap.min.js',
49
+ ];
50
+ const loadScripts = async () => {
51
+ for (const src of scripts) {
52
+ await new Promise((resolve, reject) => {
53
+ const script = document.createElement('script');
54
+ script.src = src;
55
+ script.type = 'text/javascript';
56
+ script.async = false; // load in order
57
+ script.onload = resolve;
58
+ script.onerror = reject;
59
+ document.body.appendChild(script);
57
60
  });
58
- });
59
- });
60
-
61
- // scripts.forEach((element) => {
62
- // // $.getScript(element);
63
- // const script = document.createElement('script');
64
- // script.src = element;
65
- // script.setAttribute('type', 'text/javascript');
66
- // script.async = false;
67
- // // script.defer = 'defer';
68
-
69
- // document.body.appendChild(script);
70
- // });
71
- // setTimeout(() => {
72
- // $.getScript('/++api++/++resource++msfd/js/msfd_search.js');
73
- // }, 200);
61
+ }
62
+ };
63
+ loadScripts();
64
+ // .then(() => {
65
+ // console.log('All scripts loaded');
66
+ // // $('.msfd-search-wrapper select').select2();
67
+ // })
68
+ // .catch((err) => console.error('Script load error', err));
74
69
  }
75
70
  }, [loading]);
76
71
 
72
+ // useEffect(() => {
73
+ // window.$ = $;
74
+ // window.jQuery = $;
75
+ // global.jQuery = $;
76
+
77
+ // const scripts = [
78
+ // 'https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.4/select2.min.js',
79
+ // '/++api++/++resource++msfd/js/jquery-ui.js',
80
+ // '/++api++/++resource++msfd/js/tabs.js',
81
+ // '/++api++/++resource++msfd/js/msfd_search.js',
82
+ // '/++api++/++resource++msfd/bs3/js/bootstrap.min.js',
83
+ // ];
84
+
85
+ // if (!loading) {
86
+ // $.getScript(scripts[0], () => {
87
+ // $.getScript(scripts[1], () => {
88
+ // $.getScript(scripts[2], () => {
89
+ // $.getScript(scripts[3], () => {
90
+ // $.getScript(scripts[4]);
91
+ // });
92
+ // });
93
+ // });
94
+ // });
95
+
96
+ // // scripts.forEach((element) => {
97
+ // // // $.getScript(element);
98
+ // // const script = document.createElement('script');
99
+ // // script.src = element;
100
+ // // script.setAttribute('type', 'text/javascript');
101
+ // // script.async = false;
102
+ // // // script.defer = 'defer';
103
+
104
+ // // document.body.appendChild(script);
105
+ // // });
106
+ // // setTimeout(() => {
107
+ // // $.getScript('/++api++/++resource++msfd/js/msfd_search.js');
108
+ // // }, 200);
109
+ // }
110
+ // }, [loading]);
111
+
77
112
  return (
78
113
  <>
79
114
  {article_select ? (
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Vocabularies actions.
3
+ * @module actions/vocabularies/vocabularies
4
+ */
5
+
6
+ import {
7
+ GET_VOCABULARY,
8
+ GET_VOCABULARY_TOKEN_TITLE,
9
+ } from '@plone/volto/constants/ActionTypes';
10
+ import { getVocabName } from '@plone/volto/helpers/Vocabularies/Vocabularies';
11
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
12
+ import qs from 'query-string';
13
+
14
+ /**
15
+ * Get vocabulary given a URL (coming from a Schema) or from a vocabulary name.
16
+ * @function getVocabulary
17
+ * @param {string} vocabNameOrURL Full API URL of vocabulary or vocabulary name
18
+ * @param {string} query Only include results containing this string.
19
+ * @param {number} start Start of result batch.
20
+ * @param {number} b_size The size of the batch.
21
+ * @param {string} subrequest Name of the subrequest.
22
+ * @returns {Object} Get vocabulary action.
23
+ */
24
+ export function getVocabulary({
25
+ vocabNameOrURL,
26
+ query = null,
27
+ start = 0,
28
+ size,
29
+ subrequest,
30
+ }) {
31
+ const vocabPath = String(vocabNameOrURL).includes('/')
32
+ ? flattenToAppURL(vocabNameOrURL)
33
+ : `/@vocabularies/${vocabNameOrURL}`;
34
+
35
+ let queryString = `b_start=${start}${size ? '&b_size=' + size : ''}`;
36
+
37
+ if (query) {
38
+ queryString = `${queryString}&title=${query}`;
39
+ }
40
+ return {
41
+ type: GET_VOCABULARY,
42
+ vocabulary: vocabNameOrURL,
43
+ start,
44
+ request: {
45
+ op: 'get',
46
+ path: `${vocabPath}?${queryString}`,
47
+ },
48
+ subrequest,
49
+ };
50
+ }
51
+
52
+ /**
53
+ * Get the title value given a token from vocabulary given a vocabulary URL
54
+ * (coming from a Schema) or from a vocabulary name.
55
+ * @function getVocabularyTokenTitle
56
+ * @param {string} vocabNameOrURL Full API URL of vocabulary or vocabulary name
57
+ * @param {string} token Only include results containing this string.
58
+ * @returns {Object} Get vocabulary action.
59
+ */
60
+ export function getVocabularyTokenTitle({
61
+ vocabNameOrURL,
62
+ token = null,
63
+ tokens = null,
64
+ subrequest,
65
+ }) {
66
+ // In case we have a URL, we have to get the vocabulary name
67
+ const vocabulary = getVocabName(vocabNameOrURL);
68
+ const queryString = {
69
+ ...(token && { token }),
70
+ ...(tokens && { tokens }),
71
+ };
72
+
73
+ return {
74
+ type: GET_VOCABULARY_TOKEN_TITLE,
75
+ vocabulary: vocabNameOrURL,
76
+ token,
77
+ tokens,
78
+ subrequest,
79
+ request: {
80
+ op: 'get',
81
+ path: `/@vocabularies/${vocabulary}?b_size=-1&${qs.stringify(
82
+ queryString,
83
+ {
84
+ encode: false,
85
+ },
86
+ )}`,
87
+ },
88
+ };
89
+ }