# HG changeset patch # User Damien Correia # Date 1539095844 -7200 # Node ID 5276328160b3021703ccac1c382f1f3127deb5de # Parent 83facaf2246a96b0124b521bfeb4b8b03cce7e6e# Parent 73baccb50d24d1217eab9b324334e704e61ecd08 Merge default diff -r 83facaf2246a -r 5276328160b3 .hgtags --- a/.hgtags Fri Oct 05 14:13:25 2018 +0200 +++ b/.hgtags Tue Oct 09 16:37:24 2018 +0200 @@ -8,3 +8,5 @@ ca0bd32ae2f16385e77d9eb913a8af16e7614464 0.1.7 85907babe16b8cd8cfb64dadfb7203f23450d493 0.1.8 461fa3beb4386cf6764d60d59c4854fbba01833b 0.1.9 +d02350fa13e7d76393c414edecef40cd18cbb837 0.1.10 +9264287735a6f0538eb4580567e914cfb91383f2 0.1.11 diff -r 83facaf2246a -r 5276328160b3 buildout.cfg --- a/buildout.cfg Fri Oct 05 14:13:25 2018 +0200 +++ b/buildout.cfg Tue Oct 09 16:37:24 2018 +0200 @@ -79,4 +79,4 @@ eggs = pyams_default_theme [test] [versions] -pyams_default_theme = 0.1.10 +pyams_default_theme = 0.1.11 diff -r 83facaf2246a -r 5276328160b3 docs/HISTORY.txt --- a/docs/HISTORY.txt Fri Oct 05 14:13:25 2018 +0200 +++ b/docs/HISTORY.txt Tue Oct 09 16:37:24 2018 +0200 @@ -1,6 +1,17 @@ History ======= +0.1.11 +------ + - added method to pictograms paragraph renderer + - added internal link illustration adapter + - added interfaces and default adapters for banner and header illustrations + +0.1.10 +------ + - added base alerts content provider + - added and updated illustrations interfaces and adapters + 0.1.9 ----- - updated templates and renderers diff -r 83facaf2246a -r 5276328160b3 setup.py --- a/setup.py Fri Oct 05 14:13:25 2018 +0200 +++ b/setup.py Tue Oct 09 16:37:24 2018 +0200 @@ -22,7 +22,7 @@ README = os.path.join(DOCS, 'README.txt') HISTORY = os.path.join(DOCS, 'HISTORY.txt') -version = '0.1.10' +version = '0.1.11' long_description = open(README).read() + '\n\n' + open(HISTORY).read() tests_require = [] diff -r 83facaf2246a -r 5276328160b3 src/pyams_default_theme.egg-info/PKG-INFO --- a/src/pyams_default_theme.egg-info/PKG-INFO Fri Oct 05 14:13:25 2018 +0200 +++ b/src/pyams_default_theme.egg-info/PKG-INFO Tue Oct 09 16:37:24 2018 +0200 @@ -1,17 +1,27 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: pyams-default-theme -Version: 0.1.9 +Version: 0.1.11 Summary: PyAMS default theme Home-page: http://hg.ztfy.org/pyams/pyams_default_theme Author: Thierry Florac Author-email: tflorac@ulthar.net License: ZPL -Description-Content-Type: UNKNOWN Description: History ======= + 0.1.11 + ------ + - added method to pictograms paragraph renderer + - added internal link illustration adapter + - added interfaces and default adapters for banner and header illustrations + + 0.1.10 + ------ + - added base alerts content provider + - added and updated illustrations interfaces and adapters + 0.1.9 ----- - updated templates and renderers @@ -68,3 +78,4 @@ Classifier: Programming Language :: Python Classifier: Framework :: Pyramid Classifier: Topic :: Software Development :: Libraries :: Python Modules +Provides-Extra: test diff -r 83facaf2246a -r 5276328160b3 src/pyams_default_theme.egg-info/SOURCES.txt --- a/src/pyams_default_theme.egg-info/SOURCES.txt Fri Oct 05 14:13:25 2018 +0200 +++ b/src/pyams_default_theme.egg-info/SOURCES.txt Tue Oct 09 16:37:24 2018 +0200 @@ -74,6 +74,8 @@ src/pyams_default_theme/component/video/templates/external-video-default.pt src/pyams_default_theme/doctests/README.txt src/pyams_default_theme/features/__init__.py +src/pyams_default_theme/features/alert/__init__.py +src/pyams_default_theme/features/alert/templates/alerts.pt src/pyams_default_theme/features/footer/__init__.py src/pyams_default_theme/features/footer/interfaces.py src/pyams_default_theme/features/footer/skin/__init__.py diff -r 83facaf2246a -r 5276328160b3 src/pyams_default_theme/component/illustration/__init__.py --- a/src/pyams_default_theme/component/illustration/__init__.py Fri Oct 05 14:13:25 2018 +0200 +++ b/src/pyams_default_theme/component/illustration/__init__.py Tue Oct 09 16:37:24 2018 +0200 @@ -24,22 +24,25 @@ from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_content.interfaces import IBaseContent from pyams_content.root import ISiteRoot -from pyams_default_theme import _ 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 from pyams_utils.interfaces.tales import ITALESExtension +from pyams_default_theme import _ + # # Illustrations adapters # +@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()): @@ -55,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: @@ -67,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) # diff -r 83facaf2246a -r 5276328160b3 src/pyams_default_theme/component/paragraph/interfaces/frame.py --- a/src/pyams_default_theme/component/paragraph/interfaces/frame.py Fri Oct 05 14:13:25 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/interfaces/frame.py Tue Oct 09 16:37:24 2018 +0200 @@ -12,16 +12,11 @@ __docformat__ = 'restructuredtext' - -# import standard library +from zope.interface import Attribute, Interface +from zope.schema import Bool, Choice +from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary -# import interfaces -from pyams_content.reference.pictograms.interfaces import PICTOGRAM_VOCABULARY - -# import packages -from zope.interface import Interface, Attribute -from zope.schema import Bool, Choice -from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm +from pyams_content.reference.pictograms.interfaces import SELECTED_PICTOGRAM_VOCABULARY from pyams_default_theme import _ @@ -58,7 +53,7 @@ pictogram_name = Choice(title=_("Pictogram"), description=_("Name of the pictogram associated with this frame paragraph"), required=False, - vocabulary=PICTOGRAM_VOCABULARY) + vocabulary=SELECTED_PICTOGRAM_VOCABULARY) pictogram = Attribute("Selected pictogram object") diff -r 83facaf2246a -r 5276328160b3 src/pyams_default_theme/component/paragraph/pictogram.py --- a/src/pyams_default_theme/component/paragraph/pictogram.py Fri Oct 05 14:13:25 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/pictogram.py Tue Oct 09 16:37:24 2018 +0200 @@ -12,16 +12,10 @@ __docformat__ = 'restructuredtext' - -# import standard library - -# import interfaces -from pyams_content.component.paragraph.interfaces.pictogram import IPictogramParagraph, IPictogramContainer +from pyams_content.component.paragraph.interfaces.pictogram import IPictogramContainer, IPictogramParagraph from pyams_content.features.renderer.interfaces import IContentRenderer +from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_skin.layer import IPyAMSLayer - -# import packages -from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config @@ -42,4 +36,4 @@ @property def pictograms(self): - return IPictogramContainer(self.context) + yield from IPictogramContainer(self.context).get_visible_items() diff -r 83facaf2246a -r 5276328160b3 src/pyams_default_theme/component/paragraph/templates/html-default.pt --- a/src/pyams_default_theme/component/paragraph/templates/html-default.pt Fri Oct 05 14:13:25 2018 +0200 +++ b/src/pyams_default_theme/component/paragraph/templates/html-default.pt Tue Oct 09 16:37:24 2018 +0200 @@ -1,8 +1,8 @@ ${structure:view.render_illustration()} -

${view.title}

+

${view.title}

${structure:view.render_illustration()}
${structure:tales:html(view.body, 'oid_to_href')}
${structure:view.render_illustration()} diff -r 83facaf2246a -r 5276328160b3 src/pyams_default_theme/interfaces/__init__.py --- a/src/pyams_default_theme/interfaces/__init__.py Fri Oct 05 14:13:25 2018 +0200 +++ b/src/pyams_default_theme/interfaces/__init__.py Tue Oct 09 16:37:24 2018 +0200 @@ -27,6 +27,10 @@ """Content date interface""" +class IContentBannerIllustration(Interface): + """Content banner illustration adapter interface""" + + class IContentHeaderIllustration(Interface): """Content header illustration adapter interface"""