src/pyams_portal/portlets/html/__init__.py
changeset 89 9a580d85a427
parent 67 d121b3645219
child 110 0560f0ceb80f
equal deleted inserted replaced
88:d44d666ca164 89:9a580d85a427
    14 
    14 
    15 
    15 
    16 # import standard library
    16 # import standard library
    17 
    17 
    18 # import interfaces
    18 # import interfaces
    19 from pyams_portal.interfaces import IPortalContext, IPortletRenderer
       
    20 from pyams_portal.portlets.html.interfaces import IRawPortletSettings, IHTMLPortletSettings
    19 from pyams_portal.portlets.html.interfaces import IRawPortletSettings, IHTMLPortletSettings
    21 from pyams_skin.layer import IPyAMSLayer
       
    22 from pyams_utils.interfaces import VIEW_PERMISSION
    20 from pyams_utils.interfaces import VIEW_PERMISSION
    23 
    21 
    24 # import packages
    22 # import packages
    25 from pyams_portal.portlet import PortletSettings, portlet_config, Portlet, PortletRenderer
    23 from pyams_portal.portlet import PortletSettings, portlet_config, Portlet
    26 from pyams_template.template import template_config
    24 from zope.interface import implementer
    27 from pyams_utils.adapter import adapter_config
       
    28 from zope.interface import implementer, Interface
       
    29 from zope.schema.fieldproperty import FieldProperty
    25 from zope.schema.fieldproperty import FieldProperty
    30 
    26 
    31 from pyams_portal import _
    27 from pyams_portal import _
    32 
    28 
    33 
    29 
    55     toolbar_css_class = 'fa fa-fw fa-2x fa-code'
    51     toolbar_css_class = 'fa fa-fw fa-2x fa-code'
    56 
    52 
    57     settings_class = RawPortletSettings
    53     settings_class = RawPortletSettings
    58 
    54 
    59 
    55 
    60 @adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, IRawPortletSettings), provides=IPortletRenderer)
       
    61 @template_config(template='html.pt', layer=IPyAMSLayer)
       
    62 class RawPortletDefaultRenderer(PortletRenderer):
       
    63     """Raw HTML portlet renderer"""
       
    64 
       
    65     label = _("Default code renderer")
       
    66 
       
    67 
       
    68 #
    56 #
    69 # Rich text portlet
    57 # Rich text portlet
    70 #
    58 #
    71 
    59 
    72 HTML_PORTLET_NAME = 'pyams_portal.portlet.html'
    60 HTML_PORTLET_NAME = 'pyams_portal.portlet.html'
    87     label = _("Rich text")
    75     label = _("Rich text")
    88 
    76 
    89     toolbar_css_class = 'fa fa-fw fa-2x fa-html5'
    77     toolbar_css_class = 'fa fa-fw fa-2x fa-html5'
    90 
    78 
    91     settings_class = HTMLPortletSettings
    79     settings_class = HTMLPortletSettings
    92 
       
    93 
       
    94 @adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, IHTMLPortletSettings), provides=IPortletRenderer)
       
    95 @template_config(template='html.pt', layer=IPyAMSLayer)
       
    96 class HTMLPortletDefaultRenderer(PortletRenderer):
       
    97     """Rich text portlet renderer"""
       
    98 
       
    99     label = _("Default text renderer")