# HG changeset patch # User Thierry Florac # Date 1543395111 -3600 # Node ID 5ecc6a3743e941394af9df8f005a7ec6e22badd1 # Parent eac829fbf7f6a35e57b0adcafd0886dd4b579c7f Updated default view portlet renderer diff -r eac829fbf7f6 -r 5ecc6a3743e9 src/pyams_default_theme/shared/view/portlet/__init__.py --- a/src/pyams_default_theme/shared/view/portlet/__init__.py Wed Nov 28 09:51:09 2018 +0100 +++ b/src/pyams_default_theme/shared/view/portlet/__init__.py Wed Nov 28 09:51:51 2018 +0100 @@ -12,23 +12,33 @@ __docformat__ = 'restructuredtext' +from persistent import Persistent +from zope.container.contained import Contained +from zope.interface import Interface, implementer +from zope.schema.fieldproperty import FieldProperty -# import standard library - -# import interfaces from pyams_content.shared.view.portlet.interfaces import IViewItemsPortletSettings +from pyams_default_theme.shared.view.portlet.interfaces import IViewItemsPortletVerticalRendererSettings from pyams_portal.interfaces import IPortalContext, IPortletRenderer +from pyams_portal.portlet import PortletRenderer from pyams_skin.layer import IPyAMSLayer - -# import packages -from pyams_portal.portlet import PortletRenderer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config -from zope.interface import Interface +from pyams_utils.factory import factory_config from pyams_default_theme import _ +@factory_config(provided=IViewItemsPortletVerticalRendererSettings) +@implementer(IViewItemsPortletVerticalRendererSettings) +class ViewItemsPortletVerticalRendererSettings(Persistent, Contained): + """View items portlet renderer settings""" + + display_illustrations = FieldProperty(IViewItemsPortletVerticalRendererSettings['display_illustrations']) + paginate = FieldProperty(IViewItemsPortletVerticalRendererSettings['paginate']) + page_size = FieldProperty(IViewItemsPortletVerticalRendererSettings['page_size']) + + @adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, IViewItemsPortletSettings), provides=IPortletRenderer) @template_config(template='templates/view-items-list.pt', layer=IPyAMSLayer) @@ -36,3 +46,6 @@ """View items portlet renderer""" label = _("Simple vertical view") + weight = 0 + + settings_interface = IViewItemsPortletVerticalRendererSettings diff -r eac829fbf7f6 -r 5ecc6a3743e9 src/pyams_default_theme/shared/view/portlet/interfaces.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/shared/view/portlet/interfaces.py Wed Nov 28 09:51:51 2018 +0100 @@ -0,0 +1,37 @@ +# +# Copyright (c) 2008-2018 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + +from zope.interface import Interface +from zope.schema import Bool, Int + +from pyams_default_theme import _ + + +class IViewItemsPortletVerticalRendererSettings(Interface): + """View items portlet vertical renderer settings interface""" + + display_illustrations = Bool(title=_("Display illustrations?"), + description=_("If 'no', view contents will not display illustrations"), + required=True, + default=True) + + paginate = Bool(title=_("Paginate?"), + description=_("If 'no', results pagination will be disabled"), + required=True, + default=True) + + page_size = Int(title=_("Page size"), + description=_("Number of items per page, if pagination is enabled"), + required=False, + default=10) diff -r eac829fbf7f6 -r 5ecc6a3743e9 src/pyams_default_theme/shared/view/portlet/templates/view-items-list.pt --- a/src/pyams_default_theme/shared/view/portlet/templates/view-items-list.pt Wed Nov 28 09:51:09 2018 +0100 +++ b/src/pyams_default_theme/shared/view/portlet/templates/view-items-list.pt Wed Nov 28 09:51:51 2018 +0100 @@ -1,6 +1,60 @@ - +
+

${i18n:settings.title}

+ +