diff --git a/backend/src/kitconcept/intranet/behaviors/theming.py b/backend/src/kitconcept/intranet/behaviors/theming.py index f8e493e..311ef72 100644 --- a/backend/src/kitconcept/intranet/behaviors/theming.py +++ b/backend/src/kitconcept/intranet/behaviors/theming.py @@ -37,7 +37,9 @@ @provider(IFormFieldProvider) -class ITheming(SettingsSchema): +class ITheming(model.Schema): + # @ericof, bring it back when it's ready + # class ITheming(SettingsSchema): """Site/Subsite theming properties behavior.""" model.fieldset( diff --git a/backend/src/kitconcept/intranet/configure.zcml b/backend/src/kitconcept/intranet/configure.zcml index f7e7ce2..3a17102 100644 --- a/backend/src/kitconcept/intranet/configure.zcml +++ b/backend/src/kitconcept/intranet/configure.zcml @@ -1,6 +1,7 @@ @@ -22,5 +23,14 @@ + + + diff --git a/backend/src/kitconcept/intranet/services/__init__.py b/backend/src/kitconcept/intranet/services/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/src/kitconcept/intranet/services/configure.zcml b/backend/src/kitconcept/intranet/services/configure.zcml new file mode 100644 index 0000000..73548e4 --- /dev/null +++ b/backend/src/kitconcept/intranet/services/configure.zcml @@ -0,0 +1,20 @@ + + + + + + diff --git a/backend/src/kitconcept/intranet/services/navroot.py b/backend/src/kitconcept/intranet/services/navroot.py new file mode 100644 index 0000000..9eb1884 --- /dev/null +++ b/backend/src/kitconcept/intranet/services/navroot.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +from kitconcept.intranet.interfaces import IBrowserLayer +from plone.restapi.services import Service +from plone.restapi.services.navroot.get import Navroot +from zope.component import adapter +from zope.interface import Interface + + +# Grab them from the behavior? +SETTINGS = [ + "logo", + "accent_color", + "accent_foreground_color", + "primary_color", + "primary_foreground_color", + "secondary_color", + "secondary_foreground_color", +] + + +@adapter(Interface, IBrowserLayer) +class CustomNavroot(Navroot): + def filterAttributes(self, data): + return {key: data.get(key) for key in data.keys() if key in SETTINGS} + + def __call__(self, expand=False): + result = super().__call__(expand) + if not expand: + return result + return { + "navroot": {"navroot": self.filterAttributes(result["navroot"]["navroot"])} + } + + +class NavrootGet(Service): + def reply(self): + navroot = Navroot(self.context, self.request) + return navroot(expand=True)["navroot"]