Closed haricot closed 3 years ago
From my point of view, this shall behave like a non-nullable database field, ie. always having a value. If someone whats to use that fields with an optional color, he's free to set inherit_color=True
. So I wouldn't want to change that.
The behavior changed, before, initial inherit was equal to true, this suited me well because I tended not to use the admin view "Select Custom CSS classes and styles to change" because I did not think it could be merged with the settings. Let's say that it allowed to offer the option even if we don't necessarily use it, I understand that it is not optimal. I see that issue https://github.com/jrief/djangocms-cascade/issues/346 takes on all its meaning.
If we add an extra field colors to the column plugin, for example, this will add the color option to all the columns of the site, which will require to need to click on each inherit if you do not want color on some columns. And with a multisite the handling becomes repetitive. Maybe one could have a set to choose the colorful default behavior with settings? I hope I understand correctly the problem.
With inherit_color=True, the value color or background-color is always present, this is a bug, so i propose this https://github.com/jrief/djangocms-cascade/pull/371/commits/ba99e8e78ee85ad2acc043c60ac4ea48bfc2498f
And to be able to parameter extra_fields Colorfield inherit_color inapp_settings.py
or settings.py
, I propose this class.
# djangocms-cascade/fields.py
...
class ColorFieldExtra(ColorField):
"""
ColorField with default inherit_color True.
"""
def __init__(self, *args, **kwargs):
kwargs['inherit_color'] = True
super().__init__(*args, **kwargs)
...
# djangocms-cascade/app_settings.py
...
extra_inline_styles.setdefault(
'Colors',
(['color', 'background-color'], ColorFieldExtra))
...
in case, I prepared a branch: https://github.com/haricot/djangocms-cascade/tree/colorfield_extra
Closed in favor branch colorfield_extra PR #392
Without this change, color and background are active by default. I don't think that is the desired behavior.