src/pyams_content/shared/common/portlet/head.py
changeset 944 57841e1c4fa1
child 965 ba8e4e41aa59
equal deleted inserted replaced
943:81a89382c18a 944:57841e1c4fa1
       
     1 #
       
     2 # Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
       
     3 # All Rights Reserved.
       
     4 #
       
     5 # This software is subject to the provisions of the Zope Public License,
       
     6 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
       
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
       
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
       
    10 # FOR A PARTICULAR PURPOSE.
       
    11 #
       
    12 
       
    13 __docformat__ = 'restructuredtext'
       
    14 
       
    15 
       
    16 # import standard library
       
    17 
       
    18 # import interfaces
       
    19 from pyams_content.shared.common.portlet.interfaces import ISharedContentHeaderPortletSettings
       
    20 from pyams_utils.interfaces import VIEW_PERMISSION
       
    21 
       
    22 # import packages
       
    23 from pyams_portal.portlet import PortletSettings, portlet_config, Portlet
       
    24 from pyams_utils.factory import factory_config
       
    25 from zope.interface import implementer
       
    26 from zope.schema.fieldproperty import FieldProperty
       
    27 
       
    28 from pyams_content import _
       
    29 
       
    30 
       
    31 SHARED_CONTENT_HEADER_PORTLET_NAME = 'pyams_content.portlet.shared.header'
       
    32 
       
    33 
       
    34 @implementer(ISharedContentHeaderPortletSettings)
       
    35 @factory_config(provided=ISharedContentHeaderPortletSettings)
       
    36 class SharedContentHeaderPortletSettings(PortletSettings):
       
    37     """Shared content header portlet settings"""
       
    38 
       
    39     display_breadcrumbs = FieldProperty(ISharedContentHeaderPortletSettings['display_breadcrumbs'])
       
    40     display_title = FieldProperty(ISharedContentHeaderPortletSettings['display_title'])
       
    41     display_tags = FieldProperty(ISharedContentHeaderPortletSettings['display_tags'])
       
    42     display_header = FieldProperty(ISharedContentHeaderPortletSettings['display_header'])
       
    43 
       
    44 
       
    45 @portlet_config(permission=VIEW_PERMISSION)
       
    46 class SharedContentHeaderPortlet(Portlet):
       
    47     """Shared content header portlet"""
       
    48 
       
    49     name = SHARED_CONTENT_HEADER_PORTLET_NAME
       
    50     label = _("Content header")
       
    51 
       
    52     toolbar_css_class = 'fa fa-fw fa-2x fa-header'
       
    53 
       
    54     settings_factory = ISharedContentHeaderPortletSettings