# HG changeset patch # User Thierry Florac # Date 1545990656 -3600 # Node ID c12f6c3ac8091f62cb6c447e02e8f5544d053be3 # Parent 91448e5768610076a6ff3953f8d247d048a2dd41 Added "resource" shared content specificities diff -r 91448e576861 -r c12f6c3ac809 src/pyams_default_theme/shared/resource/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/shared/resource/__init__.py Fri Dec 28 10:50:56 2018 +0100 @@ -0,0 +1,56 @@ +# +# 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 pyams_content.shared.resource import IResourceInfo, IWfResource +from pyams_default_theme import lightbox +from pyams_default_theme.features.search.portlet import ISearchResultRenderer, WfSharedContentSearchResultRenderer +from pyams_default_theme.interfaces import ISearchResultsView +from pyams_default_theme.shared.common.interfaces import ICustomContentSpecificitiesParagraphRenderer, \ + ICustomContentSpecificitiesRenderer +from pyams_i18n.interfaces import II18n +from pyams_skin.layer import IPyAMSUserLayer +from pyams_template.template import template_config +from pyams_utils.adapter import adapter_config +from pyams_utils.text import text_to_html +from pyams_viewlet.viewlet import ViewContentProvider + + +@adapter_config(context=(IWfResource, IPyAMSUserLayer, Interface), + provides=ICustomContentSpecificitiesRenderer) +@adapter_config(context=(IWfResource, IPyAMSUserLayer, Interface), + provides=ICustomContentSpecificitiesParagraphRenderer) +@template_config(template='templates/specificities.pt', layer=IPyAMSUserLayer) +class ResourceSpecificitiesPortletRenderer(ViewContentProvider): + """Resource specificities portlet renderer""" + + resources = (lightbox,) + + @property + def resource_info(self): + return IResourceInfo(self.context) + + +@adapter_config(context=(IWfResource, IPyAMSUserLayer, ISearchResultsView), provides=ISearchResultRenderer) +@template_config(template='templates/search-result.pt', layer=IPyAMSUserLayer) +class WfResourceSearchResultRenderer(WfSharedContentSearchResultRenderer): + """Resource search result renderer""" + + @property + def header(self): + header = II18n(self.context).query_attribute('header', request=self.request) + if header: + return text_to_html(header) + return '' diff -r 91448e576861 -r c12f6c3ac809 src/pyams_default_theme/shared/resource/templates/search-result.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/shared/resource/templates/search-result.pt Fri Dec 28 10:50:56 2018 +0100 @@ -0,0 +1,25 @@ + + +
+ +

${i18n:context.title}

+
+
${structure:tales:tags(context)}
+
+ ${structure:tales:html(header)} +
+
+
diff -r 91448e576861 -r c12f6c3ac809 src/pyams_default_theme/shared/resource/templates/specificities.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/shared/resource/templates/specificities.pt Fri Dec 28 10:50:56 2018 +0100 @@ -0,0 +1,150 @@ +
+ + + +
+ + + +
Original country:
+
${country}
+
+ +
Author:
+
${author}
+
+ +
Drawer:
+
${drawer}
+
+ +
Colourist:
+
${colourist}
+
+ +
Lettering:
+
${lettering}
+
+ +
Producer:
+
${producer}
+
+ +
Director:
+
${director}
+
+ +
Actors:
+
${actors}
+
+ +
Editor:
+
${editor}
+
+ +
Collection:
+
${collection}
+
+ +
Series:
+
${series}
+
+ +
Volume:
+
${volume}
+
+ +
Format:
+
${format}
+
+ +
Release year:
+
${release_year}
+
+ +
Awards:
+
+
    +
  • ${line}
  • +
+
+
+ +
Number of pages:
+
${nb_pages}
+
+ +
Editor reference:
+
${editor_reference}
+
+ +
ISBN number:
+
${isbn_number}
+
+ +
Price:
+
${'{0:.2f}'.format(price)}
+
+
+
+
+
+
+ Summary +
${structure:tales:html(summary, 'oid_to_href;glossary')}
+
+
+ Synopsis +
${structure:tales:html(synopsis, 'oid_to_href;glossary')}
+
+
+ Publisher's words +
${structure:tales:html(publisher_words, 'oid_to_href;glossary')}
+
+
+
More resource info:
+
${source_url}
+
+
\ No newline at end of file