Install the frontend#
Add @plone-collective/volto-polls to a Volto project.
Without it the backend stores polls, but nobody can see or vote in them: the poll view, the Poll block, and the options widget all come from the frontend add-on.
Do Install the backend first.
Requirements#
Volto |
19 |
Package manager |
pnpm |
Add the add-on#
A Cookieplone project has an add-on package of its own under frontend/packages/, and that package is where a project's add-ons are declared.
Volto loads it from volto.config.js, and everything it names comes with it, so volto.config.js is not edited here.
Edit
frontend/packages/<your-addon>/package.json, naming@plone-collective/volto-pollsin both keys.{ "addons": [ "@plone-collective/volto-polls" ], "dependencies": { "@plone-collective/volto-polls": "*" } }
The two do different jobs, and one without the other fails quietly.
dependenciesis what fetches the package.addonsis what Volto reads to register it: an add-on only independenciesis installed and never loaded, so polls have no view and there is no Poll block.Install.
make frontend-installOr from the frontend directory.
cd frontend && make install
Start.
make frontend-startOr.
cd frontend && make start
Verify#
Open any poll on the frontend. It shows its options, and a Vote button while it is open.
If the page shows no options and no Vote button, the add-on is not registered.
Check that it is in the addons key of your add-on's package.json, not only in dependencies, and re-run make frontend-install.
Then edit a page, and check that Poll is in the list of blocks.
What the add-on registers#
Piece |
Is |
|---|---|
Poll view |
The default view of the |
Poll block |
The |
|
Edits a poll's options. |
Content icon |
A bar chart for the Poll type. |
|
Components a project can replace. |
The full surface is in Frontend components.
Next steps#
Run your first poll: create, open, and close a poll.
Show a poll in a page: show polls with the Poll block.
Customize the frontend: replace how polls look.