Added site summary portlet renderer
authorThierry Florac <thierry.florac@onf.fr>
Mon, 22 Oct 2018 17:11:06 +0200
changeset 187 7703779a6b50
parent 186 a5bff486fe82
child 188 e31ee81d146f
Added site summary portlet renderer
src/pyams_default_theme/locales/fr/LC_MESSAGES/pyams_default_theme.mo
src/pyams_default_theme/locales/fr/LC_MESSAGES/pyams_default_theme.po
src/pyams_default_theme/locales/pyams_default_theme.pot
src/pyams_default_theme/shared/site/__init__.py
src/pyams_default_theme/shared/site/portlet/__init__.py
src/pyams_default_theme/shared/site/portlet/templates/site-summary.pt
Binary file src/pyams_default_theme/locales/fr/LC_MESSAGES/pyams_default_theme.mo has changed
--- a/src/pyams_default_theme/locales/fr/LC_MESSAGES/pyams_default_theme.po	Thu Oct 18 15:24:22 2018 +0200
+++ b/src/pyams_default_theme/locales/fr/LC_MESSAGES/pyams_default_theme.po	Mon Oct 22 17:11:06 2018 +0200
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-09-25 11:23+0200\n"
+"POT-Creation-Date: 2018-10-22 16:36+0200\n"
 "PO-Revision-Date: 2017-06-07 12:41+0200\n"
 "Last-Translator: Thierry Florac <tflorac@ulthar.net>\n"
 "Language-Team: French\n"
@@ -36,19 +36,19 @@
 msgid "Vertical list"
 msgstr "Liste verticale"
 
-#: src/pyams_default_theme/component/illustration/__init__.py:76
+#: src/pyams_default_theme/component/illustration/__init__.py:171
 msgid "Centered illustration before text"
 msgstr "Illustration centrée avant le texte"
 
-#: src/pyams_default_theme/component/illustration/__init__.py:87
+#: src/pyams_default_theme/component/illustration/__init__.py:182
 msgid "Small illustration on the left"
 msgstr "Illustration sur la gauche"
 
-#: src/pyams_default_theme/component/illustration/__init__.py:99
+#: src/pyams_default_theme/component/illustration/__init__.py:194
 msgid "Small illustration on the right"
 msgstr "Illustration sur la droite"
 
-#: src/pyams_default_theme/component/illustration/__init__.py:111
+#: src/pyams_default_theme/component/illustration/__init__.py:206
 msgid "Centered illustration after text"
 msgstr "Illustration centrée après le texte"
 
@@ -79,7 +79,7 @@
 msgid "Default video renderer"
 msgstr "Par défaut"
 
-#: src/pyams_default_theme/component/paragraph/pictogram.py:40
+#: src/pyams_default_theme/component/paragraph/pictogram.py:34
 msgid "Default pictograms renderer"
 msgstr "Par défaut"
 
@@ -87,29 +87,29 @@
 msgid "Default audio renderer"
 msgstr "Par défaut"
 
-#: src/pyams_default_theme/component/paragraph/frame.py:164
+#: src/pyams_default_theme/component/paragraph/frame.py:152
 msgid "Default frame renderer"
 msgstr "Encadré en pleine largeur (par défaut)"
 
-#: src/pyams_default_theme/component/paragraph/frame.py:175
-#: src/pyams_default_theme/component/paragraph/verbatim.py:114
+#: src/pyams_default_theme/component/paragraph/frame.py:163
+#: src/pyams_default_theme/component/paragraph/verbatim.py:84
 msgid "Small frame on the left"
 msgstr "Encadré placé sur la gauche"
 
-#: src/pyams_default_theme/component/paragraph/frame.py:186
-#: src/pyams_default_theme/component/paragraph/verbatim.py:125
+#: src/pyams_default_theme/component/paragraph/frame.py:174
+#: src/pyams_default_theme/component/paragraph/verbatim.py:95
 msgid "Small frame on the right"
 msgstr "Encadré placé sur la droite"
 
-#: src/pyams_default_theme/component/paragraph/verbatim.py:103
+#: src/pyams_default_theme/component/paragraph/verbatim.py:75
 msgid "Default verbatim renderer"
 msgstr "Encadré en pleine largeur (par défaut)"
 
-#: src/pyams_default_theme/component/paragraph/html.py:39
+#: src/pyams_default_theme/component/paragraph/html.py:35
 msgid "Default raw HTML renderer"
 msgstr "Par défaut"
 
-#: src/pyams_default_theme/component/paragraph/html.py:53
+#: src/pyams_default_theme/component/paragraph/html.py:49
 msgid "Default rich text renderer"
 msgstr "Par défaut"
 
@@ -137,74 +137,63 @@
 msgid "Use default configuration?"
 msgstr "Utiliser la configuration par défaut ?"
 
-#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:30
-#: src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:28
+#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:25
+#: src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:22
 #: src/pyams_default_theme/component/paragraph/interfaces/contact.py:29
 msgid "Left"
 msgstr "Gauche"
 
-#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:31
-#: src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:29
+#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:26
+#: src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:23
 #: src/pyams_default_theme/component/paragraph/interfaces/contact.py:30
 msgid "Right"
 msgstr "Droite"
 
-#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:32
-#: src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:30
+#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:27
+#: src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:24
 msgid "Center (full width)"
 msgstr "Centré (pleine largeur)"
 
-#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:42
-#: src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:40
-msgid "Show illustration?"
-msgstr "Afficher l'illustration ?"
-
-#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:43
-#: src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:41
-msgid "If 'no', illustration will not be displayed"
-msgstr ""
-"Si 'non', l'illustration ne sera pas affichée même si un contenu a été fourni"
-
-#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:50
+#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:37
 msgid "Show associations?"
 msgstr "Afficher les liens et pièces jointes ?"
 
-#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:51
+#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:38
 msgid "If 'no', associations will not be displayed"
 msgstr ""
 "Si 'non', les liens et pièces jointes ne seront pas affichés même s'il "
 "existe des éléments visibles"
 
-#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:58
+#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:45
 msgid "Pictogram"
 msgstr "Pictogramme"
 
-#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:59
+#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:46
 msgid "Name of the pictogram associated with this frame paragraph"
 msgstr "Nom du pictogramme associé à cet encadré"
 
-#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:73
-#: src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:56
+#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:60
+#: src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:34
 msgid "Relative width"
 msgstr "Largeur relative"
 
-#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:74
+#: src/pyams_default_theme/component/paragraph/interfaces/frame.py:61
 msgid ""
 "Relative width used by this frame, relative to it's parent, given as columns "
 "count; full width counts for 12 columns"
 msgstr ""
-"Largeur relative de ce bloc par rapport au bloc dans lequel il s'intègre. Cette largeur "
-"est indiquée en nombre de colonnes, la largeur totale étant de 12 "
-"colonnes."
+"Largeur relative de ce bloc par rapport au bloc dans lequel il s'intègre. "
+"Cette largeur est indiquée en nombre de colonnes, la largeur totale étant de "
+"12 colonnes."
 
-#: src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:57
+#: src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:35
 msgid ""
 "Relative width used by this paragraph, relative to it's parent, given as "
 "columns count; full width counts for 12 columns"
 msgstr ""
-"Largeur relative de ce bloc par rapport au bloc dans lequel il s'intègre. Cette largeur "
-"est indiquée en nombre de colonnes, la largeur totale étant de 12 "
-"colonnes."
+"Largeur relative de ce bloc par rapport au bloc dans lequel il s'intègre. "
+"Cette largeur est indiquée en nombre de colonnes, la largeur totale étant de "
+"12 colonnes."
 
 #: src/pyams_default_theme/component/paragraph/interfaces/contact.py:40
 msgid "Show photo?"
@@ -234,11 +223,11 @@
 msgid "Map position"
 msgstr "Position de la carte"
 
-#: src/pyams_default_theme/component/association/__init__.py:47
+#: src/pyams_default_theme/component/association/__init__.py:44
 msgid "Default associations renderer"
 msgstr "Par défaut"
 
-#: src/pyams_default_theme/component/association/__init__.py:88
+#: src/pyams_default_theme/component/association/__init__.py:97
 msgid "Include remote content"
 msgstr "Include les blocs de contenu distants"
 
@@ -280,7 +269,7 @@
 "Si 'oui', seuls les blocs de contenu désignés comme ancres seront "
 "sélectionnés"
 
-#: src/pyams_default_theme/shared/common/portlet/title.py:38
+#: src/pyams_default_theme/shared/common/portlet/title.py:37
 msgid "Default title renderer"
 msgstr "Par défaut"
 
@@ -310,6 +299,10 @@
 msgid "Image map preview"
 msgstr "Aperçu des zones cliquables"
 
+#: src/pyams_default_theme/shared/site/portlet/__init__.py:34
+msgid "Site container summary"
+msgstr "Par défaut"
+
 #: src/pyams_default_theme/shared/logo/__init__.py:39
 msgid "Default logos renderer"
 msgstr "Par défaut"
@@ -390,6 +383,14 @@
 msgid "PyAMS simple header with banner and tabs"
 msgstr "PyAMS: en-tête simple avec bandeau et onglets de navigation"
 
+#~ msgid "Show illustration?"
+#~ msgstr "Afficher l'illustration ?"
+
+#~ msgid "If 'no', illustration will not be displayed"
+#~ msgstr ""
+#~ "Si 'non', l'illustration ne sera pas affichée même si un contenu a été "
+#~ "fourni"
+
 #~ msgid "Search..."
 #~ msgstr "Chercher..."
 
--- a/src/pyams_default_theme/locales/pyams_default_theme.pot	Thu Oct 18 15:24:22 2018 +0200
+++ b/src/pyams_default_theme/locales/pyams_default_theme.pot	Mon Oct 22 17:11:06 2018 +0200
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-09-25 11:23+0200\n"
+"POT-Creation-Date: 2018-10-22 16:36+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -36,19 +36,19 @@
 msgid "Vertical list"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/illustration/__init__.py:76
+#: ./src/pyams_default_theme/component/illustration/__init__.py:171
 msgid "Centered illustration before text"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/illustration/__init__.py:87
+#: ./src/pyams_default_theme/component/illustration/__init__.py:182
 msgid "Small illustration on the left"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/illustration/__init__.py:99
+#: ./src/pyams_default_theme/component/illustration/__init__.py:194
 msgid "Small illustration on the right"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/illustration/__init__.py:111
+#: ./src/pyams_default_theme/component/illustration/__init__.py:206
 msgid "Centered illustration after text"
 msgstr ""
 
@@ -77,7 +77,7 @@
 msgid "Default video renderer"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/pictogram.py:40
+#: ./src/pyams_default_theme/component/paragraph/pictogram.py:34
 msgid "Default pictograms renderer"
 msgstr ""
 
@@ -85,29 +85,29 @@
 msgid "Default audio renderer"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/frame.py:164
+#: ./src/pyams_default_theme/component/paragraph/frame.py:152
 msgid "Default frame renderer"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/frame.py:175
-#: ./src/pyams_default_theme/component/paragraph/verbatim.py:114
+#: ./src/pyams_default_theme/component/paragraph/frame.py:163
+#: ./src/pyams_default_theme/component/paragraph/verbatim.py:84
 msgid "Small frame on the left"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/frame.py:186
-#: ./src/pyams_default_theme/component/paragraph/verbatim.py:125
+#: ./src/pyams_default_theme/component/paragraph/frame.py:174
+#: ./src/pyams_default_theme/component/paragraph/verbatim.py:95
 msgid "Small frame on the right"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/verbatim.py:103
+#: ./src/pyams_default_theme/component/paragraph/verbatim.py:75
 msgid "Default verbatim renderer"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/html.py:39
+#: ./src/pyams_default_theme/component/paragraph/html.py:35
 msgid "Default raw HTML renderer"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/html.py:53
+#: ./src/pyams_default_theme/component/paragraph/html.py:49
 msgid "Default rich text renderer"
 msgstr ""
 
@@ -135,61 +135,51 @@
 msgid "Use default configuration?"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:30
-#: ./src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:28
+#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:25
+#: ./src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:22
 #: ./src/pyams_default_theme/component/paragraph/interfaces/contact.py:29
 msgid "Left"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:31
-#: ./src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:29
+#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:26
+#: ./src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:23
 #: ./src/pyams_default_theme/component/paragraph/interfaces/contact.py:30
 msgid "Right"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:32
-#: ./src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:30
+#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:27
+#: ./src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:24
 msgid "Center (full width)"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:42
-#: ./src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:40
-msgid "Show illustration?"
-msgstr ""
-
-#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:43
-#: ./src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:41
-msgid "If 'no', illustration will not be displayed"
-msgstr ""
-
-#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:50
+#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:37
 msgid "Show associations?"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:51
+#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:38
 msgid "If 'no', associations will not be displayed"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:58
+#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:45
 msgid "Pictogram"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:59
+#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:46
 msgid "Name of the pictogram associated with this frame paragraph"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:73
-#: ./src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:56
+#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:60
+#: ./src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:34
 msgid "Relative width"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:74
+#: ./src/pyams_default_theme/component/paragraph/interfaces/frame.py:61
 msgid ""
 "Relative width used by this frame, relative to it's parent, given as columns "
 "count; full width counts for 12 columns"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:57
+#: ./src/pyams_default_theme/component/paragraph/interfaces/verbatim.py:35
 msgid ""
 "Relative width used by this paragraph, relative to it's parent, given as "
 "columns count; full width counts for 12 columns"
@@ -219,11 +209,11 @@
 msgid "Map position"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/association/__init__.py:47
+#: ./src/pyams_default_theme/component/association/__init__.py:44
 msgid "Default associations renderer"
 msgstr ""
 
-#: ./src/pyams_default_theme/component/association/__init__.py:88
+#: ./src/pyams_default_theme/component/association/__init__.py:97
 msgid "Include remote content"
 msgstr ""
 
@@ -261,7 +251,7 @@
 msgid "If 'yes', only paragraphs set as 'anchors' will be selected"
 msgstr ""
 
-#: ./src/pyams_default_theme/shared/common/portlet/title.py:38
+#: ./src/pyams_default_theme/shared/common/portlet/title.py:37
 msgid "Default title renderer"
 msgstr ""
 
@@ -289,6 +279,10 @@
 msgid "Image map preview"
 msgstr ""
 
+#: ./src/pyams_default_theme/shared/site/portlet/__init__.py:34
+msgid "Site container summary"
+msgstr ""
+
 #: ./src/pyams_default_theme/shared/logo/__init__.py:39
 msgid "Default logos renderer"
 msgstr ""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_default_theme/shared/site/__init__.py	Mon Oct 22 17:11:06 2018 +0200
@@ -0,0 +1,15 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# 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'
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_default_theme/shared/site/portlet/__init__.py	Mon Oct 22 17:11:06 2018 +0200
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# 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.site.interfaces import IContentSummaryInfo, ISiteContainer
+from pyams_content.shared.site.portlet import ISiteContainerSummaryPortletSettings
+from pyams_portal.interfaces import IPortalContext, IPortletRenderer
+from pyams_portal.portlet import PortletRenderer
+from pyams_skin.layer import IPyAMSLayer
+from pyams_template.template import template_config
+from pyams_utils.adapter import adapter_config
+
+from pyams_default_theme import _
+
+
+@adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, ISiteContainerSummaryPortletSettings),
+                provides=IPortletRenderer)
+@template_config(template='templates/site-summary.pt', layer=IPyAMSLayer)
+class SiteContainerSummaryPortletDefaultRenderer(PortletRenderer):
+    """Site container summary portlet default renderer"""
+
+    label = _("Site container summary")
+
+    @property
+    def visible_items(self):
+        container = ISiteContainer(self.context, None)
+        if container is not None:
+            registry = self.request.registry
+            yield from filter(lambda x: x is not None,
+                              [registry.queryMultiAdapter((item, self.request), IContentSummaryInfo)
+                               for item in container.get_visible_items(self.request)])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_default_theme/shared/site/portlet/templates/site-summary.pt	Mon Oct 22 17:11:06 2018 +0200
@@ -0,0 +1,28 @@
+<div tal:define="settings view.settings;
+				 button_title i18n:settings.button_title;">
+	<div class="row summary">
+		<div tal:repeat="item view.visible_items">
+			<div class="thumbnail pull-left">
+				<tal:var define="illustration tales:pyams_illustration(item.context)"
+						 condition="illustration">
+					<tal:var define="image i18n:illustration.data;
+									 alt i18n:illustration.alt_title;"
+							 condition="image">
+						${structure:tales:picture(image, lg_thumb='pano', lg_width=3, md_thumb='pano', md_width=3, sm_thumb='pano',
+												  sm_width=4, xs_thumb='pano', xs_width=12, alt=alt, css_class='result_media')}
+					</tal:var>
+				</tal:var>
+			</div>
+			<div>
+				<h2>${item.title}</h2>
+				<div class="header">${item.header}</div>
+				<div class="action">
+					<a href="${tales:relative_url(item.context)}">
+						<span i18n:translate="">${button_title or item.button_title}</span>
+					</a>
+				</div>
+			</div>
+		<div class="clearfix"></div>
+		</div>
+	</div>
+</div>