src/pyams_content/component/illustration/zmi/paragraph.py
changeset 1124 de6e9b0637b6
parent 1106 7a431c7ffcef
child 1243 837612af4dc3
equal deleted inserted replaced
1123:6f299ad6e72f 1124:de6e9b0637b6
    15 from transaction.interfaces import ITransactionManager
    15 from transaction.interfaces import ITransactionManager
    16 from z3c.form import button, field
    16 from z3c.form import button, field
    17 from z3c.form.interfaces import INPUT_MODE
    17 from z3c.form.interfaces import INPUT_MODE
    18 from zope.interface import implementer
    18 from zope.interface import implementer
    19 
    19 
       
    20 from pyams_content.component.illustration import IBasicIllustration
    20 from pyams_content.component.illustration.interfaces import IBasicIllustrationTarget, IIllustration, \
    21 from pyams_content.component.illustration.interfaces import IBasicIllustrationTarget, IIllustration, \
    21     IIllustrationParagraph, ILLUSTRATION_PARAGRAPH_TYPE
    22     IIllustrationParagraph, ILLUSTRATION_PARAGRAPH_TYPE
    22 from pyams_content.component.illustration.paragraph import Illustration
    23 from pyams_content.component.illustration.paragraph import Illustration
    23 from pyams_content.component.paragraph.interfaces import IParagraphContainer, IParagraphContainerTarget
    24 from pyams_content.component.paragraph.interfaces import IParagraphContainer, IParagraphContainerTarget
    24 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
    25 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
   100 
   101 
   101     edit_permission = MANAGE_CONTENT_PERMISSION
   102     edit_permission = MANAGE_CONTENT_PERMISSION
   102 
   103 
   103     def get_ajax_output(self, changes):
   104     def get_ajax_output(self, changes):
   104         output = super(self.__class__, self).get_ajax_output(changes)
   105         output = super(self.__class__, self).get_ajax_output(changes)
   105         if 'title' in changes.get(IIllustration, ()):
   106         if 'title' in changes.get(IBasicIllustration, ()):
   106             output.setdefault('events', []).append(get_json_paragraph_refresh_event(self.context, self.request))
   107             output.setdefault('events', []).append(get_json_paragraph_refresh_event(self.context, self.request))
   107         return output
   108         return output
   108 
   109 
   109 
   110 
   110 @adapter_config(context=(IIllustrationParagraph, IPyAMSLayer), provides=IParagraphInnerEditor)
   111 @adapter_config(context=(IIllustrationParagraph, IPyAMSLayer), provides=IParagraphInnerEditor)
   123         else:
   124         else:
   124             return button.Buttons()
   125             return button.Buttons()
   125 
   126 
   126     def get_ajax_output(self, changes):
   127     def get_ajax_output(self, changes):
   127         output = super(self.__class__, self).get_ajax_output(changes)
   128         output = super(self.__class__, self).get_ajax_output(changes)
   128         updated = changes.get(IIllustration, ())
   129         updated = changes.get(IBasicIllustration, ())
   129         if 'title' in updated:
   130         if 'title' in updated:
   130             output.setdefault('events', []).append(get_json_paragraph_refresh_event(self.context, self.request))
   131             output.setdefault('events', []).append(get_json_paragraph_refresh_event(self.context, self.request))
   131         updated = changes.get(IIllustrationParagraph, ())
   132         updated = changes.get(IIllustrationParagraph, ())
   132         if 'data' in updated:
   133         if 'data' in updated:
   133             # we have to commit transaction to be able to handle blobs...
   134             # we have to commit transaction to be able to handle blobs...