-
-
Notifications
You must be signed in to change notification settings - Fork 176
Adds docs for creating custom control panel #1909 revision #1939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: rohnsha0-control-panel
Are you sure you want to change the base?
Adds docs for creating custom control panel #1909 revision #1939
Conversation
@rohnsha0 one thing that still confuses me are these two headings: Register the control panel viewRegister the control panelWhat's the difference, other than one is in ZCML and the other in XML? |
It register the view (different field in the controlpanel) and once registered can be accessed via given URL directly...
It register the control panel i. e. once registered the control panel appears on the Site Setup screen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Can be merged into the docs
@rohnsha0 thanks for the explanation. I'll push an update, then merge. |
I'm concerned that $ .venv/bin/plonecli add controlpanel
/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/case_conversion/case_conversion.py:202: SyntaxWarning: invalid escape sequence '\c'
"""Return text in backslash\case style.
/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/case_conversion/case_parse.py:28: SyntaxWarning: invalid escape sequence '\p'
upper = regex.compile(u'^[\p{Lu}]$')
/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/case_conversion/case_parse.py:29: SyntaxWarning: invalid escape sequence '\p'
sep = regex.compile(u'^[^\p{Ll}\p{Lu}\p{Nd}]$')
/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/case_conversion/case_parse.py:30: SyntaxWarning: invalid escape sequence '\p'
notsep = regex.compile(u'^[\p{Ll}\p{Lu}\p{Nd}]$')
/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/case_conversion/case_parse.py:97: SyntaxWarning: invalid escape sequence '\p'
valid_acronym = regex.compile(u'^[\p{Ll}\p{Lu}\p{Nd}]+$')
RUN: mrbob bobtemplates.plone:controlpanel
Welcome to mr.bob interactive mode. Before we generate directory structure, some questions need to be answered.
Answer with a question mark to display help.
Values in square brackets at the end of the questions show the default value if there is no answer.
RUN: git status --porcelain --ignore-submodules
git status result:
----------------------------
b'?? docs/project-title/\n?? docs/uv.lock\n?? frontend/pnpm-lock.yaml\n'
--> Please commit your changes, before using a sub-template! Continue anyway? [n/y] [n]: y
--> Name of the Control Panels's Python class? [MyFeaturedControlPanel]:
>>> reading Plone version from bobtemplate.cfg
Traceback (most recent call last):
File "/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/bin/plonecli", line 10, in <module>
sys.exit(cli())
^^^^^
File "/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/click/core.py", line 1719, in invoke
rv.append(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/plonecli/cli.py", line 128, in add
mrbobmain(mrbob_args)
File "/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/mrbob/cli.py", line 175, in main
c.render()
File "/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/mrbob/configurator.py", line 186, in render
render_structure(self.template_dir,
File "/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/.venv/lib/python3.12/site-packages/mrbob/rendering.py", line 95, in render_structure
os.mkdir(abs_dir)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/stevepiercy/projects/Plone/cookieplone-templates/fluffy/backend/backend/controlpanels' And @rohnsha0 reported an issue with what I think is buildout in plone/plonecli#87. We might need to rip out |
@rohnsha0 also I don't think we need to use |
@rohnsha0 did you try the |
@stevepiercy it works everytime! What did u do?! If you could list out the seq |
Ah, Sorry. We can add a note a that ploneclli works only with |
it was something which was related to version pinning. it solved the same by adding a explicit version pin but just listed for tracking purpose! |
i somehow made it work with cookieplone somehow but not tested with |
I did exactly what you documented, using a buildout installation. plonecli add controlpanel Resulted in the following console output. Usage: plonecli add [OPTIONS] TEMPLATE
Try 'plonecli add -h' for help.
Error: The "add" command is only allowed within an existing package. See also what I tried for Cookieplone in #1939 (comment). Clearly there are some steps missing. |
the same i am getting too.. |
…cluding usage in non-add-on projects and detailed steps for manual creation.
We also have nothing for Plone 6 Documentation about how to create a Plone add-on for the backend with https://5.docs.plone.org/search.html?q=plonecli&check_keywords=yes&area=default The first four links are duplicates that point the reader to |
PloneCLI's readme gives some info on how to create a addon (it doesnt use the term "backend addon") but it gives a rough idea on how to create it using the tool. |
@rohnsha0 I added a new page that should separate the concerns of creating a backend add-on and creating a control panel. The latter is actually the creation of a subtemplate. This will change the structure of the control panel file once more. |
- Add reference targets and labels
I've pushed this as far as possible. I was not able to get the control panel to load from the steps I wrote up using |
- You've installed Plone for development through either of the following methods. | ||
|
||
- {doc}`/admin-guide/install-buildout` | ||
- {doc}`/admin-guide/install-pip` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- You've installed Plone for development through either of the following methods. | |
- {doc}`/admin-guide/install-buildout` | |
- {doc}`/admin-guide/install-pip` |
we dont need to have Plone installed for creating a backend addon (it is an optional).
plonecli create addon src/collective.myaddon
creates a backend addon, changing the directory and running:
plonecli build
builds the addon which can be run and previewed using
plonecli serve
runs the the plone server using classic ui from the Plone Version defined during creation of addon or the .mrbob global config
additionally, we can integrate the same addon using local.cfg
file in buildouts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what I'm doing. Please amend the docs so that a complete idiot (me) who knows nothing about how to create a backend add-on with a control panel can be successful. I've read docs from 5.2, buildout, plonecli, and it's all over the place. There's no cohesive process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont need to have Plone installed for creating a backend addon (it is an optional).
How can you view it in your Site Setup if you don't have Plone installed?
You also did not include any of the above steps in your revision.
I want to take care to avoid "crossing the streams". If readers jump between different procedures and do things in the wrong context, then we're harming them. Any modifications need to flow well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rohnsha0 does your comment and suggestion still apply? Please reply or resolve this comment. Thank you!
…importing the Generic Profile and clarifying buildout steps.
@stevepiercy, I have completed everything from my end and according to me it looks complete! and i have verified everything! and works on my machine... |
There are some updates needed since the recent refactoring of the backend addon template. There's some work in progress in plone/bobtemplates.plone#584 |
Some suggestions:
|
@stevepiercy I'm wondering a bit why this should be in developer guide? |
@MrTango for background and a full explanation, start with PLIP: Plone 7 Documentation Layout, Structure, Theme, and Search to Improve Usability. After reviewing that, if you still have questions, I'm happy to have a call via Discord anytime. I want feedback, especially if it improves and clarifies the PLIP so we're all going in the same direction. Although I targeted Plone 7, I'd love to have it for Plone 6.2 before PloneConf 2025. |
plone/bobtemplates.plone#584 was merged. Let's revisit this PR. |
Ping @rohnsha0. I'd love to get this finished before PloneConf 2025. |
sorry @stevepiercy for being so late for replying.. ill look into this PR in coming days. thanks for the patience ;) |
…ches, prerequisites, and steps for both automated and manual methods.
@stevepiercy I have refined the docs and its structure as per my knowledge... @MrTango, do you have any more things to add?! since last time you were working with |
- Add reference labels and targets, instead of copy-paste - Use correct structural markup instead of cosmetic markup - Add synonym for ZMI to glossary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've completed my revisions of @rohnsha0's revisions.
Could I get another final review from @MrTango, @rohnsha0, @davisagli, and anyone else who may have experience or interest in these two topics? Thank you!
This creates the control panel Python file in the control panel's folder where you can define your control panel schema fields. | ||
It also goes through all the following steps to create a control panel. | ||
|
||
### Using `plonecli` in a non-add-on project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rohnsha0 Why would a developer create either a policy or custom theme package that is not an add-on? Is that the same as hacking on Plone core?
Also why would either a policy or custom theme package need a control panel? I can't think of such a scenario, but maybe you've done this?
- You've installed Plone for development through either of the following methods. | ||
|
||
- {doc}`/admin-guide/install-buildout` | ||
- {doc}`/admin-guide/install-pip` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what I'm doing. Please amend the docs so that a complete idiot (me) who knows nothing about how to create a backend add-on with a control panel can be successful. I've read docs from 5.2, buildout, plonecli, and it's all over the place. There's no cohesive process.
- You've installed Plone for development through either of the following methods. | ||
|
||
- {doc}`/admin-guide/install-buildout` | ||
- {doc}`/admin-guide/install-pip` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont need to have Plone installed for creating a backend addon (it is an optional).
How can you view it in your Site Setup if you don't have Plone installed?
You also did not include any of the above steps in your revision.
I want to take care to avoid "crossing the streams". If readers jump between different procedures and do things in the wrong context, then we're harming them. Any modifications need to flow well.
- You've installed Plone for development through either of the following methods. | ||
|
||
- {doc}`/admin-guide/install-buildout` | ||
- {doc}`/admin-guide/install-pip` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rohnsha0 does your comment and suggestion still apply? Please reply or resolve this comment. Thank you!
@rohnsha0 please take a look at these revisions. I haven't been able to express myself clearly in a review. I think this PR simplifies its structure and makes it flow better. Please let me know. Thank you!
📚 Documentation preview 📚: