--- a/src/pyams_default_theme/component/illustration/__init__.py Mon Oct 08 15:04:08 2018 +0200
+++ b/src/pyams_default_theme/component/illustration/__init__.py Mon Oct 08 17:11:12 2018 +0200
@@ -26,7 +26,8 @@
from pyams_content.root import ISiteRoot
from pyams_default_theme.component.illustration.interfaces import IIllustrationRenderer, IIllustrationWithZoomSettings, \
ILLUSTRATION_AFTER_BODY, ILLUSTRATION_BEFORE_BODY
-from pyams_default_theme.interfaces import IContentHeaderIllustration, IContentNavigationIllustration
+from pyams_default_theme.interfaces import IContentHeaderIllustration, IContentNavigationIllustration, \
+ IContentBannerIllustration
from pyams_skin.layer import IPyAMSLayer
from pyams_template.template import template_config
from pyams_utils.adapter import ContextRequestViewAdapter, adapter_config, get_annotation_adapter
@@ -41,7 +42,7 @@
@adapter_config(context=(IInternalLink, IPyAMSLayer), provides=IContentNavigationIllustration)
@adapter_config(context=(IBasicIllustrationTarget, IPyAMSLayer), provides=IContentNavigationIllustration)
-def base_content_navigation_illustration_adapter(context, request):
+def base_content_navigation_illustration_factory(context, request):
"""Default content navigation illustration adapter"""
illustration = ILinkIllustration(context, None)
if not (illustration and illustration.has_data()):
@@ -57,11 +58,27 @@
return illustration
+@adapter_config(context=(ISiteRoot, IPyAMSLayer), provides=IContentBannerIllustration)
+@adapter_config(context=(IBaseContent, IPyAMSLayer), provides=IContentBannerIllustration)
+def base_content_banner_illustration_factory(context, request):
+ """Base content banner illustration adapter"""
+ illustration = IIllustration(context, None)
+ if illustration and illustration.has_data():
+ return illustration
+
+
+@adapter_config(context=(ISiteRoot, IPyAMSLayer), provides=IContentHeaderIllustration)
+@adapter_config(context=(IBaseContent, IPyAMSLayer), provides=IContentHeaderIllustration)
+def base_content_header_illustration_factory(context, request):
+ """Base content header illustration adapter"""
+ return None
+
+
@adapter_config(name='pyams_illustration',
context=(Interface, Interface, Interface),
provides=ITALESExtension)
-class PyAMSContentIllustrationTALESExtension(ContextRequestViewAdapter):
- """PyAMS content illustration TALES extension"""
+class PyAMSIllustrationTALESExtension(ContextRequestViewAdapter):
+ """PyAMS illustration TALES extension"""
def render(self, context=None):
if context is None:
@@ -69,13 +86,28 @@
return self.request.registry.queryMultiAdapter((context, self.request), IContentNavigationIllustration)
-@adapter_config(context=(ISiteRoot, IPyAMSLayer), provides=IContentHeaderIllustration)
-@adapter_config(context=(IBaseContent, IPyAMSLayer), provides=IContentHeaderIllustration)
-def base_content_header_illustration_adapter(context, request):
- """Base content header illustration adapter"""
- illustration = IIllustration(context, None)
- if illustration and illustration.has_data():
- return illustration
+@adapter_config(name='pyams_banner_illustration',
+ context=(Interface, Interface, Interface),
+ provides=ITALESExtension)
+class PyAMSBannerIllustrationTALESExtension(ContextRequestViewAdapter):
+ """PyAMS banner illustration TALES extension"""
+
+ def render(self, context=None):
+ if context is None:
+ context = self.context
+ return self.request.registry.queryMultiAdapter((context, self.request), IContentBannerIllustration)
+
+
+@adapter_config(name='pyams_header_illustration',
+ context=(Interface, Interface, Interface),
+ provides=ITALESExtension)
+class PyAMSHeaderIllustrationTALESExtension(ContextRequestViewAdapter):
+ """PyAMS header illustration TALES extension"""
+
+ def render(self, context=None):
+ if context is None:
+ context = self.context
+ return self.request.registry.queryMultiAdapter((context, self.request), IContentHeaderIllustration)
#