-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix logo for now, use a normal model in the behavior, patch the adapt…
…er for root
- Loading branch information
Showing
5 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<configure | ||
xmlns="http://namespaces.zope.org/zope" | ||
xmlns:i18n="http://namespaces.zope.org/i18n" | ||
xmlns:plone="http://namespaces.plone.org/plone" | ||
i18n_domain="kitconcept.intranet" | ||
> | ||
<plone:service | ||
method="GET" | ||
factory=".navroot.NavrootGet" | ||
for="kitconcept.intranet.interfaces.IBrowserLayer" | ||
permission="zope2.View" | ||
name="@navroot" | ||
/> | ||
|
||
<adapter | ||
factory=".navroot.CustomNavroot" | ||
name="navroot" | ||
/> | ||
|
||
</configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |