generated from rohberg/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move components and locales to new location
- Loading branch information
Showing
41 changed files
with
31,759 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,203 +1,134 @@ | ||
# Favorites/bookmarks for Volto (volto-bookmarks) | ||
# volto-bookmarks | ||
|
||
Manage bookmarks / favorites in Plone Volto | ||
<img align="right" width="50" alt="volto-bookmarks" src="./src/icons/bookmark.svg" /> | ||
|
||
[![npm](https://img.shields.io/npm/v/volto-bookmarks)](https://www.npmjs.com/package/volto-bookmarks) | ||
[![](https://img.shields.io/badge/-Storybook-ff4785?logo=Storybook&logoColor=white&style=flat-square)](https://collective.github.io/volto-bookmarks/) | ||
[![Code analysis checks](https://github.com/collective/volto-bookmarks/actions/workflows/code.yml/badge.svg)](https://github.com/collective/volto-bookmarks/actions/workflows/code.yml) | ||
[![Unit tests](https://github.com/collective/volto-bookmarks/actions/workflows/unit.yml/badge.svg)](https://github.com/collective/volto-bookmarks/actions/workflows/unit.yml) | ||
|
||
## Features | ||
|
||
<!-- List your awesome features here --> | ||
|
||
## Installation | ||
|
||
To install your project, you must choose the method appropriate to your version of Volto. | ||
|
||
|
||
### Volto 17 and earlier | ||
|
||
Create a new Volto project (you can skip this step if you already have one): | ||
|
||
``` | ||
npm install -g yo @plone/generator-volto | ||
yo @plone/volto my-volto-project --addon volto-bookmarks | ||
cd my-volto-project | ||
``` | ||
|
||
Add `volto-bookmarks` to your package.json: | ||
|
||
```JSON | ||
"addons": [ | ||
"volto-bookmarks" | ||
], | ||
|
||
"dependencies": { | ||
"volto-bookmarks": "*" | ||
} | ||
``` | ||
|
||
Download and install the new add-on by running: | ||
|
||
``` | ||
yarn install | ||
``` | ||
|
||
Start volto with: | ||
|
||
``` | ||
yarn start | ||
``` | ||
|
||
### Volto 18 and later | ||
|
||
Add `volto-bookmarks` to your `package.json`: | ||
|
||
```json | ||
"dependencies": { | ||
"volto-bookmarks": "*" | ||
} | ||
``` | ||
|
||
Add `volto-bookmarks` to your `volto.config.js`: | ||
|
||
```javascript | ||
const addons = ['volto-bookmarks']; | ||
``` | ||
|
||
If this package provides a Volto theme, and you want to activate it, then add the following to your `volto.config.js`: | ||
|
||
```javascript | ||
const theme = 'volto-bookmarks'; | ||
``` | ||
[Plone (Volto)](https://github.com/plone/volto) add-on | ||
|
||
## Test installation | ||
## Features | ||
|
||
Visit http://localhost:3000/ in a browser, login, and check the awesome new features. | ||
Add and manage bookmarks of pages and searchkit queries. | ||
|
||
Bookmarks are grouped by the value of a selectable content type field. | ||
|
||
## Development | ||
|
||
The development of this add-on is done in isolation using a new approach using pnpm workspaces and latest `mrs-developer` and other Volto core improvements. | ||
For this reason, it only works with pnpm and Volto 18 (currently in alpha). | ||
<img align="right" alt="volto-bookmarks" src="./src/readmeillustration/bookmarks_somewhereelse.png" /> | ||
|
||
## Getting started | ||
|
||
### Pre-requisites | ||
There are two options: | ||
|
||
- [Node.js](https://6.docs.plone.org/install/create-project.html#node-js) | ||
- [Make](https://6.docs.plone.org/install/create-project.html#make) | ||
- [Docker](https://6.docs.plone.org/install/create-project.html#docker) | ||
- Buttons in toolbar | ||
- Buttons somewhere else | ||
|
||
## Installation | ||
|
||
### Make convenience commands | ||
- Provide the necessary REST API endpoints for your Plone backend by installing [collective.bookmarks](https://github.com/collective/collective.bookmarks.git) | ||
|
||
Run `make help` to list the available commands. | ||
- Remember to install souper in Plone backend control panel. | ||
|
||
```text | ||
help Show this help | ||
install Installs the add-on in a development environment | ||
start Starts Volto, allowing reloading of the add-on during development | ||
build Build a production bundle for distribution of the project with the add-on | ||
i18n Sync i18n | ||
ci-i18n Check if i18n is not synced | ||
format Format codebase | ||
lint Lint, or catch and remove problems, in code base | ||
release Release the add-on on npmjs.org | ||
release-dry-run Dry-run the release of the add-on on npmjs.org | ||
test Run unit tests | ||
ci-test Run unit tests in CI | ||
backend-docker-start Starts a Docker-based backend for development | ||
storybook-start Start Storybook server on port 6006 | ||
storybook-build Build Storybook | ||
acceptance-frontend-dev-start Start acceptance frontend in development mode | ||
acceptance-frontend-prod-start Start acceptance frontend in production mode | ||
acceptance-backend-start Start backend acceptance server | ||
ci-acceptance-backend-start Start backend acceptance server in headless mode for CI | ||
acceptance-test Start Cypress in interactive mode | ||
ci-acceptance-test Run cypress tests in headless mode for CI | ||
``` | ||
- Install this Plone (Volto) add-on `@plone-collective/volto-bookmarks`. See [Volto docs](https://6.docs.plone.org/volto/addons/index.html#configuring-a-volto-project-to-use-an-add-on) for instructions. | ||
|
||
### Development environment set up | ||
|
||
Install package requirements. | ||
## Integration of the two bookmark buttons | ||
|
||
```shell | ||
make install | ||
``` | ||
### Option 1 - buttons in toolbar | ||
|
||
### Start developing | ||
> This requires Volto >= 16.10.0 with a pluggable toolbar. | ||
Start the backend. | ||
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. | ||
|
||
```shell | ||
make backend-docker-start | ||
``` | ||
`config.js`: | ||
|
||
In a separate terminal session, start the frontend. | ||
```js | ||
import { Bookmarking } from '@plone-collective/volto-bookmarks/components'; | ||
|
||
```shell | ||
make start | ||
``` | ||
import '@plone/volto/config'; | ||
|
||
### Lint code | ||
|
||
Run ESlint, Prettier, and Stylelint in analyze mode. | ||
|
||
```shell | ||
make lint | ||
export default function applyConfig(config) { | ||
config.settings.appExtras = [ | ||
...config.settings.appExtras, | ||
{ | ||
match: '/', | ||
component: Bookmarking, | ||
}, | ||
]; | ||
return config; | ||
} | ||
``` | ||
|
||
### Format code | ||
|
||
Run ESlint, Prettier, and Stylelint in fix mode. | ||
### Option 2 - buttons not in toolbar, but somewhere else | ||
|
||
```shell | ||
make format | ||
``` | ||
Add the two buttons to components of your choice: | ||
|
||
### i18n | ||
```jsx | ||
import { ShowBookmarksContentButton } from '@plone-collective/volto-bookmarks/components'; | ||
|
||
Extract the i18n messages to locales. | ||
<ShowBookmarksContentButton /> | ||
|
||
```shell | ||
make i18n | ||
``` | ||
|
||
### Unit tests | ||
```jsx | ||
import { ToggleBookmarkButton } from '@plone-collective/volto-bookmarks/components'; | ||
|
||
Run unit tests. | ||
<ToggleBookmarkButton /> | ||
|
||
```shell | ||
make test | ||
``` | ||
|
||
### Run Cypress tests | ||
|
||
Run each of these steps in separate terminal sessions. | ||
### Further configuration for both options | ||
|
||
In the first session, start the frontend in development mode. | ||
Add a mapping for bookmark groups labels and the name of the field for grouping bookmarks list. | ||
|
||
```shell | ||
make acceptance-frontend-dev-start | ||
```js | ||
config.settings.bookmarks = { | ||
...config.settings.bookmarks, | ||
bookmarkgroupmapping: { | ||
manual: 'Manuals and HowTos', | ||
releasenote: 'Release Notes', | ||
default_search: 'Search', | ||
default_nogroup: 'Miscellaneous', | ||
}, | ||
bookmarkgroupfield: '@type', | ||
}; | ||
``` | ||
|
||
In the second session, start the backend acceptance server. | ||
Add a mapping for search filters: | ||
|
||
```shell | ||
make acceptance-backend-start | ||
```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', | ||
}, | ||
}, | ||
``` | ||
|
||
In the third session, start the Cypress interactive test runner. | ||
<img align="right" width="50" alt="volto-bookmarks" src="./src/icons/bookmark.svg" /> | ||
|
||
```shell | ||
make acceptance-test | ||
``` | ||
|
||
## License | ||
## Copyright and License | ||
|
||
The project is licensed under the MIT license. | ||
Author Katja Süss, Rohberg, @ksuess | ||
https://www.rohberg.ch | ||
|
||
## Credits and Acknowledgements 🙏 | ||
Copyright (c) 2023 Plone Foundation | ||
|
||
Crafted with care by **Generated using [Cookieplone (0.8.1)](https://github.com/plone/cookieplone) and [cookiecutter-plone (d9b5293)](https://github.com/plone/cookiecutter-plone/commit/d9b52933cbc6efd137e93e35a270214e307359f0) on 2025-01-07 15:59:50.437263**. A special thanks to all contributors and supporters! | ||
See [LICENSE.md](https://github.com/collective/volto-bookmarks/blob/master/LICENSE.md) for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
build | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"plugins": { | ||
"../../core/packages/scripts/prepublish.js": {} | ||
}, | ||
"hooks": { | ||
"after:bump": [ | ||
"pipx run towncrier build --draft --yes --version ${version} > .changelog.draft", | ||
"pipx run towncrier build --yes --version ${version}", | ||
"cp ../../README.md ./ && cp CHANGELOG.md ../../CHANGELOG.md", | ||
"python3 -c 'import json; data = json.load(open(\"../../package.json\")); data[\"version\"] = \"${version}\"; json.dump(data, open(\"../../package.json\", \"w\"), indent=2)'", | ||
"git add ../../CHANGELOG.md ../../package.json" | ||
], | ||
"after:release": "rm .changelog.draft README.md" | ||
}, | ||
"npm": { | ||
"publish": false | ||
}, | ||
"git": { | ||
"changelog": "pipx run towncrier build --draft --yes --version 0.0.0", | ||
"requireUpstream": false, | ||
"requireCleanWorkingDir": false, | ||
"commitMessage": "Release ${version}", | ||
"tagName": "${version}", | ||
"tagAnnotation": "Release ${version}" | ||
}, | ||
"github": { | ||
"release": true, | ||
"releaseName": "${version}", | ||
"releaseNotes": "cat .changelog.draft" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Changelog | ||
|
||
<!-- You should *NOT* be adding new change log entries to this file. | ||
You should create a file in the news directory instead. | ||
For helpful instructions, please see: | ||
https://6.docs.plone.org/volto/developer-guidelines/contributing.html#create-a-pull-request | ||
--> | ||
|
||
<!-- towncrier release notes start --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = function (api) { | ||
api.cache(true); | ||
const presets = ['razzle']; | ||
const plugins = [ | ||
[ | ||
'react-intl', // React Intl extractor, required for the whole i18n infrastructure to work | ||
{ | ||
messagesDir: './build/messages/', | ||
}, | ||
], | ||
]; | ||
|
||
return { | ||
plugins, | ||
presets, | ||
}; | ||
}; |
File renamed without changes.
Oops, something went wrong.