Added optional monochrome image to logos
authorThierry Florac <thierry.florac@onf.fr>
Mon, 09 Jul 2018 12:03:36 +0200
changeset 811 7ead60a391c3
parent 810 7b5d910b2205
child 812 03b4a4125a9c
Added optional monochrome image to logos
src/pyams_content/shared/logo/__init__.py
src/pyams_content/shared/logo/interfaces/__init__.py
src/pyams_content/shared/logo/zmi/properties.py
--- a/src/pyams_content/shared/logo/__init__.py	Mon Jul 09 11:59:06 2018 +0200
+++ b/src/pyams_content/shared/logo/__init__.py	Mon Jul 09 12:03:36 2018 +0200
@@ -39,6 +39,7 @@
     content_name = LOGO_CONTENT_NAME
 
     image = FileProperty(IWfLogo['image'])
+    monochrome_image = FileProperty(IWfLogo['monochrome_image'])
     url = FieldProperty(IWfLogo['url'])
 
 register_content_type(WfLogo)
--- a/src/pyams_content/shared/logo/interfaces/__init__.py	Mon Jul 09 11:59:06 2018 +0200
+++ b/src/pyams_content/shared/logo/interfaces/__init__.py	Mon Jul 09 12:03:36 2018 +0200
@@ -47,6 +47,11 @@
                        description=_("Image data"),
                        required=True)
 
+    monochrome_image = ImageField(title=_("Monochrome image"),
+                                  description=_("An alternate image which can be used to some "
+                                                "presentation templates"),
+                                  required=False)
+
     url = URI(title=_("Target URL"),
               description=_("URL used to access external resource"),
               required=False)
--- a/src/pyams_content/shared/logo/zmi/properties.py	Mon Jul 09 11:59:06 2018 +0200
+++ b/src/pyams_content/shared/logo/zmi/properties.py	Mon Jul 09 12:03:36 2018 +0200
@@ -40,11 +40,11 @@
     legend = _("Main logo settings")
     fieldset_class = 'bordered no-x-margin margin-y-10'
 
-    fields = field.Fields(IWfLogo).select('image', 'url')
+    fields = field.Fields(IWfLogo).select('image', 'monochrome_image', 'url')
     weight = 1
 
     def get_ajax_output(self, changes):
-        if 'image' in changes.get(IWfLogo, ()):
+        if changes:
             return {
                 'status': 'reload',
                 'message': self.request.localizer.translate(self.successMessage)