Updated basic illustration edit form
authorThierry Florac <thierry.florac@onf.fr>
Thu, 30 Aug 2018 15:28:03 +0200
changeset 909 64e8226f8797
parent 908 e853c2a81d3f
child 910 175416eba4bd
Updated basic illustration edit form
src/pyams_content/component/illustration/zmi/__init__.py
--- a/src/pyams_content/component/illustration/zmi/__init__.py	Thu Aug 30 11:51:53 2018 +0200
+++ b/src/pyams_content/component/illustration/zmi/__init__.py	Thu Aug 30 15:28:03 2018 +0200
@@ -51,15 +51,31 @@
 
     css_class = 'form-group'
     padding_class = ''
-    fieldset_class = 'bordered margin-top-10 padding-y-5'
+    # fieldset_class = 'bordered margin-top-10 padding-y-5'
 
     legend = _("Illustration")
-    legend_class = 'illustration switcher no-y-padding padding-right-10'
+    # legend_class = 'illustration switcher no-y-padding padding-right-10'
 
     fields = field.Fields(IBasicIllustration).omit('__parent__', '__name__')
 
     weight = 10
 
+    @property
+    def legend_class(self):
+        if IBaseParagraph.providedBy(self.context):
+            return 'illustration switcher no-y-padding padding-right-10 pull-left width-auto'
+        else:
+            return 'illustration switcher no-y-padding'
+
+    @property
+    def fieldset_class(self):
+        result = 'margin-top-10 padding-y-5'
+        if not IBaseParagraph.providedBy(self.context):
+            result += ' bordered'
+        return result
+
+    hide_widgets_prefix_div = True
+
     def getContent(self):
         return IIllustration(self.context)
 
@@ -69,9 +85,10 @@
 
     @property
     def switcher_state(self):
-        content = self.getContent()
-        if content.has_data():
-            return 'open'
+        if not IBaseParagraph.providedBy(self.context):
+            content = self.getContent()
+            if content.has_data():
+                return 'open'
 
     def get_ajax_output(self, changes):
         output = super(BasicIllustrationPropertiesInnerEditForm, self).get_ajax_output(changes)
@@ -102,22 +119,6 @@
             return _("Header illustration")
 
     @property
-    def legend_class(self):
-        if IBaseParagraph.providedBy(self.context):
-            return 'illustration switcher no-y-padding padding-right-10 pull-left width-auto'
-        else:
-            return 'illustration switcher no-y-padding'
-
-    @property
-    def fieldset_class(self):
-        result = 'margin-top-10 padding-y-5'
-        if not IBaseParagraph.providedBy(self.context):
-            result += ' bordered'
-        return result
-
-    hide_widgets_prefix_div = True
-
-    @property
     def switcher_state(self):
         if not IBaseParagraph.providedBy(self.context):
             return 'open'