Added logo and icon to default configuration
authorThierry Florac <thierry.florac@onf.fr>
Wed, 20 May 2015 12:32:12 +0200
changeset 58 0fe2f8f8b90b
parent 57 fc253f455a90
child 59 3b9c4d71b30a
Added logo and icon to default configuration
src/pyams_skin/configuration.py
src/pyams_skin/interfaces/configuration.py
--- a/src/pyams_skin/configuration.py	Mon Apr 20 15:57:53 2015 +0200
+++ b/src/pyams_skin/configuration.py	Wed May 20 12:32:12 2015 +0200
@@ -9,6 +9,7 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
+from pyams_file.property import FileProperty
 
 __docformat__ = 'restructuredtext'
 
@@ -76,7 +77,7 @@
 class StaticConfigurationTalesExtension(ContextRequestViewAdapter):
     """extension:static_configuration TALES expression"""
 
-    def render(self, context):
+    def render(self, context=None):
         if context is None:
             context = self.context
         registry = self.request.registry
@@ -90,6 +91,8 @@
     title = FieldProperty(IConfiguration['title'])
     description = FieldProperty(IConfiguration['description'])
     author = FieldProperty(IConfiguration['author'])
+    icon = FileProperty(IConfiguration['icon'])
+    logo = FileProperty(IConfiguration['logo'])
 
 
 @adapter_config(context=IConfigurationManager, provides=IConfiguration)
@@ -110,7 +113,7 @@
 class ConfigurationTalesExtension(ContextRequestViewAdapter):
     """extension:configuration TALES expression"""
 
-    def render(self, context):
+    def render(self, context=None):
         if context is None:
             context = self.context
         manager = get_parent(context, IConfigurationManager)
--- a/src/pyams_skin/interfaces/configuration.py	Mon Apr 20 15:57:53 2015 +0200
+++ b/src/pyams_skin/interfaces/configuration.py	Wed May 20 12:32:12 2015 +0200
@@ -19,6 +19,7 @@
 from zope.location.interfaces import IContained
 
 # import packages
+from pyams_file.schema import ImageField
 from zope.interface import Interface, Attribute
 from zope.schema import TextLine, Choice, Bool
 
@@ -131,3 +132,11 @@
     author = TextLine(title=_("Author"),
                       description=_("Public author name"),
                       required=False)
+
+    icon = ImageField(title="Icon",
+                      description=_("Browser favourite icon"),
+                      required=False)
+
+    logo = ImageField(title=_("Logo"),
+                      description=_("Image containing application logo"),
+                      required=False)