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
feat: Headless readiness #7850
base: develop-4
Are you sure you want to change the base?
feat: Headless readiness #7850
Conversation
@fsbraun Great work on this. I would love to see how this works in practise and what we can do with it? |
This PR includes JS and CSS changes to disable UI items in the structure board. Those changes only become visible after running Still, a headless-ready project for testing can be quickly set up using these steps:
The template only installs djangocms-text as plugins but works with any plugins. |
Description
Regular projects distribute their content through serving pages at their corresponding URL as defined in the page tree. This is achieved by adding
path("", include(cms.urls))
to a project'surls.py
. Also, the CMS requiresCMS_TEMPLATES
orCMS_TEMPLATE_DIR
to be set.This PR allows setting up headless-ready projects by:
Not requiring
path("", include(cms.urls))
being part of the projects URLs. All editing is done in the admin and the edit, structure and preview endpoints.The structure endpoint can be used on read-only objects (such as published pages), too, allowing to view the tree and copy plugins. All modifying actions are disabled for read-only objects.
Not requiring any templates to be defined. If no templates are available, all interaction runs through the structure endpoint. While the editing experience might be limited, this can be a fast way of setting up a project.
This PR moves the create wizard URL to the placeholder admin (which contains all editing endpoints) (but also keeps the previous endpoint in
cms.urls
for the wizard for compatibility reasons).The data bridge allows the frontend to update the structure board after changes in the plugin tree. This PR changes the HTML response for changes in the plugin tree from inlining the data in a script to a script tag containing JSON objects which are read and passed to the data bridge.
Related resources
Checklist
develop-4