src/pyams_portal/portlets/html/__init__.py
changeset 110 0560f0ceb80f
parent 89 9a580d85a427
child 166 4a57e6e76d5f
equal deleted inserted replaced
109:1204c6c35575 110:0560f0ceb80f
    19 from pyams_portal.portlets.html.interfaces import IRawPortletSettings, IHTMLPortletSettings
    19 from pyams_portal.portlets.html.interfaces import IRawPortletSettings, IHTMLPortletSettings
    20 from pyams_utils.interfaces import VIEW_PERMISSION
    20 from pyams_utils.interfaces import VIEW_PERMISSION
    21 
    21 
    22 # import packages
    22 # import packages
    23 from pyams_portal.portlet import PortletSettings, portlet_config, Portlet
    23 from pyams_portal.portlet import PortletSettings, portlet_config, Portlet
       
    24 from pyams_utils.factory import factory_config
    24 from zope.interface import implementer
    25 from zope.interface import implementer
    25 from zope.schema.fieldproperty import FieldProperty
    26 from zope.schema.fieldproperty import FieldProperty
    26 
    27 
    27 from pyams_portal import _
    28 from pyams_portal import _
    28 
    29 
    33 
    34 
    34 RAW_PORTLET_NAME = 'pyams_portal.portlet.raw'
    35 RAW_PORTLET_NAME = 'pyams_portal.portlet.raw'
    35 
    36 
    36 
    37 
    37 @implementer(IRawPortletSettings)
    38 @implementer(IRawPortletSettings)
       
    39 @factory_config(provided=IRawPortletSettings)
    38 class RawPortletSettings(PortletSettings):
    40 class RawPortletSettings(PortletSettings):
    39     """Raw HTML code portlet settings"""
    41     """Raw HTML code portlet settings"""
    40 
    42 
    41     body = FieldProperty(IRawPortletSettings['body'])
    43     body = FieldProperty(IRawPortletSettings['body'])
    42 
    44 
    48     name = RAW_PORTLET_NAME
    50     name = RAW_PORTLET_NAME
    49     label = _("Raw HTML")
    51     label = _("Raw HTML")
    50 
    52 
    51     toolbar_css_class = 'fa fa-fw fa-2x fa-code'
    53     toolbar_css_class = 'fa fa-fw fa-2x fa-code'
    52 
    54 
    53     settings_class = RawPortletSettings
    55     settings_factory = IRawPortletSettings
    54 
    56 
    55 
    57 
    56 #
    58 #
    57 # Rich text portlet
    59 # Rich text portlet
    58 #
    60 #
    59 
    61 
    60 HTML_PORTLET_NAME = 'pyams_portal.portlet.html'
    62 HTML_PORTLET_NAME = 'pyams_portal.portlet.html'
    61 
    63 
    62 
    64 
    63 @implementer(IHTMLPortletSettings)
    65 @implementer(IHTMLPortletSettings)
       
    66 @factory_config(provided=IHTMLPortletSettings)
    64 class HTMLPortletSettings(PortletSettings):
    67 class HTMLPortletSettings(PortletSettings):
    65     """Rich text portlet settings"""
    68     """Rich text portlet settings"""
    66 
    69 
    67     body = FieldProperty(IHTMLPortletSettings['body'])
    70     body = FieldProperty(IHTMLPortletSettings['body'])
    68 
    71 
    72     """Rich text portlet"""
    75     """Rich text portlet"""
    73 
    76 
    74     name = HTML_PORTLET_NAME
    77     name = HTML_PORTLET_NAME
    75     label = _("Rich text")
    78     label = _("Rich text")
    76 
    79 
    77     toolbar_css_class = 'fa fa-fw fa-2x fa-html5'
    80     toolbar_css_class = 'fa fa-fw fa-2x fa-font'
    78 
    81 
    79     settings_class = HTMLPortletSettings
    82     settings_factory = IHTMLPortletSettings