Moved skin features to PyAMS default theme
authorThierry Florac <tflorac@ulthar.net>
Wed, 07 Nov 2018 17:49:35 +0100
changeset 1064 2375abafdeb1
parent 1063 1f8629465141
child 1065 50612c78ed2a
Moved skin features to PyAMS default theme
src/pyams_content/shared/site/skin/__init__.py
src/pyams_content/shared/site/skin/breadcrumb.py
src/pyams_content/shared/site/skin/folder.py
src/pyams_content/shared/site/skin/link.py
--- a/src/pyams_content/shared/site/skin/__init__.py	Wed Nov 07 17:43:55 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-#
-# 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'
--- a/src/pyams_content/shared/site/skin/breadcrumb.py	Wed Nov 07 17:43:55 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-#
-# 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'
-
-
-# import standard library
-
-# import interfaces
-from pyams_content.shared.site.interfaces import ISiteContainer
-from pyams_i18n.interfaces import II18n
-from pyams_skin.interfaces.viewlet import IBreadcrumbItem
-from pyams_skin.layer import IPyAMSUserLayer
-
-# import packages
-from pyams_skin.viewlet.breadcrumb import BreadcrumbItem
-from pyams_utils.adapter import adapter_config
-
-
-@adapter_config(context=(ISiteContainer, IPyAMSUserLayer), provides=IBreadcrumbItem)
-class SiteContainerBreadcumbAdapter(BreadcrumbItem):
-    """Site container breadcrumb adapter"""
-
-    @property
-    def label(self):
-        return II18n(self.context).query_attribute('short_name', request=self.request)
--- a/src/pyams_content/shared/site/skin/folder.py	Wed Nov 07 17:43:55 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-#
-# 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 pyams_content.shared.site import ISiteElementNavigation
-from pyams_content.shared.site.interfaces import ISiteFolder, IContentSummaryInfo
-from pyams_i18n.interfaces import II18n
-from pyams_skin.layer import IPyAMSUserLayer
-from pyams_utils.adapter import adapter_config, ContextRequestAdapter
-from pyams_workflow.interfaces import IWorkflowPublicationInfo
-
-
-from pyams_content import _
-
-
-@adapter_config(context=(ISiteFolder, IPyAMSUserLayer), provides=ISiteElementNavigation)
-class SiteFolderNavigationAdapter(ContextRequestAdapter):
-    """Site folder navigation adapter"""
-
-    @property
-    def visible(self):
-        if not self.context.visible_in_list:
-            return False
-        return IWorkflowPublicationInfo(self.context).is_visible(self.request)
-
-
-@adapter_config(context=(ISiteFolder, IPyAMSUserLayer), provides=IContentSummaryInfo)
-class SiteFolderSummaryAdapter(ContextRequestAdapter):
-    """Site folder summary adapter"""
-
-    @property
-    def title(self):
-        i18n = II18n(self.context)
-        return i18n.query_attribute('navigation_title', request=self.request) or \
-            i18n.query_attribute('title', request=self.request)
-
-    @property
-    def header(self):
-        try:
-            return II18n(self.context).query_attribute('header', request=self.request)
-        except AttributeError:
-            return None
-
-    button_title = _("Consult folder")
--- a/src/pyams_content/shared/site/skin/link.py	Wed Nov 07 17:43:55 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-#
-# 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 pyams_content.shared.site.interfaces import IContentLink, IContentSummaryInfo
-from pyams_i18n.interfaces import II18n
-from pyams_skin.layer import IPyAMSUserLayer
-from pyams_utils.adapter import adapter_config, ContextRequestAdapter
-from pyams_utils.interfaces.url import IRelativeURL
-
-from pyams_content import _
-
-
-@adapter_config(context=(IContentLink, IPyAMSUserLayer), provides=IRelativeURL)
-def content_link_relative_url(context, request):
-    """Content link relative URL"""
-    target = context.get_target()
-    if target is not None:
-        return request.registry.queryMultiAdapter((target, request), IRelativeURL)
-
-
-@adapter_config(context=(IContentLink, IPyAMSUserLayer), provides=IContentSummaryInfo)
-class ContentLinkSummaryAdapter(ContextRequestAdapter):
-    """Content link summary adapter"""
-
-    target_info = None
-
-    def __init__(self, context, request):
-        super(ContentLinkSummaryAdapter, self).__init__(context, request)
-        target = self.target = self.context.target
-        if target is not None:
-            self.target_info = request.registry.queryMultiAdapter((target, request), IContentSummaryInfo)
-
-    @property
-    def title(self):
-        title = II18n(self.context).query_attribute('navigation_title', request=self.request)
-        if (title is None) and (self.target_info is not None):
-            title = self.target_info.title
-        return title
-
-    @property
-    def header(self):
-        if self.target_info is not None:
-            return self.target_info.header
-
-    @property
-    def button_title(self):
-        if self.target_info is not None:
-            return self.target_info.button_title
-        else:
-            return self.request.localizer.translate(_("Consult content"))