diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml
index 574f1ae..0ddb9af 100644
--- a/.github/workflows/acceptance.yml
+++ b/.github/workflows/acceptance.yml
@@ -26,7 +26,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
- name: Enable corepack
- run: corepack enable
+ run: npm i -g corepack@latest && corepack enable
- name: Get pnpm store directory
shell: bash
diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml
index 77b280e..a487b23 100644
--- a/.github/workflows/changelog.yml
+++ b/.github/workflows/changelog.yml
@@ -27,7 +27,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
- name: Enable corepack
- run: corepack enable
+ run: npm i -g corepack@latest && corepack enable
- name: Get pnpm store directory
shell: bash
diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml
index 79f96f4..ed78813 100644
--- a/.github/workflows/code.yml
+++ b/.github/workflows/code.yml
@@ -25,7 +25,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
- name: Enable corepack
- run: corepack enable
+ run: npm i -g corepack@latest && corepack enable
- name: Get pnpm store directory
shell: bash
diff --git a/.github/workflows/i18n.yml b/.github/workflows/i18n.yml
index c8e463b..58dc937 100644
--- a/.github/workflows/i18n.yml
+++ b/.github/workflows/i18n.yml
@@ -25,7 +25,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
- name: Enable corepack
- run: corepack enable
+ run: npm i -g corepack@latest && corepack enable
- name: Get pnpm store directory
shell: bash
diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml
index 32a8b60..af706b8 100644
--- a/.github/workflows/storybook.yml
+++ b/.github/workflows/storybook.yml
@@ -27,7 +27,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
- name: Enable corepack
- run: corepack enable
+ run: npm i -g corepack@latest && corepack enable
- name: Get pnpm store directory
shell: bash
diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml
index 93a1309..61f70b5 100644
--- a/.github/workflows/unit.yml
+++ b/.github/workflows/unit.yml
@@ -25,7 +25,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
- name: Enable corepack
- run: corepack enable
+ run: npm i -g corepack@latest && corepack enable
- name: Get pnpm store directory
shell: bash
diff --git a/README.md b/README.md
index e04f56e..55eec6a 100644
--- a/README.md
+++ b/README.md
@@ -36,8 +36,10 @@ There are two options:
> This requires Volto >= 16.10.0 with a pluggable toolbar.
-Include bookmarking in your Volto project by integrating a component `Bookmarking`.
-This component adds two buttons to the toolbar: one for toggling the bookmark of the current page and one for displaying a menu with a list of bookmarks.
+Include bookmarking in your Volto project by integrating the component `Bookmarking`.
+This component adds two buttons to the toolbar:
+one for toggling the bookmark of the current page and
+one for displaying a menu with a list of bookmarks.
`config.js`:
@@ -98,27 +100,17 @@ config.settings.bookmarks = {
Add a mapping for search filters:
```js
- config.settings.bookmarks.filtermapping = {
- facet_fields: {
- '5237dc43-c573-4651-a5b8-cf24bfde13a6': 'Datendrehscheibe',
- allgemeines: 'Allgemeines',
- arbeitsliste: 'Arbeitsliste',
- beb2k: 'BEB2k',
- 'release-note': 'Release-Note',
- tutorial: 'Tutorial',
- 'superuser-innen': 'Superuser/innen',
- ai: 'AI',
- andere: 'Andere',
- tg: 'TG',
- zh: 'ZH',
- },
- search_sections: {
- others: 'Website',
- dokumentation: 'Dokumentation',
- inside: 'IGIB-Inside',
- geologie: 'Geologie',
- },
+ config.settings.bookmarks.filtermapping = {
+ facet_fields: {
+ 'News Item': 'Nachricht',
+ Document: 'Seite',
+ Event: 'Veranstaltung',
},
+ search_sections: {
+ others: 'Website',
+ nachrichten: 'Nachrichten',
+ },
+ };
```
diff --git a/packages/policy/src/index.js b/packages/policy/src/index.js
index d525295..e92bb45 100644
--- a/packages/policy/src/index.js
+++ b/packages/policy/src/index.js
@@ -17,9 +17,12 @@ const applyConfig = (config) => {
config.settings.bookmarks.filtermapping = {
facet_fields: {
- 'News Item': 'News',
+ 'News Item': 'News Item',
+ Document: 'Page',
+ Event: 'Event',
},
search_sections: {
+ others: 'Website',
news: 'News',
},
};
diff --git a/packages/volto-bookmarks/news/7.feature b/packages/volto-bookmarks/news/7.feature
new file mode 100644
index 0000000..7489d71
--- /dev/null
+++ b/packages/volto-bookmarks/news/7.feature
@@ -0,0 +1 @@
+Enhance bookmarking of search requests: bookmarks menu: labels according search parameters. @ksuess
diff --git a/packages/volto-bookmarks/src/actions/index.js b/packages/volto-bookmarks/src/actions/index.js
index b00699a..8d0472b 100644
--- a/packages/volto-bookmarks/src/actions/index.js
+++ b/packages/volto-bookmarks/src/actions/index.js
@@ -4,7 +4,7 @@
import { ADD_BOOKMARK, DEL_BOOKMARK, GET_BOOKMARKS } from '../constants';
-import { generateSearchQueryObject } from '../helpers';
+import { sortQuerystring } from '../helpers';
/**
* addBookmark
@@ -13,7 +13,7 @@ import { generateSearchQueryObject } from '../helpers';
* @param {String} querystring
* @param {Object} payload
*/
-export function addBookmark(uid, group, querystring = '', payload = {}) {
+export function addBookmark(uid, group, querystring = null, payload = {}) {
return {
type: ADD_BOOKMARK,
request: {
@@ -22,7 +22,7 @@ export function addBookmark(uid, group, querystring = '', payload = {}) {
data: {
uid,
group,
- queryparams: JSON.stringify(generateSearchQueryObject(querystring)),
+ queryparams: sortQuerystring(querystring),
payload,
},
},
@@ -35,7 +35,7 @@ export function addBookmark(uid, group, querystring = '', payload = {}) {
* @param {String} group
* @param {Object} queryObjectStringified
*/
-export function deleteBookmark(uid, group, queryObjectStringified = '') {
+export function deleteBookmark(uid, group, querystring = null) {
return {
type: DEL_BOOKMARK,
request: {
@@ -44,7 +44,7 @@ export function deleteBookmark(uid, group, queryObjectStringified = '') {
data: {
uid,
group,
- queryparams: queryObjectStringified,
+ queryparams: sortQuerystring(querystring),
},
},
};
diff --git a/packages/volto-bookmarks/src/components/BookmarksEditorComponent.jsx b/packages/volto-bookmarks/src/components/BookmarksEditorComponent.jsx
index 2795645..6dcf20f 100644
--- a/packages/volto-bookmarks/src/components/BookmarksEditorComponent.jsx
+++ b/packages/volto-bookmarks/src/components/BookmarksEditorComponent.jsx
@@ -15,9 +15,9 @@ import './volto-bookmarks.css';
import config from '@plone/volto/registry';
function getTitle(queryparams) {
- const searchParamsObject = JSON.parse(queryparams);
+ const searchParamsObject = new URLSearchParams(queryparams);
- let query = searchParamsObject['query'];
+ let query = searchParamsObject.get('query');
// default search block
if (query && query.length > 0) {
@@ -43,8 +43,8 @@ function getTitle(queryparams) {
// searchkit block of volto-searchkit-block
let title_array = [];
- query = searchParamsObject['q'];
- let filters = searchParamsObject['f'];
+ query = searchParamsObject.get('q');
+ let filters = searchParamsObject.getAll('f');
let section = '';
if (query && query[0].length) {
@@ -85,7 +85,6 @@ function getTitle(queryparams) {
search_bookmark_title = section
? `${section}: ${search_bookmark_title}`
: search_bookmark_title;
-
return search_bookmark_title;
}
diff --git a/packages/volto-bookmarks/src/components/EventListenerSearchkitSearch.jsx b/packages/volto-bookmarks/src/components/EventListenerSearchkitSearch.jsx
index e127847..d6ea535 100644
--- a/packages/volto-bookmarks/src/components/EventListenerSearchkitSearch.jsx
+++ b/packages/volto-bookmarks/src/components/EventListenerSearchkitSearch.jsx
@@ -3,11 +3,11 @@ import { useDispatch } from 'react-redux';
import { getAllBookmarks } from '@plone-collective/volto-bookmarks/actions';
+// event handler for searchkitQueryChanged event of package react-searchkit
const EventListenerSearchkitSearch = () => {
const dispatch = useDispatch();
function searchOnUrlQueryStringChanged(event) {
- // event handler for searchkitQueryChanged event of package react-searchkit
dispatch(getAllBookmarks());
}
diff --git a/packages/volto-bookmarks/src/components/MenuItem.jsx b/packages/volto-bookmarks/src/components/MenuItem.jsx
index fd6e679..d82b873 100644
--- a/packages/volto-bookmarks/src/components/MenuItem.jsx
+++ b/packages/volto-bookmarks/src/components/MenuItem.jsx
@@ -12,7 +12,6 @@ import {
deleteBookmark,
getAllBookmarks,
} from '@plone-collective/volto-bookmarks/actions';
-import { generateSearchQueryParamsString } from '@plone-collective/volto-bookmarks/helpers';
const messages = defineMessages({
title_bookmarks: {
@@ -44,25 +43,17 @@ const MenuItem = ({ intl, item }) => {