Skip to content

Commit 3826707

Browse files
authored
Merge branch '6-dev' into search_feature
2 parents 2463cec + d772063 commit 3826707

File tree

14 files changed

+587
-22
lines changed

14 files changed

+587
-22
lines changed

.github/workflows/build_deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- name: Install dependencies
2020
run: |
21-
python -m pip install --upgrade pip
21+
pip install -q -r requirements-initial.txt
2222
pip install -q -r requirements.txt
2323
pip freeze
2424

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- name: Install dependencies
2020
run: |
21-
python -m pip install --upgrade pip
21+
pip install -q -r requirements-initial.txt
2222
pip install -q -r requirements.txt
2323
sudo snap install --edge vale
2424

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ distclean: ## Clean docs build directory and Python virtual environment
3636

3737
bin/python:
3838
python3 -m venv . || virtualenv --clear --python=python3 .
39-
bin/python -m pip install --upgrade pip
39+
bin/pip install -r requirements-initial.txt
4040
bin/pip install -r requirements.txt
4141

4242
docs/plone.api:
@@ -189,7 +189,7 @@ linkcheck: deps ## Run linkcheck
189189

190190
.PHONY: linkcheckbroken
191191
linkcheckbroken: deps ## Run linkcheck and show only broken links
192-
cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck | grep -wi "broken\|redirect" | GREP_COLORS='0;31' grep -vi "https://github.com/plone/volto/issues/" --color=auto || test $$? = 1
192+
cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck | GREP_COLORS='0;31' grep -wi "broken\|redirect" --color=always | GREP_COLORS='0;31' grep -vi "https://github.com/plone/volto/issues/" --color=always && if test $$? = 0; then exit 1; fi || test $$? = 1
193193
@echo
194194
@echo "Link check complete; look for any errors in the above output " \
195195
"or in $(BUILDDIR)/linkcheck/ ."
@@ -226,6 +226,7 @@ livehtml: deps ## Rebuild Sphinx documentation on changes, with live-reload in
226226

227227
.PHONY: netlify
228228
netlify:
229+
pip install -r requirements-initial.txt
229230
pip install -r requirements.txt
230231
pip install -r requirements-netlify.txt
231232
git submodule init; \

docs/backend/behaviors.md

Lines changed: 355 additions & 4 deletions
Large diffs are not rendered by default.

docs/classic-ui/portlets.md

Lines changed: 195 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,204 @@
11
---
22
myst:
33
html_meta:
4-
"description": ""
5-
"property=og:description": ""
6-
"property=og:title": ""
7-
"keywords": ""
4+
"description": "Basic information about portlets in classic UI"
5+
"property=og:description": "Basic information about portlets in classic UI"
6+
"property=og:title": "Portlets"
7+
"keywords": "portlets"
88
---
99

1010
(classic-ui-portlets-label)=
1111

1212
# Portlets
1313

14+
In Plone, a portlet is a small, modular visual element that can be added to a specific area of a web page, such as the right or left columns, or the footer.
15+
Portlets can be used to display a variety of information, such as the latest news, upcoming events, or a list of related documents.
16+
They can also be prepared to store their own set of fields, allowing users to add custom content to the portlet.
17+
Portlets are typically used to provide relevant information to users in the context of the current page, hierarchy, user, or group.
18+
19+
Inheritance of Plone portlets allows for the automatic display of portlets in child items within the content hierarchy.
20+
This means that if a portlet is set on a parent folder, all child items within that folder will automatically display the portlet unless it is explicitly blocked.
21+
This can be useful for displaying consistent information throughout a section of the website, without having to individually set the portlet on each child item.
22+
The inheritance of portlets can be overridden at any level of the content hierarchy, allowing for fine-grained control over the display of portlets on the website.
23+
24+
Portlets are highly customizable and can be used to display a wide variety of information.
25+
They can be added, removed, or rearranged on a web page by users with the appropriate permissions, allowing for a high degree of flexibility in the layout and content of a Plone site.
26+
27+
Plone comes with several built-in portlets, such as the news portlet, the events portlet, and the login portlet.
28+
In addition, developers can create custom portlets to display specific types of information or to provide specific functionality.
29+
30+
## Adding a portlet to a page
31+
32+
As a user, you can add a portlet to a web page in a Plone site by following these steps:
33+
34+
1. Navigate to the web page where you want to add the portlet.
35+
36+
2. Click on the {guilabel}`Manage portlets` link in the toolbar of the page and select the region on the page to modify.
37+
This will open the screen to manage portlets for the current item.
38+
39+
Note that you must have the appropriate permissions to add portlets to a web page.
40+
If you do not see the {guilabel}`Manage portlets` link, you may need to contact the site administrator to request access.
41+
42+
3. In the {menuselection}`Add portlets` menu, select the portlet type that you want to add, and click the {guilabel}`Add` button.
43+
This will open a form to edit the settings for the selected portlet type.
44+
45+
4. Click the {guilabel}`Save` button to save your changes and add the portlet to the web page.
46+
This adds the portlet to the list of {guilabel}`Portlets assigned here` on the screen.
47+
48+
5. Use the {guilabel}`Up` and {guilabel}`Down` arrows in the {guilabel}`Assigned portlets` section to change the order in which the portlets will be displayed on the web page.
49+
The {guilabel}`Hide` button will deactivate the portlet.
50+
The {guilabel}`X` button deletes the portlet.
51+
These options will only appear at the root from which the object inherits its settings.
52+
53+
54+
## Writing a custom Portlet
55+
56+
To create a portlet, you will need to write Python classes that define the portlet and its behavior.
57+
This class should subclass the `Portlet` class from the `plone.portlets` package.
58+
59+
Here is an example of a very simple portlet class `my_portlet.py`:
60+
61+
```python
62+
from plone.app.portlets.portlets import base
63+
from plone.portlets.interfaces import IPortletDataProvider
64+
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
65+
from zope import schema
66+
from zope.interface import implementer
67+
68+
69+
class IExamplePortlet(IPortletDataProvider):
70+
"""A portlet that displays a greeting message."""
71+
72+
message = schema.TextLine(
73+
title="Greeting message",
74+
description="The message to display in the portlet.",
75+
required=True,
76+
)
77+
78+
79+
@implementer(IExamplePortlet)
80+
class Assignment(base.Assignment):
81+
"""Portlet assignment."""
82+
83+
def __init__(self, message="Hello World!"):
84+
self.message = message
85+
86+
@property
87+
def title(self):
88+
"""This property is used to give the title of the portlet in the
89+
"manage portlets" screen. Here we use the message as a part of the title.
90+
"""
91+
return f"Greeting: {self.message}"
92+
93+
94+
class Renderer(base.Renderer):
95+
"""Portlet renderer."""
96+
97+
# Define the page template that will be used to render the portlet
98+
template = ViewPageTemplateFile("my_portlet.pt")
99+
100+
def message(self):
101+
"""This method is called by the page template to render the portlet."""
102+
return self.data.message
103+
104+
def render(self):
105+
"""This method is called whenever the portlet is rendered."""
106+
return self.template()
107+
108+
109+
class AddForm(base.AddForm):
110+
"""Portlet add form."""
111+
112+
schema = IExamplePortlet
113+
label = "Add Greeting Portlet"
114+
description = "This portlet displays a greeting."
115+
116+
def create(self, data):
117+
return Assignment(**data)
118+
119+
120+
class EditForm(base.EditForm):
121+
"""Portlet edit form."""
122+
123+
schema = IExamplePortlet
124+
label = "Edit Greeting Portlet"
125+
description = "This portlet displays a greeting."
126+
127+
```
128+
129+
Here is the example for a simple page template `my_portlet.pt`:
130+
131+
```html
132+
<html
133+
xmlns="http://www.w3.org/1999/xhtml"
134+
xmlns:tal="http://xml.zope.org/namespaces/tal"
135+
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
136+
tal:omit-tag=""
137+
>
138+
<div class="card portlet" i18n:domain="my-example">
139+
<div class="card-header">Greeter</div>
140+
141+
<div class="card-body">
142+
<p>${python:view.message()}</p>
143+
</div>
144+
145+
<div class="card-footer portletFooter"></div>
146+
</div>
147+
</html>
148+
```
149+
150+
This portlet class defines a portlet with the title "My Portlet" and the name "my-portlet". When the portlet is rendered, it will use the template file `my_portlet.pt` to generate its HTML output that displays a greeting message.
151+
152+
The message is set when the portlet is added and can be edited in the portlet's edit form.
153+
154+
To register this portlet with Plone, you will need to create a `configure.zcml` file that tells Plone about the portlet.
155+
After a restart, you can add it to a Plone page using the {guilabel}`Manage portlets` screen.
156+
Here is an example `configure.zcml` file that registers the `MyPortlet` class defined above:
157+
158+
```xml
159+
<configure xmlns="http://namespaces.zope.org/zope"
160+
xmlns:browser="http://namespaces.zope.org/browser"
161+
xmlns:plone="http://namespaces.plone.org/plone"
162+
i18n_domain="example.portlet">
163+
164+
<plone:portlet
165+
title="Example Portlet"
166+
description="A portlet that displays a greeting message"
167+
addview="example.portlet.add"
168+
editview="example.portlet.edit"
169+
assignment="example.portlet.Assignment"
170+
renderer="example.portlet.Renderer"
171+
schema="example.portlet.IExamplePortlet"
172+
/>
173+
174+
</configure>
175+
```
176+
177+
This file registers a portlet with the following properties:
178+
179+
Title
180+
: `Example Portlet`
181+
182+
Description
183+
: `A portlet that displays a greeting message`
184+
185+
Add form
186+
: `example.portlet.add`
187+
188+
Edit form
189+
: `example.portlet.edit`
190+
191+
Assignment
192+
: `example.portlet.Assignment`
193+
194+
Renderer
195+
: `example.portlet.Renderer`
196+
197+
Schema
198+
: `example.portlet.IExamplePortlet`
199+
200+
These values should match the corresponding classes and interfaces defined in the example code from the previous example.
201+
202+
This file registers the `MyPortlet` class as a portlet with Plone. It also specifies the portlet's name, title, description, and category.
203+
204+
For more examples of how to write and register portlets, look at the source code of the Plone core package [`plone.app.portlets`](https://github.com/plone/plone.app.portlets), or of other Plone add-ons that include portlets.

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
r"https://github.com/tc39/proposals/blob/HEAD/finished-proposals.md#finished-proposals",
9393
r"https://coveralls.io/repos/github/plone/plone.restapi/badge.svg\?branch=master", # plone.restapi
9494
r"https://github.com/plone/plone.restapi/blob/dde57b88e0f1b5f5e9f04e6a21865bc0dde55b1c/src/plone/restapi/services/content/add.py#L35-L61", # plone.restapi
95+
r"https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-version-10-0", # volto
9596
]
9697
linkcheck_anchors = True
9798
linkcheck_timeout = 10

docs/contributing/setup-build.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Vale also has [integrations](https://vale.sh/docs/integrations/guide/) with vari
4040
Plone documentation uses a file located at the root of the repository, `.vale.ini`, to configure Vale.
4141
This file allows overriding rules or changing their severity.
4242

43-
The Plone Documentation Team selected the [Microsoft Writing Style Guide](https://docs.microsoft.com/en-us/style-guide/welcome/) for its ease of use—especially for non-native English readers and writers—and attention to non-technical audiences.
43+
The Plone Documentation Team selected the [Microsoft Writing Style Guide](https://learn.microsoft.com/en-us/style-guide/welcome/) for its ease of use—especially for non-native English readers and writers—and attention to non-technical audiences.
4444

4545
```{note}
4646
More corrections to spellings and Vale's configuration are welcome by submitting a pull request.

docs/glossary.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,4 +505,21 @@ content rule
505505
trigger
506506
A trigger is an event in Plone that causes the execution of defined actions.
507507
Example triggers include object modified, user logged in, and workflow state changed.
508+
509+
FTI
510+
Factory Type Information
511+
Factory type information (FTI) is responsible for content creation in the portal.
512+
FTI is responsible for the following:
513+
514+
- Which function is called when new content type is added.
515+
- Icons available for content types.
516+
- Creation views for content types.
517+
- Permission and security.
518+
- Whether discussion is enabled.
519+
- Providing the `factory_type_information` dictionary.
520+
This is used elsewhere in the code (often in `__init__.py` of a product) to set the initial values for a ZODB Factory Type Information object (an object in the `portal_types` tool).
521+
522+
```{seealso}
523+
[`FactoryTypeInformation` class source code](https://github.com/zopefoundation/Products.CMFCore/blob/361a30e0c72a15a21f88433b8d5fc49331f36728/src/Products/CMFCore/TypesTool.py#L431)
524+
```
508525
```

docs/install/manage-add-ons-packages.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ This example uses [`collective.easyform`](https://pypi.org/project/collective.ea
171171
collective.easyform
172172
```
173173

174-
Add it to {file}`instance.yml` to let Zope know that this add-on should be loaded:
174+
Add it to {file}`instance.yaml` to let Zope know that this add-on should be loaded:
175175

176176
```{code-block} yaml
177177
:emphasize-lines: 3-6
@@ -217,7 +217,7 @@ Add the add-on to {file}`requirements.txt`:
217217
collective.easyform
218218
```
219219

220-
Add it to {file}`instance.yml` to let Zope know that this add-on should be loaded:
220+
Add it to {file}`instance.yaml` to let Zope know that this add-on should be loaded:
221221

222222
```yaml
223223
default_context:
@@ -261,7 +261,7 @@ branch=dev-branch-name
261261
extras=test
262262
```
263263

264-
Add it to {file}`instance.yml` to let Zope know that this add-on should be loaded:
264+
Add it to {file}`instance.yaml` to let Zope know that this add-on should be loaded:
265265

266266
```yaml
267267
default_context:

requirements-initial.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# From https://dist.plone.org/release/6-latest/constraints.txt
2+
pip==22.3.1
3+
setuptools==65.5.1
4+
wheel==0.38.4

0 commit comments

Comments
 (0)