django-cms / djangocms-alias

Other
7 stars 23 forks source link

[feat] Name placeholder of static alias like the static alias #228

Open fsbraun opened 4 months ago

fsbraun commented 4 months ago

This issue has been raised by Tow Cowan on Slack and @petrklus:

I used static_placeholder to allow site-wide content to be edited, and could control the plugins used in this with the CMS_PLACEHOLDER_CONF setting. I’m now using v4 for a new project - am I able to do something similar with the static_alias tag? I don’t seem to be able to do so with the configuration I’ve tried. For example, if I have the following in my base.html template (outside of any blocks):

{% static_alias 'banner' %}

And then the following in my settings:

CMS_PLACEHOLDER_CONF = {
    "banner": {
        "plugins": ["BannerPlugin"],
    },
}

When I view the Alias (Django Admin -> Django CMS Alias -> Aliases -> Preview) and then try to add a plugin, it ignores the above placeholder config. If I add a key for a “content” placeholder in CMS_PLACEHOLDER_CONF it does allow me to configure the available plugins, but this would mean that all of my static_alias tags would have the same configuration.

aacimov commented 4 months ago

Also, when using the template system it would be very helpful to have the ability to contextually show different markup regarding the static_alias, as with static_placeholders in v3, e.g:

{% if static_alias_name == 'Static Alias 1' %}
    <div class="static_alias_1_wrap"></div>
{% elif static_alias_name == 'Static Alias 2' %}
    <div class="static_alias_2_wrap"></div>
{% else %}
    <div class="static_alias_default_wrap"></div>
{% endif %}
aacimov commented 3 months ago

Hey @evill33t actually I did exactly the same to achieve the wanted behaviour but dealing with clients is the main cause I asked for the "old fashion" behaviour since they usually expect something to be added and just work OOTB (without selecting the actual template).

Thanks for the heads-up though.

evill33t commented 3 months ago

I deleted my comment, I was wrong about the template - imho it should be able to choose different slots which would solve this issue.

fsbraun commented 3 months ago

There's a basic design problem here:

My best assessment is that one could: