Closed darbula closed 8 years ago
Unfortunately I have to trick out djangoCMS, because otherwise I would be allowed to add rows and columns directly to the placeholder. This can only be done through your settings. For instance, I use:
CACSCADE_WORKAREA_GLOSSARY = {
'breakpoints': ['xs', 'sm', 'md', 'lg'],
'container_max_widths': {'xs': 750, 'sm': 750, 'md': 970, 'lg': 1170},
'fluid': False,
'media_queries': {
'xs': ['(max-width: 768px)'],
'sm': ['(min-width: 768px)', '(max-width: 992px)'],
'md': ['(min-width: 992px)', '(max-width: 1200px)'],
'lg': ['(min-width: 1200px)'],
},
}
CMS_PLACEHOLDER_CONF = {
'Main Content': {
'plugins': ['BootstrapContainerPlugin', 'BootstrapJumbotronPlugin'],
'text_only_plugins': ['TextLinkPlugin'],
'parent_classes': {'BootstrapContainerPlugin': None, 'BootstrapJumbotronPlugin': None},
'glossary': CACSCADE_WORKAREA_GLOSSARY,
},
...
}
This allows editor to only add the Container and Jumbotron plugin to the
{% placeholder 'Main Content' %}
Thanks @jrief now it is working fine, although it might be good to leave this issue open or to report to django cms since this settings tweak is more or less workaround.
I believe, this is part of the docs, isn't it?
Yes, it most certainly is in the docs here but what is not obvious that if you do not restrict parent classes user wont even be able to add BootstrapContainerPlugin to the placeholder as a root plugin since it wont be on the list of available plugins. This is not intuitive since parent restriction should not have anything to do with showing plugin in placeholder's add plugin list, does it? It shouldnt be on the list only if parent is required but for BootstrapContainerPlugin it is not required. This might be more of a django cms issue?
I agree, this is very unintuitive. If we cannot change it, it definitely needs better documentation.
Maybe the lesser evil is to just let the end-user add the rows and columns? Leave it to the site admin to train them not to do it?
This seems to be the minimal setting that you need:
CMS_PLACEHOLDER_CONF = {
'content': { # The name of your main placeholder.
'parent_classes': {'BootstrapContainerPlugin': None,},
},
}
I added a note to the installation docs. Hopefully, this will be sufficient to prevent new users from running into this.
Using
django-cms==3.3.2
anddjangocms-cascade==0.10.1
BootstrapContainerPlugin
among others, does not show in Add plugin list.This issue can be traced to these two recent changes:
BootstrapContainerPlugin
got itsBootstrapJumbotronPlugin
as parent class here https://github.com/jrief/djangocms-cascade/blob/master/cmsplugin_cascade/bootstrap3/container.py#L42 andSegmentPlugin
andSimpleWrapperPlugin
here https://github.com/jrief/djangocms-cascade/blob/master/cmsplugin_cascade/plugin_base.py#L120 since they inherit fromTransparentMixin
Result is that Bootstrap container is not in the list of plugins that can be added to placeholder.