Skip to content

Commit

Permalink
Merge branch 'main' into mrtango-improve-content_type-template
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTango authored Jun 26, 2024
2 parents f230c63 + b77d6cd commit b01b811
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 10 deletions.
35 changes: 35 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf
- epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
#python:
# install:
# - requirements: docs/requirements.txt
16 changes: 8 additions & 8 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
Changelog
=========

6.3.2 (unreleased)
6.3.3 (unreleased)
------------------

Breaking changes:
- Nothing changed yet.

-

6.3.2 (2024-05-07)
------------------

New features:

-
- Add a starter subtemplate to initialize a Plone site with some sane default values
[erral]


Bug fixes:

Expand All @@ -24,10 +28,6 @@ Bug fixes:
6.3.1 (2023-10-31)
------------------

Breaking changes:

-

New features:

- Add `icon_expr` for `content_type`` view/edit actions and ask for "Content type icon" when adding a `content_type`.
Expand Down
8 changes: 8 additions & 0 deletions bobtemplates/plone/bobregistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,11 @@ def plone_form():
reg.plonecli_alias = "form"
reg.depend_on = "plone_addon"
return reg


def plone_site_initialization():
reg = RegEntry()
reg.template = "bobtemplates.plone:site_initialization"
reg.plonecli_alias = "site_initialization"
reg.depend_on = "plone_addon"
return reg
16 changes: 16 additions & 0 deletions bobtemplates/plone/site_initialization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from bobtemplates.plone.base import base_prepare_renderer
from bobtemplates.plone.base import git_commit
from bobtemplates.plone.base import git_support


def prepare_renderer(configurator):
"""Prepare rendering."""
configurator = base_prepare_renderer(configurator)

configurator.target_directory = configurator.variables["package_folder"]


def post_renderer(configurator):
"""Post rendering."""
if git_support(configurator):
git_commit(configurator, "Add Plone site initialization configuration")
24 changes: 24 additions & 0 deletions bobtemplates/plone/site_initialization/.mrbob.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[questions]
subtemplate_warning.question = Please commit your changes, before using a sub-template! Continue anyway? [N/y]
subtemplate_warning.required = True
subtemplate_warning.default = n
subtemplate_warning.pre_ask_question = bobtemplates.plone.base:git_clean_state_check
subtemplate_warning.post_ask_question = mrbob.hooks:validate_choices bobtemplates.plone.base:subtemplate_warning_post_question
subtemplate_warning.choices = y|n
subtemplate_warning.choices_delimiter = |

language.question = Enter the 2 letter language code for your site
language.help = Shold be something like 'en'
language.required = True
language.default = 'en'

site_name.question = Enter the name of your site
site_name.help = Should be something like 'My new site'
site_name.required = True
site_name.default = New Plone Site


[template]
post_ask = bobtemplates.plone.base:set_global_vars
pre_render = bobtemplates.plone.site_initialization:prepare_renderer
post_render = bobtemplates.plone.site_initialization:post_renderer
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<registry>
<records interface="plone.base.interfaces.controlpanel.IMailSchema" prefix="plone" purge="false">
<value key="email_from_name">{{{ site_name }}}</value>
</records>
</registry>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<registry>
<records interface="plone.base.interfaces.controlpanel.ISiteSchema" prefix="plone" purge="false">
<value key="site_title">{{{ site_name }}}</value>
</records>
</registry>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<registry>
<records interface="plone.i18n.interfaces.ILanguageSchema" prefix="plone" purge="false">
<value key="available_languages">
<element>{{{ language }}}</element>
</value>
<value key="default_language">{{{ language }}}</value>
</records>
</registry>
2 changes: 1 addition & 1 deletion constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Pin Versions / Version Ranges if necessary.
setuptools==57.0.0
tox==4.11.3
isort>=5
isort>=5.12.0
flake8==5.0.4
flake8-html==0.4.2
black==22.8.0
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from setuptools import setup


version = "6.3.2.dev0"
version = "6.3.3.dev0"


long_description = "\n\n".join(
Expand Down Expand Up @@ -90,6 +90,7 @@
"plone_vocabulary = bobtemplates.plone.bobregistry:plone_vocabulary",
"plone_controlpanel = bobtemplates.plone.bobregistry:plone_controlpanel",
"plone_form = bobtemplates.plone.bobregistry:plone_form",
"plone_site_initialization = bobtemplates.plone.bobregistry:plone_site_initialization",
]
},
)

0 comments on commit b01b811

Please sign in to comment.