diff -r 1f8629465141 -r 2375abafdeb1 src/pyams_content/shared/site/skin/folder.py --- 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 -# 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")