# HG changeset patch # User Thierry Florac # Date 1543226748 -3600 # Node ID 20b80d2c592db8b872cb8c235ce05a6d5dc5c350 # Parent bcee7f49b3ea0939c920990b89daf8f9a84db849 Added renderers to simple navigation portlet diff -r bcee7f49b3ea -r 20b80d2c592d src/pyams_default_theme/features/menu/portlet/navigation/__init__.py --- a/src/pyams_default_theme/features/menu/portlet/navigation/__init__.py Mon Nov 26 11:05:06 2018 +0100 +++ b/src/pyams_default_theme/features/menu/portlet/navigation/__init__.py Mon Nov 26 11:05:48 2018 +0100 @@ -12,30 +12,34 @@ __docformat__ = 'restructuredtext' +from persistent import Persistent +from zope.interface import implementer, Interface +from zope.location.location import Location +from zope.schema.fieldproperty import FieldProperty -# import standard library - -# import interfaces +from pyams_content.component.association.interfaces import IAssociationInfo from pyams_content.features.menu.portlet.navigation.interfaces.double import IDoubleNavigationPortletSettings from pyams_content.features.menu.portlet.navigation.interfaces.simple import ISimpleNavigationPortletSettings from pyams_default_theme.features.menu.portlet.navigation.interfaces import \ IDoubleNavigationPortletSelectMenusRendererSettings -from pyams_portal.interfaces import IPortalContext, IPortletRenderer, PORTLET_RENDERER_SETTINGS_KEY +from pyams_portal.interfaces import IPortalContext, IPortletRenderer +from pyams_portal.portlet import PortletRenderer from pyams_skin.layer import IPyAMSLayer - -# import packages -from persistent import Persistent -from pyams_portal.portlet import PortletRenderer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config from pyams_utils.factory import factory_config -from zope.interface import implementer, Interface -from zope.location.location import Location -from zope.schema.fieldproperty import FieldProperty from pyams_default_theme import _ +class BaseNavigationRenderer(PortletRenderer): + """Base navigation portlet renderer""" + + @staticmethod + def get_link_info(link): + return IAssociationInfo(link) + + # # Simple navigation portlet renderers # @@ -43,20 +47,44 @@ @adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, ISimpleNavigationPortletSettings), provides=IPortletRenderer) @template_config(template='templates/simple-horizontal.pt', layer=IPyAMSLayer) -class SimpleNavigationPortletHorizontalRenderer(PortletRenderer): +class SimpleNavigationPortletHorizontalRenderer(BaseNavigationRenderer): """Simple navigation horizontal portlet renderer""" label = _("Horizontal list with vertical illustrations") + weight = 1 @adapter_config(name='horizontal-tabs', context=(IPortalContext, IPyAMSLayer, Interface, ISimpleNavigationPortletSettings), provides=IPortletRenderer) @template_config(template='templates/simple-horizontal-tabs.pt', layer=IPyAMSLayer) -class SimpleNavigationPortletHorizontalTabsRenderer(PortletRenderer): +class SimpleNavigationPortletHorizontalTabsRenderer(BaseNavigationRenderer): """Simple navigation horizontal portlet renderer with tabs""" label = _("Horizontal list with tabs and horizontal illustrations") + weight = 2 + + +@adapter_config(name='carousel', + context=(IPortalContext, IPyAMSLayer, Interface, ISimpleNavigationPortletSettings), + provides=IPortletRenderer) +@template_config(template='templates/simple-carousel.pt', layer=IPyAMSLayer) +class SimpleNavigationPortletCarouselRenderer(BaseNavigationRenderer): + """Simple navigation portlet carousel renderer""" + + label = _("Horizontal carousel with full width illustrations") + weight = 3 + + +@adapter_config(name='vertical-panels', + context=(IPortalContext, IPyAMSLayer, Interface, ISimpleNavigationPortletSettings), + provides=IPortletRenderer) +@template_config(template='templates/simple-panels.pt', layer=IPyAMSLayer) +class SimpleNavigationPortletVerticalPanelsRenderer(BaseNavigationRenderer): + """Simple navigation portlet vertical panels renderer""" + + label = _("Vertical panels with panoramic illustrations") + weight = 4 # diff -r bcee7f49b3ea -r 20b80d2c592d src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-carousel.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-carousel.pt Mon Nov 26 11:05:48 2018 +0100 @@ -0,0 +1,40 @@ +
+ +
\ No newline at end of file diff -r bcee7f49b3ea -r 20b80d2c592d src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-panels.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-panels.pt Mon Nov 26 11:05:48 2018 +0100 @@ -0,0 +1,24 @@ +
+

${i18n:settings.title}

+ +
+
\ No newline at end of file