Added object data to illustration properties action
authorThierry Florac <thierry.florac@onf.fr>
Tue, 06 Feb 2018 14:55:32 +0100
changeset 360 e47b68b41f06
parent 359 b21d74ececb1
child 361 68f6464a97ea
Added object data to illustration properties action
src/pyams_content/component/illustration/zmi/__init__.py
--- a/src/pyams_content/component/illustration/zmi/__init__.py	Tue Feb 06 13:56:35 2018 +0100
+++ b/src/pyams_content/component/illustration/zmi/__init__.py	Tue Feb 06 14:55:32 2018 +0100
@@ -22,17 +22,21 @@
 from pyams_i18n.interfaces import II18n
 from pyams_skin.layer import IPyAMSLayer
 from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
+from pyams_utils.interfaces.data import IObjectData
 from pyams_zmi.interfaces import IPropertiesEditForm
 from transaction.interfaces import ITransactionManager
 
 # import packages
+from pyams_content.skin import pyams_content
 from pyams_form.security import ProtectedFormObjectMixin
 from pyams_skin.viewlet.toolbar import JsToolbarAction
 from pyams_template.template import get_view_template, template_config
 from pyams_utils.adapter import ContextRequestAdapter, adapter_config
+from pyams_utils.fanstatic import get_resource_path
 from pyams_viewlet.viewlet import viewlet_config, Viewlet
 from pyams_zmi.form import InnerAdminEditForm
 from z3c.form import field
+from zope.interface import implementer
 
 from pyams_content import _
 
@@ -184,6 +188,7 @@
 
 @viewlet_config(name='add-illustration.action', context=IIllustrationTarget, layer=IPyAMSLayer,
                 view=IllustrationPropertiesInnerEditForm, manager=IWidgetsPrefixViewletsManager)
+@implementer(IObjectData)
 class AddIllustrationAction(ProtectedFormObjectMixin, JsToolbarAction):
     """Add illustration action"""
 
@@ -199,6 +204,13 @@
                     return None
         return JsToolbarAction.__new__(cls)
 
+    @property
+    def object_data(self):
+        return {
+            'ams-plugins': 'pyams_content',
+            'ams-plugin-pyams_content-src': get_resource_path(pyams_content)
+        }
+
 
 @viewlet_config(name='illustration-thumbnail', context=IIllustrationTarget, layer=IPyAMSLayer,
                 view=IllustrationPropertiesInnerEditForm, manager=IWidgetsPrefixViewletsManager)