Skip to content

Commit 47a00b5

Browse files
authored
Merge pull request #3 from codesyntax/develop
Develop
2 parents ea7d0d8 + 25b1e18 commit 47a00b5

File tree

127 files changed

+3364
-770
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+3364
-770
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,30 @@ jobs:
2828
python-version: ${{ needs.config.outputs.python-version }}
2929
plone-version: ${{ needs.config.outputs.plone-version }}
3030

31+
i18n:
32+
name: "Missing i18n:translate"
33+
runs-on: ubuntu-latest
34+
needs:
35+
- config
36+
37+
steps:
38+
- uses: actions/checkout@v5
39+
- name: Install uv
40+
uses: astral-sh/setup-uv@v6
41+
42+
- name: Check for untranslated strings
43+
shell: bash
44+
run: |
45+
uvx i18ndude find-untranslated -n src/
3146
test:
3247
name: "Backend: Test"
3348
needs:
3449
- config
3550
uses: plone/meta/.github/workflows/backend-pytest.yml@2.x
3651
strategy:
3752
matrix:
38-
python-version: ['3.10', '3.11', '3.12', '3.13']
39-
plone-version: ['6.1-latest', '6.0-latest']
53+
python-version: ["3.10", "3.11", "3.12", "3.13"]
54+
plone-version: ["6.1-latest", "6.0-latest"]
4055
with:
4156
python-version: ${{ matrix.python-version }}
4257
plone-version: ${{ matrix.plone-version }}

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Contributors
22

33
- Lur Ibargutxi [libargutxi@codesyntax.com]
4+
- Mikel Larreategi [mlarreategi@codesyntax.com]

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cs_dynamicpages Copyright 2025, Lur Ibargutxi
1+
cs_dynamicpages Copyright 2025, CodeSyntax
22

33
This program is free software; you can redistribute it and/or
44
modify it under the terms of the GNU General Public License version 2

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ requirements-mxdev.txt: pyproject.toml mx.ini ## Generate constraints file
5454

5555
$(VENV_FOLDER): requirements-mxdev.txt ## Install dependencies
5656
@echo "$(GREEN)==> Install environment$(RESET)"
57-
@uv venv --python=3.10 $(VENV_FOLDER)
57+
@uv venv $(VENV_FOLDER)
5858
@uv pip install -r requirements-mxdev.txt
5959

6060
.PHONY: sync
@@ -131,4 +131,10 @@ test-coverage: $(VENV_FOLDER) ## run tests with coverage
131131

132132
## Add bobtemplates features (check bobtemplates.plone's documentation to get the list of available features)
133133
add: $(VENV_FOLDER)
134-
/home/lur/plonecli_azkena/bin/plonecli add $(filter-out $@,$(MAKECMDGOALS))
134+
@uvx plonecli add -b .mrbob.ini $(filter-out $@,$(MAKECMDGOALS))
135+
136+
.PHONY: release
137+
release: $(VENV_FOLDER) ## Create a release
138+
@echo "$(GREEN)==> Create a release$(RESET)"
139+
@uv pip install -e ".[release]"
140+
@uv run fullrelease

README.md

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,53 @@
11
# cs_dynamicpages
22

3-
An addon to create dynamic pages for Plone
3+
A new addon for Plone to create web-based dynamic pages.
44

5-
## Features
5+
The concept is pretty similar that of Volto blocks:
66

7-
TODO: List our awesome features
7+
- You can build a page using reusable items.
8+
- Each item can have different fields
9+
- Each item can have different views
10+
11+
## Provided Content Types
12+
13+
- DynamicPageFolder: this content type will be created in a given folder, and will be the container
14+
where all the rows will be added.
15+
16+
- DynamicPageRow: this content type will be the one that will be rendered in a separate row in the view
17+
18+
- DynamicPageRowFeatured: this content type can be used to save static information that can be shown in a
19+
row. For instance: each of the items of a slider need a title, a description or an image. They can be added
20+
using this content-type
21+
22+
## Provided View
23+
24+
There is just one view `dynamic_view` registered for Folders and Naviation roots
25+
26+
### Different fields
27+
28+
To provide different fields, you should register standard `behaviors` to the `DynamicPageRow`
29+
content type.
30+
31+
### Custom views
32+
33+
To provide different views, you should register standard views (using `zcml`).
34+
35+
Those views must be registered for implementers of `cs_dynamicpages.content.dynamic_page_row.IDynamicPageRow`
36+
and their name _must_ start by `cs_dynamicpages-`.
37+
38+
To ease installation of such views in your products, `cs_dynamicpages.utils` contains 2 utility functions:
39+
40+
- `add_custom_view`: function to add a given view to the list of available row types
41+
- `enable_behavior`: function to enable the given behavior in the `DynamicPageRow` content type
42+
43+
### Restrict fields in the row edit view
44+
45+
You may register several behaviors for `DynamicPageRow` objects but only use some of the fields
46+
provided by them in a given view.
47+
48+
You can restrict which fields are shown in the edit form of the `DynamicPageRow` going to the
49+
Dynamic Pages Controlpanel, and setting there the list of fields that will be shown when editing
50+
each of the row types.
851

952
## Installation
1053

@@ -22,23 +65,23 @@ make create-site
2265

2366
## Contribute
2467

25-
- [Issue tracker](https://github.com/cs/cs_dynamicpages/issues)
26-
- [Source code](https://github.com/cs/cs_dynamicpages/)
68+
- [Issue tracker](https://github.com/codesyntax/cs_dynamicpages/issues)
69+
- [Source code](https://github.com/codesyntax/cs_dynamicpages/)
2770

2871
### Prerequisites ✅
2972

30-
- An [operating system](https://6.docs.plone.org/install/create-project-cookieplone.html#prerequisites-for-installation) that runs all the requirements mentioned.
31-
- [uv](https://6.docs.plone.org/install/create-project-cookieplone.html#uv)
32-
- [Make](https://6.docs.plone.org/install/create-project-cookieplone.html#make)
33-
- [Git](https://6.docs.plone.org/install/create-project-cookieplone.html#git)
34-
- [Docker](https://docs.docker.com/get-started/get-docker/) (optional)
73+
- An [operating system](https://6.docs.plone.org/install/create-project-cookieplone.html#prerequisites-for-installation) that runs all the requirements mentioned.
74+
- [uv](https://6.docs.plone.org/install/create-project-cookieplone.html#uv)
75+
- [Make](https://6.docs.plone.org/install/create-project-cookieplone.html#make)
76+
- [Git](https://6.docs.plone.org/install/create-project-cookieplone.html#git)
77+
- [Docker](https://docs.docker.com/get-started/get-docker/) (optional)
3578

3679
### Installation 🔧
3780

3881
1. Clone this repository, then change your working directory.
3982

4083
```shell
41-
git clone git@github.com:cs/cs_dynamicpages.git
84+
git clone git@github.com:codesyntax/cs_dynamicpages.git
4285
cd cs_dynamicpages
4386
```
4487

@@ -48,7 +91,6 @@ make create-site
4891
make install
4992
```
5093

51-
5294
### Add features using `plonecli` or `bobtemplates.plone`
5395

5496
This package provides markers as strings (`<!-- extra stuff goes here -->`) that are compatible with [`plonecli`](https://github.com/plone/plonecli) and [`bobtemplates.plone`](https://github.com/plone/bobtemplates.plone).
@@ -83,4 +125,4 @@ The project is licensed under GPLv2.
83125

84126
## Credits and acknowledgements 🙏
85127

86-
Generated using [Cookieplone (0.9.7)](https://github.com/plone/cookieplone) and [cookieplone-templates (6782781)](https://github.com/plone/cookieplone-templates/commit/6782781dae4bafb227467828066ab16b84c23750) on 2025-07-07 09:25:15.108762. A special thanks to all contributors and supporters!
128+
Generated using [Cookieplone (0.9.7)](https://github.com/plone/cookieplone) and [cookieplone-templates (4d55553)](https://github.com/plone/cookieplone-templates/commit/4d55553d61416df56b3360914b398d675b3f72a6) on 2025-07-17 11:59:12.982862. A special thanks to all contributors and supporters!

news/+1.internal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Initial release @codesyntax

pyproject.toml

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,55 @@
11
[project]
22
name = "cs_dynamicpages"
33
dynamic = ["version"]
4-
description = "An addon to create dynamic pages for Plone"
4+
description = "A new addon for Plone"
55
readme = "README.md"
6-
license = "GPL-2.0-only"
76
requires-python = ">=3.10"
8-
authors = [
9-
{ name = "Lur Ibargutxi", email = "libargutxi@codesyntax.com" },
10-
]
11-
keywords = [
12-
"CMS",
13-
"Plone",
14-
"Python",
15-
]
7+
authors = [{ name = "CodeSyntax", email = "plone@codesyntax.com" }]
8+
keywords = ["CMS", "Plone", "Python"]
169
classifiers = [
1710
"Development Status :: 3 - Alpha",
1811
"Environment :: Web Environment",
19-
"Framework :: Plone","Framework :: Plone :: 6.0","Framework :: Plone :: 6.1",
12+
"Framework :: Plone",
13+
"Framework :: Plone :: 6.0",
14+
"Framework :: Plone :: 6.1",
2015
"Framework :: Plone :: Addon",
2116
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
2217
"Operating System :: OS Independent",
23-
"Programming Language :: Python","Programming Language :: Python :: 3.10","Programming Language :: Python :: 3.11","Programming Language :: Python :: 3.12","Programming Language :: Python :: 3.13",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
2423
]
2524
dependencies = [
2625
"Products.CMFPlone",
2726
"plone.api",
28-
"z3c.jbot",
2927
"collective.z3cform.datagridfield",
28+
"plone.app.upgrade",
3029
]
3130

3231
[project.optional-dependencies]
3332
test = [
3433
"horse-with-no-namespace",
3534
"plone.app.testing",
36-
"plone.classicui","plone.restapi[test]",
35+
"plone.app.contenttypes[test]",
36+
"plone.classicui",
37+
"plone.restapi[test]",
3738
"pytest",
3839
"pytest-cov",
3940
"pytest-plone>=0.5.0",
4041
]
42+
release = [
43+
"zest.releaser[recommended]",
44+
"zestreleaser.towncrier",
45+
"zest.pocompile",
46+
]
4147

4248
[project.urls]
43-
Homepage = "https://github.com/cs/cs_dynamicpages"
49+
Homepage = "https://github.com/codesyntax/cs_dynamicpages"
4450
PyPI = "https://pypi.org/project/cs_dynamicpages"
45-
Source = "https://github.com/cs/cs_dynamicpages"
46-
Tracker = "https://github.com/cs/cs_dynamicpages/issues"
51+
Source = "https://github.com/codesyntax/cs_dynamicpages"
52+
Tracker = "https://github.com/codesyntax/cs_dynamicpages/issues"
4753

4854

4955
[project.entry-points."plone.autoinclude.plugin"]
@@ -63,9 +69,7 @@ build-backend = "hatchling.build"
6369
strict-naming = true
6470

6571
[tool.hatch.build.targets.sdist]
66-
exclude = [
67-
"/.github",
68-
]
72+
exclude = ["/.github"]
6973

7074
[tool.hatch.build.targets.wheel]
7175
packages = ["src/cs_dynamicpages"]
@@ -76,7 +80,7 @@ filename = "CHANGELOG.md"
7680
start_string = "<!-- towncrier release notes start -->\n"
7781
title_format = "## {version} ({project_date})"
7882
template = "news/.changelog_template.jinja"
79-
issue_format = "[#{issue}](https://github.com/cs/cs_dynamicpages/issues/{issue})"
83+
issue_format = "[#{issue}](https://github.com/collective/cs_dynamicpages/issues/{issue})"
8084
underlines = ["", "", ""]
8185

8286
[[tool.towncrier.type]]
@@ -131,7 +135,8 @@ lint.select = [
131135
# mccabe
132136
"C90",
133137
# pycodestyle
134-
"E", "W",
138+
"E",
139+
"W",
135140
# pyflakes
136141
"F",
137142
# pygrep-hooks
@@ -168,6 +173,8 @@ testpaths = ["tests"]
168173
source_pkgs = ["cs_dynamicpages", "tests"]
169174
branch = true
170175
parallel = true
171-
omit = [
172-
"src/cs_dynamicpages/locales/*.py",
173-
]
176+
omit = ["src/cs_dynamicpages/locales/*.py"]
177+
178+
179+
[tool.zest-releaser]
180+
python-file-with-version = "src/cs_dynamicpages/__init__.py"

src/cs_dynamicpages/behaviors/configure.zcml

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,33 @@
1313

1414
<!-- -*- extra stuff goes here -*- -->
1515

16-
<plone:behavior
17-
name="cs_dynamicpages.row_width"
18-
title="RowWidth"
19-
description="This behavior provides..."
20-
provides=".row_width.IRowWidth"
21-
factory=".row_width.RowWidth"
22-
marker=".row_width.IRowWidthMarker"
23-
/>
24-
25-
26-
<plone:behavior
27-
name="cs_dynamicpages.row_columns"
28-
title="RowColumns"
29-
description="This behavior provides..."
30-
provides=".row_columns.IRowColumns"
31-
factory=".row_columns.RowColumns"
32-
marker=".row_columns.IRowColumnsMarker"
33-
/>
16+
<plone:behavior
17+
name="cs_dynamicpages.row_width"
18+
title="RowWidth"
19+
description="This behavior provides..."
20+
factory=".row_width.RowWidth"
21+
provides=".row_width.IRowWidth"
22+
marker=".row_width.IRowWidthMarker"
23+
/>
24+
25+
<plone:behavior
26+
name="cs_dynamicpages.extra_class"
27+
title="ExtraClass"
28+
description="This behavior provides..."
29+
factory=".extra_class.ExtraClass"
30+
provides=".extra_class.IExtraClass"
31+
marker=".extra_class.IExtraClassMarker"
32+
/>
33+
34+
35+
<plone:behavior
36+
name="cs_dynamicpages.row_columns"
37+
title="RowColumns"
38+
description="This behavior provides..."
39+
factory=".row_columns.RowColumns"
40+
provides=".row_columns.IRowColumns"
41+
marker=".row_columns.IRowColumnsMarker"
42+
/>
3443

3544

3645
<plone:behavior
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from cs_dynamicpages import _
2+
from plone import schema
3+
from plone.autoform.interfaces import IFormFieldProvider
4+
from plone.supermodel import model
5+
from Products.CMFPlone.utils import safe_hasattr
6+
from zope.component import adapter
7+
from zope.interface import implementer
8+
from zope.interface import Interface
9+
from zope.interface import provider
10+
11+
12+
class IExtraClassMarker(Interface):
13+
pass
14+
15+
16+
@provider(IFormFieldProvider)
17+
class IExtraClass(model.Schema):
18+
""" """
19+
20+
extra_class = schema.TextLine(
21+
title=_("Extra CSS class"),
22+
description=_("Enter an extra CSS class that will be added to the row"),
23+
required=False,
24+
)
25+
26+
27+
@implementer(IExtraClass)
28+
@adapter(IExtraClassMarker)
29+
class ExtraClass:
30+
def __init__(self, context):
31+
self.context = context
32+
33+
@property
34+
def extra_class(self):
35+
if safe_hasattr(self.context, "extra_class"):
36+
return self.context.extra_class
37+
return None
38+
39+
@extra_class.setter
40+
def extra_class(self, value):
41+
self.context.extra_class = value

0 commit comments

Comments
 (0)