# HG changeset patch # User Damien Correia # Date 1531217854 -7200 # Node ID 170cf23172b4435726f1c9d5da0ad634e2270d07 # Parent d80fc625e4d86349551a54feca761f9d02015355# Parent 9563247eb2f1ab8bfe42a55f106a8da7dac49eb4 default merge diff -r d80fc625e4d8 -r 170cf23172b4 .hgtags --- a/.hgtags Fri Jun 15 18:17:42 2018 +0200 +++ b/.hgtags Tue Jul 10 12:17:34 2018 +0200 @@ -4,3 +4,4 @@ 1a8ae80d426c50d10ed976df7703f2b805a1c4cb 0.1.3 10d9fbc9908f3bcfdd1cb28cfec3d20175a0feb3 0.1.4 b2c3949bb5b8c7bcdf77a6d417cb1e84771db830 0.1.5 +c1e5ec49def40a740580aec8c7fc2ead2266ded3 0.1.6 diff -r d80fc625e4d8 -r 170cf23172b4 buildout.cfg --- a/buildout.cfg Fri Jun 15 18:17:42 2018 +0200 +++ b/buildout.cfg Tue Jul 10 12:17:34 2018 +0200 @@ -79,4 +79,4 @@ eggs = pyams_default_theme [test] [versions] -pyams_default_theme = 0.1.6 +pyams_default_theme = 0.1.7 diff -r d80fc625e4d8 -r 170cf23172b4 docs/HISTORY.txt --- a/docs/HISTORY.txt Fri Jun 15 18:17:42 2018 +0200 +++ b/docs/HISTORY.txt Tue Jul 10 12:17:34 2018 +0200 @@ -1,6 +1,14 @@ History ======= +0.1.6 +----- + - use shared content renderer interface + - use custom preview layout for paragraph preview + - use new "thumbnail" TALES extension to generate images thumbnails + - added "key numbers" portlet + - added custom preview layout + 0.1.5 ----- - added header and footer content providers diff -r d80fc625e4d8 -r 170cf23172b4 setup.py --- a/setup.py Fri Jun 15 18:17:42 2018 +0200 +++ b/setup.py Tue Jul 10 12:17:34 2018 +0200 @@ -22,7 +22,7 @@ README = os.path.join(DOCS, 'README.txt') HISTORY = os.path.join(DOCS, 'HISTORY.txt') -version = '0.1.6' +version = '0.1.7' long_description = open(README).read() + '\n\n' + open(HISTORY).read() tests_require = [] diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme.egg-info/PKG-INFO --- a/src/pyams_default_theme.egg-info/PKG-INFO Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme.egg-info/PKG-INFO Tue Jul 10 12:17:34 2018 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pyams-default-theme -Version: 0.1.5 +Version: 0.1.6 Summary: PyAMS default theme Home-page: http://hg.ztfy.org/pyams/pyams_default_theme Author: Thierry Florac @@ -12,6 +12,14 @@ History ======= + 0.1.6 + ----- + - use shared content renderer interface + - use custom preview layout for paragraph preview + - use new "thumbnail" TALES extension to generate images thumbnails + - added "key numbers" portlet + - added custom preview layout + 0.1.5 ----- - added header and footer content providers diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme.egg-info/SOURCES.txt --- a/src/pyams_default_theme.egg-info/SOURCES.txt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme.egg-info/SOURCES.txt Tue Jul 10 12:17:34 2018 +0200 @@ -26,6 +26,10 @@ src/pyams_default_theme/component/illustration/templates/illustration-default.pt src/pyams_default_theme/component/illustration/templates/illustration-left.pt src/pyams_default_theme/component/illustration/templates/illustration-right.pt +src/pyams_default_theme/component/keynumber/__init__.py +src/pyams_default_theme/component/keynumber/portlet/__init__.py +src/pyams_default_theme/component/keynumber/portlet/templates/horizontal-render.pt +src/pyams_default_theme/component/keynumber/portlet/templates/vertical-render.pt src/pyams_default_theme/component/paragraph/__init__.py src/pyams_default_theme/component/paragraph/contact.py src/pyams_default_theme/component/paragraph/frame.py @@ -56,6 +60,14 @@ src/pyams_default_theme/features/__init__.py src/pyams_default_theme/features/footer/__init__.py src/pyams_default_theme/features/header/__init__.py +src/pyams_default_theme/features/menu/__init__.py +src/pyams_default_theme/features/menu/portlet/__init__.py +src/pyams_default_theme/features/menu/portlet/navigation/__init__.py +src/pyams_default_theme/features/menu/portlet/navigation/interfaces.py +src/pyams_default_theme/features/menu/portlet/navigation/templates/double-select.pt +src/pyams_default_theme/features/menu/portlet/navigation/templates/double-vertical.pt +src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-horizontal-tabs.pt +src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-horizontal.pt src/pyams_default_theme/locales/pyams_default_theme.pot src/pyams_default_theme/locales/fr/LC_MESSAGES/pyams_default_theme.mo src/pyams_default_theme/locales/fr/LC_MESSAGES/pyams_default_theme.po @@ -76,8 +88,10 @@ src/pyams_default_theme/shared/view/__init__.py src/pyams_default_theme/shared/view/portlet/__init__.py src/pyams_default_theme/shared/view/portlet/templates/view-items-list.pt +src/pyams_default_theme/shared/view/templates/render.pt src/pyams_default_theme/templates/index.pt src/pyams_default_theme/templates/layout.pt +src/pyams_default_theme/templates/preview-layout.pt src/pyams_default_theme/tests/__init__.py src/pyams_default_theme/tests/test_utilsdocs.py src/pyams_default_theme/tests/test_utilsdocstrings.py \ No newline at end of file diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/gallery/templates/renderer-default.pt --- a/src/pyams_default_theme/component/gallery/templates/renderer-default.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/component/gallery/templates/renderer-default.pt Tue Jul 10 12:17:34 2018 +0200 @@ -1,7 +1,7 @@
- - +
legend
diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/illustration/templates/illustration-right.pt --- a/src/pyams_default_theme/component/illustration/templates/illustration-right.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/component/illustration/templates/illustration-right.pt Tue Jul 10 12:17:34 2018 +0200 @@ -2,11 +2,11 @@ - +
legend

diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/keynumber/portlet/__init__.py --- a/src/pyams_default_theme/component/keynumber/portlet/__init__.py Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/component/keynumber/portlet/__init__.py Tue Jul 10 12:17:34 2018 +0200 @@ -12,25 +12,36 @@ __docformat__ = 'restructuredtext' + # import standard library # import interfaces -from pyams_content.component.keynumber.portlet import IKeyNumberPortletSettings +from pyams_content.component.keynumber.portlet.interfaces import IKeyNumberPortletSettings 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 zope.interface import Interface from pyams_default_theme import _ -@adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, IKeyNumberPortletSettings), provides=IPortletRenderer) -@template_config(template='templates/render.pt', layer=IPyAMSLayer) -class KeyNumberPortletRenderer(PortletRenderer): - """New portlet renderer""" +@adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, IKeyNumberPortletSettings), + provides=IPortletRenderer) +@template_config(template='templates/horizontal-render.pt', layer=IPyAMSLayer) +class KeyNumberPortletHorizontalRenderer(PortletRenderer): + """Key numbers portlet horizontal renderer""" + + label = _("Horizontal list with carousel") - label = _("Vertical list of key numbers") + +@adapter_config(name='vertical', context=(IPortalContext, IPyAMSLayer, Interface, IKeyNumberPortletSettings), + provides=IPortletRenderer) +@template_config(template='templates/vertical-render.pt', layer=IPyAMSLayer) +class KeyNumberPortletVerticalRenderer(PortletRenderer): + """Key numbers portlet vertical renderer""" + + label = _("Vertical list") diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/keynumber/portlet/templates/horizontal-render.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/component/keynumber/portlet/templates/horizontal-render.pt Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,20 @@ +
+ +
+
Teaser
+
    +
  • + + : + Number + Unit + text +
  • +
+
diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/keynumber/portlet/templates/render.pt --- a/src/pyams_default_theme/component/keynumber/portlet/templates/render.pt Fri Jun 15 18:17:42 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -
- Title - -
    -
  • - label - Number - Unit - text -
  • -
-
diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/keynumber/portlet/templates/vertical-render.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/component/keynumber/portlet/templates/vertical-render.pt Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,20 @@ +
+ +
+
Teaser
+
    +
  • + + : + Number + Unit + text +
  • +
+
diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/paragraph/templates/contact-default.pt --- a/src/pyams_default_theme/component/paragraph/templates/contact-default.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/contact-default.pt Tue Jul 10 12:17:34 2018 +0200 @@ -3,7 +3,7 @@

Contact title

- +
diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/paragraph/templates/header-default.pt --- a/src/pyams_default_theme/component/paragraph/templates/header-default.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/header-default.pt Tue Jul 10 12:17:34 2018 +0200 @@ -1,2 +1,2 @@
header
+ tal:content="structure tales:html(view.header)">header
diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/paragraph/templates/html-default.pt --- a/src/pyams_default_theme/component/paragraph/templates/html-default.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/html-default.pt Tue Jul 10 12:17:34 2018 +0200 @@ -1,3 +1,3 @@

title

-
body
+
body
Illustration diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/paragraph/templates/verbatim-default.pt --- a/src/pyams_default_theme/component/paragraph/templates/verbatim-default.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/verbatim-default.pt Tue Jul 10 12:17:34 2018 +0200 @@ -10,11 +10,11 @@ Charge
Quote
+ tal:content="tales:html(view.quote)">Quote
Quote
+ tal:content="tales:html(view.quote)">Quote
Author diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/paragraph/templates/verbatim-left.pt --- a/src/pyams_default_theme/component/paragraph/templates/verbatim-left.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/verbatim-left.pt Tue Jul 10 12:17:34 2018 +0200 @@ -6,7 +6,7 @@ tal:replace="structure view.illustration_renderer.render() if view.illustration_renderer is not None else None">
Quote
+ tal:content="structure tales:html(view.quote)">Quote
Author diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/paragraph/templates/verbatim-right.pt --- a/src/pyams_default_theme/component/paragraph/templates/verbatim-right.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/verbatim-right.pt Tue Jul 10 12:17:34 2018 +0200 @@ -6,7 +6,7 @@ tal:replace="structure view.illustration_renderer.render() if view.illustration_renderer is not None else None">
Quote
+ tal:content="structure tales:html(view.quote)">Quote
Author diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/paragraph/templates/video-default.pt --- a/src/pyams_default_theme/component/paragraph/templates/video-default.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/video-default.pt Tue Jul 10 12:17:34 2018 +0200 @@ -1,28 +1,29 @@

title

Description
+ tal:content="structure tales:html(view.description)">Description
+ tal:condition="view.data" + tal:attributes="data-ams-plugin-flowplayer-src tales:resource_path('pyams_media.skin:flowplayer'); + data-ams-plugin-flowplayer-css tales:resource_path('pyams_media.skin:functional_css'); + data-ams-callback-source tales:resource_path('pyams_media.skin:pyams_media');"> diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/component/video/templates/video-default.pt --- a/src/pyams_default_theme/component/video/templates/video-default.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/component/video/templates/video-default.pt Tue Jul 10 12:17:34 2018 +0200 @@ -1,5 +1,5 @@

title

Description
+ tal:content="structure tales:html(view.description)">Description
diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/features/header/__init__.py --- a/src/pyams_default_theme/features/header/__init__.py Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/features/header/__init__.py Tue Jul 10 12:17:34 2018 +0200 @@ -17,11 +17,21 @@ # import interfaces from pyams_content.features.header.interfaces import IHeaderTarget, IHeaderSettings +from pyams_content.features.menu.interfaces import IMenuLinksContainerTarget, IMenuLinksContainer +from pyams_default_theme.features.header.interfaces import ISimpleHeaderRendererSettings, ISimpleHeaderTabsMenu from pyams_default_theme.layer import IPyAMSDefaultLayer +from zope.location.interfaces import ISublocations # import packages +from persistent import Persistent +from pyams_content.component.association.interfaces import ASSOCIATION_CONTAINER_KEY +from pyams_content.features.menu import Menu +from pyams_file.property import FileProperty +from pyams_utils.adapter import get_annotation_adapter, adapter_config, ContextAdapter from pyams_utils.traversing import get_parent from pyams_viewlet.viewlet import contentprovider_config, ViewContentProvider +from zope.interface import implementer +from zope.location import Location, locate @contentprovider_config(name='pyams.header', layer=IPyAMSDefaultLayer) @@ -29,16 +39,52 @@ """Header content provider""" header = None + renderer = None def update(self): parent = get_parent(self.context, IHeaderTarget) if parent is not None: - self.header = IHeaderSettings(parent, None) + header = self.header = IHeaderSettings(parent, None) + if header is not None: + renderer = self.renderer = header.get_renderer(self.request) + if renderer is not None: + renderer.update() def render(self): - if self.header is None: + if (self.header is None) or (self.renderer is None): return '' - renderer = self.header.get_renderer(self.request) - if renderer is None: - return '' - return renderer.render() + return self.renderer.render() + + +# +# Simple header renderer settings +# + +SIMPLE_HEADER_TABS_KEY = '{0}::tabs'.format(ASSOCIATION_CONTAINER_KEY) + + +@implementer(ISimpleHeaderRendererSettings, IMenuLinksContainerTarget) +class SimpleHeaderRendererSettings(Persistent, Location): + """Simple header renderer settings""" + + banner = FileProperty(ISimpleHeaderRendererSettings['banner']) + logo = FileProperty(ISimpleHeaderRendererSettings['logo']) + + @property + def tabs(self): + return get_annotation_adapter(self, SIMPLE_HEADER_TABS_KEY, Menu, + markers=ISimpleHeaderTabsMenu, name='++ass++tabs') + + +@adapter_config(name='tabs', context=ISimpleHeaderRendererSettings, provides=IMenuLinksContainer) +def simple_header_tabs_links_adapter(context): + """Simple header tabs links adapter""" + return context.tabs + + +@adapter_config(name='links', context=ISimpleHeaderRendererSettings, provides=ISublocations) +class SimpleHeaderRendererSettingsSublocations(ContextAdapter): + """Simple header renderer settings sub-locations adapter""" + + def sublocations(self): + return self.context.tabs.values() diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/features/header/interfaces.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/features/header/interfaces.py Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,43 @@ +# +# 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' + + +# import standard library + +# import interfaces +from pyams_content.features.header.interfaces import IHeaderRendererSettings + +# import packages +from pyams_file.schema import ImageField +from zope.interface import Interface, Attribute + +from pyams_default_theme import _ + + +class ISimpleHeaderRendererSettings(IHeaderRendererSettings): + """Simple header renderer settings""" + + banner = ImageField(title=_("Banner image"), + description=_("Image displayed as header background"), + required=False) + + logo = ImageField(title=_("Logo"), + description=_("Logo displayed in header"), + required=False) + + tabs = Attribute("Top tabs list") + + +class ISimpleHeaderTabsMenu(Interface): + """Simple header menu marker interface""" diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/features/header/skin/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/features/header/skin/__init__.py Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,75 @@ +# +# 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' + + +# import standard library + +# import interfaces +from pyams_content.component.association.interfaces import IAssociationInfo +from pyams_content.component.links.interfaces import IInternalLink +from pyams_content.features.header.interfaces import IHeaderTarget, IHeaderRenderer, IHeaderSettings, \ + IHeaderRendererSettings +from pyams_default_theme.features.header.interfaces import ISimpleHeaderRendererSettings +from pyams_skin.layer import IPyAMSLayer + +# import packages +from pyams_content.features.header.skin import BaseHeaderRenderer +from pyams_default_theme.features.header import SimpleHeaderRendererSettings +from pyams_template.template import template_config +from pyams_utils.adapter import adapter_config +from pyramid.location import lineage + +from pyams_default_theme import _ + + +SIMPLE_HEADER_RENDERER_NAME = 'PyAMS simple header' + + +# +# Simple header renderer +# + +@adapter_config(name=SIMPLE_HEADER_RENDERER_NAME, context=(IHeaderTarget, IPyAMSLayer), provides=IHeaderRenderer) +@adapter_config(name=SIMPLE_HEADER_RENDERER_NAME, context=(IHeaderSettings, IPyAMSLayer), provides=IHeaderRenderer) +@template_config(template='templates/simple-header.pt', layer=IPyAMSLayer) +class SimpleHeaderRenderer(BaseHeaderRenderer): + """Simple header renderer""" + + name = SIMPLE_HEADER_RENDERER_NAME + label = _("PyAMS simple header with banner and tabs") + weight = 1 + + settings_key = 'PyAMS::simple' + settings_interface = ISimpleHeaderRendererSettings + + def update(self): + super(SimpleHeaderRenderer, self).update() + self.request.annotations['REQUEST_PATH'] = list(lineage(self.request.context)) + + @staticmethod + def get_link_info(link): + return IAssociationInfo(link) + + def is_active(self, link): + if IInternalLink.providedBy(link): + target = link.get_target() + if target is not None: + return target in self.request.annotations['REQUEST_PATH'] + return False + + +@adapter_config(context=SimpleHeaderRenderer, provides=IHeaderRendererSettings) +def simple_header_renderer_settings_factory(context): + """Simple header renderer settings factory""" + return SimpleHeaderRendererSettings() diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/features/header/skin/templates/simple-header.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/features/header/skin/templates/simple-header.pt Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,16 @@ +
+ + +
diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/features/header/zmi/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/features/header/zmi/__init__.py Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,84 @@ +# +# 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' + + +# import standard library + +# import interfaces +from pyams_default_theme.features.header import ISimpleHeaderRendererSettings, ISimpleHeaderTabsMenu +from pyams_form.interfaces.form import IInnerSubForm +from pyams_portal.interfaces import MANAGE_TEMPLATE_PERMISSION +from pyams_skin.layer import IPyAMSLayer +from transaction.interfaces import ITransactionManager + +# import packages +from pyams_content.features.header.zmi import HeaderSettingsRendererSettingsEditForm +from pyams_content.features.menu.zmi import LinksTable, IMenuLinksView, MenuLinksView +from pyams_skin.event import get_json_widget_refresh_event +from pyams_utils.adapter import adapter_config +from pyams_zmi.form import InnerAdminEditForm +from z3c.form import field + +from pyams_default_theme import _ + + +@adapter_config(name='simple-header-properties', + context=(ISimpleHeaderRendererSettings, IPyAMSLayer, HeaderSettingsRendererSettingsEditForm), + provides=IInnerSubForm) +class SimpleHeaderPropertiesEditForm(InnerAdminEditForm): + """Simple header properties edit form""" + + legend = None + edit_permission = MANAGE_TEMPLATE_PERMISSION + weight = 1 + + fields = field.Fields(ISimpleHeaderRendererSettings) + + def get_ajax_output(self, changes): + output = super(SimpleHeaderPropertiesEditForm, self).get_ajax_output(changes) + updated = changes.get(ISimpleHeaderRendererSettings, ()) + if updated: + ITransactionManager(self.context).commit() + if 'banner' in updated: + output.setdefault('events', []).append( + get_json_widget_refresh_event(self.context, self.request, + SimpleHeaderPropertiesEditForm, 'banner')) + if 'logo' in updated: + output.setdefault('events', []).append( + get_json_widget_refresh_event(self.context, self.request, + SimpleHeaderPropertiesEditForm, 'logo')) + return output + + +# +# Header top tabs table view +# + +class TabsAssociationsTable(LinksTable): + """Simple header tabs associations table""" + + associations_name = 'tabs' + + +@adapter_config(name='simple-header-tabs', + context=(ISimpleHeaderRendererSettings, IPyAMSLayer, HeaderSettingsRendererSettingsEditForm), + provides=IInnerSubForm) +@adapter_config(name='++ass++tabs', context=(ISimpleHeaderTabsMenu, IPyAMSLayer), provides=IMenuLinksView) +class SimpleHeaderTabsView(MenuLinksView): + """Simple header tabs view""" + + title = _("Top tabs") + + table_class = TabsAssociationsTable + weight = 10 diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/features/menu/portlet/navigation/__init__.py --- a/src/pyams_default_theme/features/menu/portlet/navigation/__init__.py Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/features/menu/portlet/navigation/__init__.py Tue Jul 10 12:17:34 2018 +0200 @@ -18,14 +18,20 @@ # import interfaces from pyams_content.features.menu.portlet.navigation.interfaces.double import IDoubleNavigationPortletSettings from pyams_content.features.menu.portlet.navigation.interfaces.simple import ISimpleNavigationPortletSettings -from pyams_portal.interfaces import IPortalContext, IPortletRenderer +from pyams_default_theme.features.menu.portlet.navigation.interfaces import \ + IDoubleNavigationPortletSelectMenusRendererSettings +from pyams_portal.interfaces import IPortalContext, IPortletRenderer, PORTLET_RENDERER_SETTINGS_KEY 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 _ @@ -37,20 +43,55 @@ @adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, ISimpleNavigationPortletSettings), provides=IPortletRenderer) @template_config(template='templates/simple-horizontal.pt', layer=IPyAMSLayer) -class SimpleNavigationDefaultPortletRenderer(PortletRenderer): - """Simple navigation default portlet renderer""" +class SimpleNavigationPortletHorizontalRenderer(PortletRenderer): + """Simple navigation horizontal portlet renderer""" label = _("Horizontal list with vertical illustrations") +@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): + """Simple navigation horizontal portlet renderer with tabs""" + + label = _("Horizontal list with tabs and horizontal illustrations") + + # -# Double navigation portlet renderers +# Double navigation portlet default renderer # @adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, IDoubleNavigationPortletSettings), provides=IPortletRenderer) @template_config(template='templates/double-vertical.pt', layer=IPyAMSLayer) -class DoubleNavigationDefaultPortletRenderer(PortletRenderer): - """Double navigation default portlet renderer""" +class DoubleNavigationPortletDefaultRenderer(PortletRenderer): + """Double navigation portlet default renderer""" label = _("Vertical list with small horizontal menus illustrations") + + +# +# Double navigation portlet "double-select" renderer +# + +@implementer(IDoubleNavigationPortletSelectMenusRendererSettings) +@factory_config(provided=IDoubleNavigationPortletSelectMenusRendererSettings) +class DoubleNavigationPortletSelectMenusRendererSettings(Persistent, Location): + """Double navigation portlet select menus renderer settings""" + + first_level_label = FieldProperty(IDoubleNavigationPortletSelectMenusRendererSettings['first_level_label']) + second_level_label = FieldProperty(IDoubleNavigationPortletSelectMenusRendererSettings['second_level_label']) + + +@adapter_config(name='double-select', + context=(IPortalContext, IPyAMSLayer, Interface, IDoubleNavigationPortletSettings), + provides=IPortletRenderer) +@template_config(template='templates/double-select.pt', layer=IPyAMSLayer) +class DoubleNavigationPortletSelectMenusRenderer(PortletRenderer): + """Double navigation portlet menus renderer""" + + label = _("Double-level selection navigation") + + settings_interface = IDoubleNavigationPortletSelectMenusRendererSettings diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/features/menu/portlet/navigation/interfaces.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/features/menu/portlet/navigation/interfaces.py Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,36 @@ +# +# 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' + + +# import standard library + +# import interfaces + +# import packages +from pyams_i18n.schema import I18nTextLineField +from zope.interface import Interface + +from pyams_default_theme import _ + + +class IDoubleNavigationPortletSelectMenusRendererSettings(Interface): + """Double navigation portlet select menus renderer settings interface""" + + first_level_label = I18nTextLineField(title=_("First menu label"), + description=_("Label associated with first level options menu"), + required=True) + + second_level_label = I18nTextLineField(title=_("Second menu label"), + description=_("Label associated with second level options menu"), + required=True) diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/features/menu/portlet/navigation/templates/double-select.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/features/menu/portlet/navigation/templates/double-select.pt Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,3 @@ + + + diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/features/menu/portlet/navigation/templates/simple-horizontal-tabs.pt diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/locales/fr/LC_MESSAGES/pyams_default_theme.mo Binary file src/pyams_default_theme/locales/fr/LC_MESSAGES/pyams_default_theme.mo has changed diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/locales/fr/LC_MESSAGES/pyams_default_theme.po --- a/src/pyams_default_theme/locales/fr/LC_MESSAGES/pyams_default_theme.po Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/locales/fr/LC_MESSAGES/pyams_default_theme.po Tue Jul 10 12:17:34 2018 +0200 @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE 1.0\n" -"POT-Creation-Date: 2018-06-13 14:45+0200\n" +"POT-Creation-Date: 2018-07-03 09:32+0200\n" "PO-Revision-Date: 2017-06-07 12:41+0200\n" "Last-Translator: Thierry Florac \n" "Language-Team: French\n" @@ -18,12 +18,20 @@ #: src/pyams_default_theme/skin.py:35 msgid "PyAMS default skin" -msgstr "Skin par défaut PyAMS" +msgstr "Skin par défaut (PyAMS)" #: src/pyams_default_theme/component/gallery/__init__.py:40 msgid "Default gallery renderer" msgstr "Par défaut" +#: src/pyams_default_theme/component/keynumber/portlet/__init__.py:37 +msgid "Horizontal list with carousel" +msgstr "Liste horizontale (par défaut)" + +#: src/pyams_default_theme/component/keynumber/portlet/__init__.py:46 +msgid "Vertical list" +msgstr "Liste verticale" + #: src/pyams_default_theme/component/illustration/__init__.py:72 msgid "Centered illustration" msgstr "Illustration centrée (par défaut)" @@ -189,8 +197,8 @@ #: src/pyams_default_theme/shared/view/templates/render.pt:3 msgid "WARNING: items displayed in this preview are out of context!!" msgstr "" -"ATTENTION : la sélection des éléments affichés dans cet aperçu ne tient pas compte du " -"contexte éventuellement paramétré dans la vue" +"ATTENTION : la sélection des éléments affichés dans cet aperçu ne tient pas " +"compte du contexte éventuellement paramétré dans la vue" #: src/pyams_default_theme/shared/view/portlet/__init__.py:37 msgid "Simple list view" @@ -208,6 +216,62 @@ msgid "Default logos renderer" msgstr "Par défaut" +#: src/pyams_default_theme/features/menu/portlet/navigation/__init__.py:49 +msgid "Horizontal list with vertical illustrations" +msgstr "Liste horizontale avec illustrations verticales (par défaut)" + +#: src/pyams_default_theme/features/menu/portlet/navigation/__init__.py:59 +msgid "Horizontal list with tabs and horizontal illustrations" +msgstr "Liste horizontale avec onglets et illustrations panoramiques" + +#: src/pyams_default_theme/features/menu/portlet/navigation/__init__.py:72 +msgid "Vertical list with small horizontal menus illustrations" +msgstr "Liste verticale avec illustrations horizontales" + +#: src/pyams_default_theme/features/menu/portlet/navigation/__init__.py:95 +msgid "Double-level selection navigation" +msgstr "Navigation par sélection à deux niveaux" + +#: src/pyams_default_theme/features/menu/portlet/navigation/interfaces.py:30 +msgid "First menu label" +msgstr "Libellé sélection 1" + +#: src/pyams_default_theme/features/menu/portlet/navigation/interfaces.py:31 +msgid "Label associated with first level options menu" +msgstr "Libellé associé au premier niveau de sélection" + +#: src/pyams_default_theme/features/menu/portlet/navigation/interfaces.py:34 +msgid "Second menu label" +msgstr "Libellé sélection 2" + +#: src/pyams_default_theme/features/menu/portlet/navigation/interfaces.py:35 +msgid "Label associated with second level options menu" +msgstr "Libellé associé au second niveau de sélection" + +#: src/pyams_default_theme/features/header/interfaces.py:31 +msgid "Banner image" +msgstr "Bandeau" + +#: src/pyams_default_theme/features/header/interfaces.py:32 +msgid "Image displayed as header background" +msgstr "Image affichée en tête de page" + +#: src/pyams_default_theme/features/header/interfaces.py:35 +msgid "Logo" +msgstr "Logo" + +#: src/pyams_default_theme/features/header/interfaces.py:36 +msgid "Logo displayed in header" +msgstr "Logo superposé au bandeau" + +#: src/pyams_default_theme/features/header/zmi/__init__.py:81 +msgid "Top tabs" +msgstr "Onglets de navigation" + +#: src/pyams_default_theme/features/header/skin/__init__.py:48 +msgid "PyAMS simple header with banner and tabs" +msgstr "PyAMS: en-tête simple avec bandeau et onglets de navigation" + #~ msgid "Search..." #~ msgstr "Chercher..." diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/locales/pyams_default_theme.pot --- a/src/pyams_default_theme/locales/pyams_default_theme.pot Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/locales/pyams_default_theme.pot Tue Jul 10 12:17:34 2018 +0200 @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE 1.0\n" -"POT-Creation-Date: 2018-06-13 14:45+0200\n" +"POT-Creation-Date: 2018-07-03 09:32+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" @@ -24,6 +24,14 @@ msgid "Default gallery renderer" msgstr "" +#: ./src/pyams_default_theme/component/keynumber/portlet/__init__.py:37 +msgid "Horizontal list with carousel" +msgstr "" + +#: ./src/pyams_default_theme/component/keynumber/portlet/__init__.py:46 +msgid "Vertical list" +msgstr "" + #: ./src/pyams_default_theme/component/illustration/__init__.py:72 msgid "Centered illustration" msgstr "" @@ -190,3 +198,59 @@ #: ./src/pyams_default_theme/shared/logo/__init__.py:39 msgid "Default logos renderer" msgstr "" + +#: ./src/pyams_default_theme/features/menu/portlet/navigation/__init__.py:49 +msgid "Horizontal list with vertical illustrations" +msgstr "" + +#: ./src/pyams_default_theme/features/menu/portlet/navigation/__init__.py:59 +msgid "Horizontal list with tabs and horizontal illustrations" +msgstr "" + +#: ./src/pyams_default_theme/features/menu/portlet/navigation/__init__.py:72 +msgid "Vertical list with small horizontal menus illustrations" +msgstr "" + +#: ./src/pyams_default_theme/features/menu/portlet/navigation/__init__.py:95 +msgid "Double-level selection navigation" +msgstr "" + +#: ./src/pyams_default_theme/features/menu/portlet/navigation/interfaces.py:30 +msgid "First menu label" +msgstr "" + +#: ./src/pyams_default_theme/features/menu/portlet/navigation/interfaces.py:31 +msgid "Label associated with first level options menu" +msgstr "" + +#: ./src/pyams_default_theme/features/menu/portlet/navigation/interfaces.py:34 +msgid "Second menu label" +msgstr "" + +#: ./src/pyams_default_theme/features/menu/portlet/navigation/interfaces.py:35 +msgid "Label associated with second level options menu" +msgstr "" + +#: ./src/pyams_default_theme/features/header/interfaces.py:31 +msgid "Banner image" +msgstr "" + +#: ./src/pyams_default_theme/features/header/interfaces.py:32 +msgid "Image displayed as header background" +msgstr "" + +#: ./src/pyams_default_theme/features/header/interfaces.py:35 +msgid "Logo" +msgstr "" + +#: ./src/pyams_default_theme/features/header/interfaces.py:36 +msgid "Logo displayed in header" +msgstr "" + +#: ./src/pyams_default_theme/features/header/zmi/__init__.py:81 +msgid "Top tabs" +msgstr "" + +#: ./src/pyams_default_theme/features/header/skin/__init__.py:48 +msgid "PyAMS simple header with banner and tabs" +msgstr "" diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/resources/css/pyams-default.css --- a/src/pyams_default_theme/resources/css/pyams-default.css Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/resources/css/pyams-default.css Tue Jul 10 12:17:34 2018 +0200 @@ -1,3 +1,19 @@ +body { + max-width: 950px; + margin: 0 auto; +} +body .header-simple .regularbanner { + position: relative; +} +body .header-simple .regularbanner img.regularbanner__media { + width: 100%; +} +body .header-simple .regularbanner img.logo { + position: absolute; + top: 10px; + left: 10px; + max-height: calc(80%); +} @media only screen and (min-width: 1200px) { .portal-page .slot.col-lg-0 { display: none; @@ -18,3 +34,4 @@ display: none; } } +/*# sourceMappingURL=pyams-default.css.map */ \ No newline at end of file diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/resources/css/pyams-default.css.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/resources/css/pyams-default.css.map Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,1 @@ +{"version":3,"sources":["../../../../../../../../../home/tflorac/Dropbox/src/PyAMS/pyams_default_theme/src/pyams_default_theme/resources/less/pyams-default.less"],"names":[],"mappings":"AAAA;EACC,gBAAA;EACA,cAAA;;AAFD,IAIC,eACC;EACC,kBAAA;;AAGC,IALH,eACC,eAGC,IACE;EACA,WAAA;;AAED,IARH,eACC,eAGC,IAIE;EACA,kBAAA;EACA,SAAA;EACA,UAAA;EACA,YAAY,SAAZ;;AAUH,wBAA2C;EAC1C,YAFF,MAEG;IACA,aAAA;;;AAGF,wBAA0C,uBAAwB;EACjE,YAPF,MAOG;IACA,aAAA;;;AAGF,wBAA0C,uBAAuB;EAChE,YAZF,MAYG;IACA,aAAA;;;AAGF,wBAA0C;EACzC,YAjBF,MAiBG;IACA,aAAA","file":"pyams-default.css"} \ No newline at end of file diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/resources/css/pyams-default.min.css --- a/src/pyams_default_theme/resources/css/pyams-default.min.css Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/resources/css/pyams-default.min.css Tue Jul 10 12:17:34 2018 +0200 @@ -1,1 +1,1 @@ -@media only screen and (min-width:1200px){.portal-page .slot.col-lg-0{display:none}}@media only screen and (min-width:992px) and (max-width:1199px){.portal-page .slot.col-md-0{display:none}}@media only screen and (min-width:768px) and (max-width:991px){.portal-page .slot.col-sm-0{display:none}}@media only screen and (max-width:767px){.portal-page .slot.col-xs-0{display:none}} \ No newline at end of file +body{max-width:950px;margin:0 auto}body .header-simple .regularbanner{position:relative}body .header-simple .regularbanner img.regularbanner__media{width:100%}body .header-simple .regularbanner img.logo{position:absolute;top:10px;left:10px;max-height:calc(80%)}@media only screen and (min-width:1200px){.portal-page .slot.col-lg-0{display:none}}@media only screen and (min-width:992px) and (max-width:1199px){.portal-page .slot.col-md-0{display:none}}@media only screen and (min-width:768px) and (max-width:991px){.portal-page .slot.col-sm-0{display:none}}@media only screen and (max-width:767px){.portal-page .slot.col-xs-0{display:none}} diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/resources/less/pyams-default.less --- a/src/pyams_default_theme/resources/less/pyams-default.less Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/resources/less/pyams-default.less Tue Jul 10 12:17:34 2018 +0200 @@ -1,3 +1,26 @@ +body { + max-width: 950px; + margin: 0 auto; + + .header-simple { + .regularbanner { + position: relative; + + img { + &.regularbanner__media { + width: 100%; + } + &.logo { + position: absolute; + top: 10px; + left: 10px; + max-height: calc(100% - 20px); + } + } + } + } +} + .portal-page { .slot { diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/shared/imagemap/templates/imagemap-default.pt --- a/src/pyams_default_theme/shared/imagemap/templates/imagemap-default.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/shared/imagemap/templates/imagemap-default.pt Tue Jul 10 12:17:34 2018 +0200 @@ -2,10 +2,10 @@
+ tal:attributes="data-ams-plugin-pyams_content-src tales:resource_path('pyams_content.skin:pyams_content')"> + tal:attributes="src tales:absolute_url(image);" /> - + diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/shared/view/__init__.py --- a/src/pyams_default_theme/shared/view/__init__.py Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/shared/view/__init__.py Tue Jul 10 12:17:34 2018 +0200 @@ -34,4 +34,4 @@ @property def items(self): - return self.context.get_results(self.context) + return self.context.get_results(self.context, ignore_cache=True) diff -r d80fc625e4d8 -r 170cf23172b4 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 Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/shared/view/portlet/templates/view-items-list.pt Tue Jul 10 12:17:34 2018 +0200 @@ -1,5 +1,6 @@ diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/templates/layout.pt --- a/src/pyams_default_theme/templates/layout.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/templates/layout.pt Tue Jul 10 12:17:34 2018 +0200 @@ -1,21 +1,19 @@ - - + + - - - + - + + + @@ -24,28 +22,33 @@ - - - +
- -
+ + Header + Banner + + + +
- -
- - + +
+ + +
+ +
- + -
- + + Header + - - - +
diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/templates/preview-layout.pt --- a/src/pyams_default_theme/templates/preview-layout.pt Fri Jun 15 18:17:42 2018 +0200 +++ b/src/pyams_default_theme/templates/preview-layout.pt Tue Jul 10 12:17:34 2018 +0200 @@ -1,43 +1,46 @@ - - + - - - + - + + + - + - -
+
+ + +
- -
- - + +
+ + +
+ +
- + -
- +
diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/viewlet/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/viewlet/__init__.py Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,19 @@ +# +# Copyright (c) 2008-2017 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' + +# import standard library + +# import interfaces + +# import packages diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/viewlet/banner/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/viewlet/banner/__init__.py Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,38 @@ +# +# 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' + + +# import standard library + +# import interfaces +from pyams_content.features.header.interfaces import IHeaderTarget, IHeaderSettings +from pyams_default_theme.features.header.interfaces import ISimpleHeaderRendererSettings +from pyams_skin.layer import IPyAMSUserLayer + +# import packages +from pyams_template.template import template_config +from pyams_utils.traversing import get_parent +from pyams_viewlet.viewlet import contentprovider_config, ViewContentProvider +from zope.interface import Interface + + +@contentprovider_config(name='pyams.banner', layer=IPyAMSUserLayer, view=Interface) +@template_config(template='templates/banner.pt', layer=IPyAMSUserLayer) +class Banner(ViewContentProvider): + """Banner content provider""" + + @property + def settings(self): + target = get_parent(self.context, IHeaderTarget) + return ISimpleHeaderRendererSettings(IHeaderSettings(target).settings, None) diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/viewlet/banner/templates/banner.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/viewlet/banner/templates/banner.pt Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,12 @@ +
+
+
+ +
+ +
+
diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/viewlet/logo/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/viewlet/logo/__init__.py Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,37 @@ +# +# Copyright (c) 2008-2017 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' + +# import standard library + +# import interfaces +from pyams_content.features.header.interfaces import IHeaderTarget, IHeaderSettings +from pyams_default_theme.features.header import ISimpleHeaderRendererSettings +from pyams_skin.layer import IPyAMSUserLayer + +# import packages +from pyams_template.template import template_config +from pyams_utils.traversing import get_parent +from pyams_viewlet.viewlet import contentprovider_config, ViewContentProvider +from zope.interface import Interface + + +@contentprovider_config(name='pyams.logo', layer=IPyAMSUserLayer, view=Interface) +@template_config(template='templates/logo.pt', layer=IPyAMSUserLayer) +class LogoContentProvider(ViewContentProvider): + """Logo content provider""" + + @property + def settings(self): + target = get_parent(self.context, IHeaderTarget) + return ISimpleHeaderRendererSettings(IHeaderSettings(target).settings, None) diff -r d80fc625e4d8 -r 170cf23172b4 src/pyams_default_theme/viewlet/logo/templates/logo.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/viewlet/logo/templates/logo.pt Tue Jul 10 12:17:34 2018 +0200 @@ -0,0 +1,11 @@ + + + + + + +