@eeacms/volto-marine-policy 2.0.30 → 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,11 @@ 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)]
|
|
7
12
|
### [2.0.30](https://github.com/eea/volto-marine-policy/compare/2.0.29...2.0.30) - 22 September 2025
|
|
8
13
|
|
|
9
14
|
#### :house: Internal changes
|
package/package.json
CHANGED
|
@@ -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
|
+
}
|