-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
A new Contao backend #2697
base: 5.x
Are you sure you want to change the base?
A new Contao backend #2697
Conversation
I would suggest to create two separate issues for that, wdyt? |
While I agree that we shouldn't mix these topics when discussing, IMHO the technical part is the needed groundwork for (any) design rework.So maybe we should focus on this first before we start a second discussion. |
To give the discussion a direction, there are four things to discuss (in that order):
Let us find a consensus on the first point and proceed then. |
I think we should put the discussion on a higher non tech level. Imho one of the biggest problems of the core development is the technical focus but the contaos admin control panel isn't for developers only. So one of the first questions should be "Who are our consumers and what are their needs"? |
Thank you very much for your ideas. It looks and sounds great. The biggest disadvantages of the current backend are the missing ajax features. This and some other reasons result in a too slow and too laborious work in many situations. Other CMS are much further in this regard. A backend search is a very good feature... Chapeau! A toolbar with the last used backend dialogs whould be interesting too. I often jump between five or six dialogs in several situations. |
d56812f
to
e66e241
Compare
b756f5b
to
1231332
Compare
In order to simplify this PR and make changes as smooth as possible, I made the following assumptions and changes: Assumptions:
Further PRs therefore should:
Dependencies: |
I made some thoughts on how we can enhance the Contao backend and evolve a powerful ecosystem. First of all, I want to present my list of requirements that helps understanding why I decided on certain things.
Requirements and decision on the concept
Methods
This PR is a progressive enhancement. At the moment, the “old backend modules” are not touched and are just being outputted in the page layout. We will slowly introduce a new backend ecosystem. Next is a rework of the DC and the request framework.
Design
(Subject to change. The search won't be part of this PR.)
Design decisions
The white background on the
<main>
controller was removed from the be_main template and moved to an atomic template. This allows designing backend modules with a custom design.I will create multiple templates that support different design cases:
I will provide a style guide if the time comes.
I am very enthusiastic about this. The new backend will allow us to build customized backends.
And, there is a dark mode as well 🌚 It can be toggled with adding the CSS class
dark
to the page. We then can trigger the dark mode with a toggle, per user config and per browser settings (with some JS).Why I chose a utility-first CSS framework
TailwindCSS offers a range of crucial benefits, but most importantly Maintainability and Extendability.
I know that some are no big fan of CSS frameworks like Tailwind. However, we need to talk about alternatives then. We need to discuss how other design system choices can handle our criteria, i.e., the maintainability and extendability concerns as good as TailwindCSS does.
Some blog posts help to understand utility-first CSS frameworks:
As most custom themes want to modify the template nonetheless (e.g., to add a logo or whatsoever), coupling the design system with the HTML just makes sense here.
Features
Create a reusable backend-theme
Backend theme developers have to make use of Encore. Internally, we are using Encore Twig functions to insert the correct file assets of the current theme on the page:
Theme designers, therefore, define their webpack config and put the dist files in the public folder of the bundle.
Theme designers then add their backend theme to the registry and they are ready to go. The theme is selectable in the backend.
They also need to tell Contao where to find the
entrypoints.json
to include the assets from.Change color palette with CSS variables
You don't need to build a custom theme for changing the colors or standard variables. You can add a custom CSS file and easily override the color palette by making use of CSS variables.
Build the backend locally
For backend themes built locally, you need to use Encore as well. You need to set the local theme path in the config:
Also, you need to set-up Encore correctly. You can see that the "output path" matches the path above.
I created a tailwind preset that allows loading the Contao config (colors etc.).
More details are available under https://github.com/richardhj/contao-backend-test-installation/blob/main/README.md.
Set a theme globally for all users
One can set an already installed backend theme for all users globally. This disables the
select
in the user profile.Test installation
I set-up a test installation to test all new features: https://github.com/richardhj/contao-backend-test-installation.
When working on this PR we should split the discussions into two parts: a technical part a design part.
Dependencies / Future
This PR softly depends on #2638 (official Twig support). Multi-inheritance is crucial in the concern of extendability.
In the near future, we want to address more issues:
In the long-term future, there are other things to do:
Acknowledgments
I like to thank @m-vo and @may17 for their feedback and enthusiasm.
Notes on BC:
When a non-standard backend theme (other than "flexible") is used, the old theme should be used.(BC removed for Contao 5)When a customized(BC removed for Contao 5)be_main.html
is detected, the old theme should be used.All compatibility changes will be noted here.
headerMenu
was changed significantly. Some menu items were removed from this menu. Those items were added to the newuserMenu
. The oldheaderMenu
Knp menu contained HTML as labels (<button type="button" id="burger">
) which is fixed now.parseTemplate
hook won't work for thebe_main.html5
template anymore, since it's not used anymore (besides the BC layer is active).No other compatibility issues expected.
Deprecations
$GLOBALS['TL_CSS']
and$GLOBALS['TL_JAVASCRIPT']
keeps being supported for now, however adding them to BackendTemplate will be deprecated (the whole be_main.html is deprecated).BackendThemes
service with its methodgetThemeNames()
will return only "new" backend themes registered in the container.fullscreen
option is removed from the user settings.TODO
contao_backend_link_tags()
twig function$GLOBALS['TL_CSS']
and JAVASCRIPT should be rendered withincontao_backend_link_tags()
twig function{% blocks %}
) for easier extendabilitycontao.backend.theme
), the select field in the profile settings is disabled. Do we want to let users override the backend theme even if a global theme is set?