jrief / djangocms-cascade

Build Single Page Applications using the Django-CMS plugin system
MIT License
165 stars 85 forks source link

display the selected extra css classes of a plugin in structure view #147

Open dhrv opened 8 years ago

dhrv commented 8 years ago

It would be very helpful to display the selected extra css classes of a plugin in the structure view. An example is given in this screenshot:

2016-03-09_17-05-05

jrief commented 8 years ago

Yes, makes sense. I'm a little bit scared about narrow placeholders and large identifiers. Do you think we could implement it via a tooltip?

dhrv commented 8 years ago

I do understand your concern because overflowing text is not wrapping and shortened with ellipsis, but tooltips would not help getting a quick overview of the selected classes/resulting DOM structure.

I see two possible solutions:

While we're on the topic of extra classes, is it possible for extra classes to be shareable between Plugins? The benefit of this would be that common class names only have to be entered once and not manually for every Plugin. Furthermore, if a class name needs to be changed, it automatically updates every Plugin where the class is used. With the current behaviour, if I change the class "myClass" to "myNewClass" in the admin config, the Plugin still uses the old "myClass". I know this is very tricky because of the underlying JSON storage of the cascade plugins, but maybe you see a way to achieve this, if you deem it useful. (Actually, many of the above requests would not be needed if I was able to implement my own plugins the way I want, in this case a flexible Bootstrap4 card plugin, but unfortunately I'm not nearly skilled enough :P)

jrief commented 8 years ago

@rfleschenberg what do you think about this proposal?

rfleschenberg commented 8 years ago

I am fine with showing the extra CSS classes.

About shareable classes: I think we need to be careful not to introduce feature creep. On first thought, it seems to me that implementing your own plugin is the cleaner solution.

Maybe we should make it easier to implement your own plugin?

Maybe all this needs is better documentation?

jrief commented 8 years ago

By inheriting from an existing plugin and overriding classmethod get_identifier, you can render whatever you want. Since that would be a lot of work, how about if I add a hook to that method, so that you can modify all identifiers with one single function.

I still have to rethink about it, and how to make that hook function configurable. Any proposals?