src/pyams_content/component/gallery/zmi/paragraph.py
changeset 395 2a39b333a585
parent 363 86d1a240d4dc
child 406 5527bc086216
equal deleted inserted replaced
394:1ebcb03e9bff 395:2a39b333a585
    13 __docformat__ = 'restructuredtext'
    13 __docformat__ = 'restructuredtext'
    14 
    14 
    15 
    15 
    16 # import standard library
    16 # import standard library
    17 
    17 
    18 from datetime import datetime
       
    19 
       
    20 # import interfaces
    18 # import interfaces
    21 from pyams_content.component.gallery.interfaces import IGalleryParagraph, IBaseGallery, IGalleryRenderer
    19 from pyams_content.component.gallery.interfaces import IGalleryParagraph, IBaseGallery
    22 from pyams_content.component.gallery.zmi.interfaces import IGalleryContentsView
    20 from pyams_content.component.gallery.zmi.interfaces import IGalleryContentsView
    23 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
    21 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
    24     IParagraphSummary
    22     IParagraphSummary
    25 from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
    23 from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
    26 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
    24 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
    33 
    31 
    34 # import packages
    32 # import packages
    35 from pyams_content.component.gallery.paragraph import Gallery
    33 from pyams_content.component.gallery.paragraph import Gallery
    36 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
    34 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
    37     BaseParagraphAddMenu, BaseParagraphPropertiesEditForm
    35     BaseParagraphAddMenu, BaseParagraphPropertiesEditForm
       
    36 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
    38 from pyams_content.shared.common.zmi import WfSharedContentPermissionMixin
    37 from pyams_content.shared.common.zmi import WfSharedContentPermissionMixin
    39 from pyams_pagelet.pagelet import pagelet_config
    38 from pyams_pagelet.pagelet import pagelet_config
    40 from pyams_skin.viewlet.toolbar import ToolbarAction
    39 from pyams_skin.viewlet.toolbar import ToolbarAction
    41 from pyams_template.template import template_config
    40 from pyams_template.template import template_config
    42 from pyams_utils.adapter import adapter_config
    41 from pyams_utils.adapter import adapter_config
    98 
    97 
    99     legend = _("Edit gallery properties")
    98     legend = _("Edit gallery properties")
   100     icon_css_class = 'fa fa-fw fa-picture-o'
    99     icon_css_class = 'fa fa-fw fa-picture-o'
   101 
   100 
   102     fields = field.Fields(IGalleryParagraph).omit('__parent__', '__name__', 'visible')
   101     fields = field.Fields(IGalleryParagraph).omit('__parent__', '__name__', 'visible')
       
   102     fields['renderer'].widgetFactory = RendererFieldWidget
       
   103 
   103     ajax_handler = 'properties.json'
   104     ajax_handler = 'properties.json'
   104     edit_permission = MANAGE_CONTENT_PERMISSION
   105     edit_permission = MANAGE_CONTENT_PERMISSION
   105 
   106 
   106     def updateWidgets(self, prefix=None):
   107     def updateWidgets(self, prefix=None):
   107         super(GalleryPropertiesEditForm, self).updateWidgets(prefix)
   108         super(GalleryPropertiesEditForm, self).updateWidgets(prefix)
   190 class GalleryParagraphSummary(BaseContentProvider):
   191 class GalleryParagraphSummary(BaseContentProvider):
   191     """Gallery summary"""
   192     """Gallery summary"""
   192 
   193 
   193     def __init__(self, context, request):
   194     def __init__(self, context, request):
   194         super(GalleryParagraphSummary, self).__init__(context, request)
   195         super(GalleryParagraphSummary, self).__init__(context, request)
   195         self.renderer = request.registry.queryMultiAdapter((context, request), IGalleryRenderer,
   196         self.renderer = self.context.get_renderer(request)
   196                                                            name=self.context.renderer)
       
   197 
   197 
   198     language = None
   198     language = None
   199 
   199 
   200     def update(self):
   200     def update(self):
   201         if self.renderer is not None:
   201         if self.renderer is not None: