Include copyright in simple footer
authorThierry Florac <thierry.florac@onf.fr>
Wed, 18 Jul 2018 09:23:18 +0200
changeset 101 9c1189405f90
parent 100 dd3a147af2d1
child 102 9821ede236b1
Include copyright in simple footer
src/pyams_default_theme/features/footer/__init__.py
src/pyams_default_theme/features/footer/interfaces.py
src/pyams_default_theme/features/footer/skin/templates/simple-footer.pt
--- a/src/pyams_default_theme/features/footer/__init__.py	Wed Jul 18 01:57:50 2018 +0200
+++ b/src/pyams_default_theme/features/footer/__init__.py	Wed Jul 18 09:23:18 2018 +0200
@@ -31,6 +31,7 @@
 from pyams_viewlet.viewlet import contentprovider_config, ViewContentProvider
 from zope.interface import implementer
 from zope.location import Location
+from zope.schema.fieldproperty import FieldProperty
 
 
 @contentprovider_config(name='pyams.footer', layer=IPyAMSDefaultLayer)
@@ -69,6 +70,8 @@
 class SimpleFooterRendererSettings(Persistent, Location):
     """Simple footer renderer settings"""
 
+    copyright = FieldProperty(ISimpleFooterRendererSettings['copyright'])
+
     @property
     def links(self):
         return get_annotation_adapter(self, SIMPLE_FOOTER_LINKS_KEY, Menu,
--- a/src/pyams_default_theme/features/footer/interfaces.py	Wed Jul 18 01:57:50 2018 +0200
+++ b/src/pyams_default_theme/features/footer/interfaces.py	Wed Jul 18 09:23:18 2018 +0200
@@ -20,11 +20,18 @@
 
 # import packages
 from zope.interface import Interface, Attribute
+from zope.schema import TextLine
+
+from pyams_default_theme import _
 
 
 class ISimpleFooterRendererSettings(IFooterRendererSettings):
     """Simple footer renderer settings"""
 
+    copyright = TextLine(title=_("Copyright"),
+                         description=_("Copyright mention displayed in page footer"),
+                         required=False)
+
     links = Attribute("Footer links")
 
 
--- a/src/pyams_default_theme/features/footer/skin/templates/simple-footer.pt	Wed Jul 18 01:57:50 2018 +0200
+++ b/src/pyams_default_theme/features/footer/skin/templates/simple-footer.pt	Wed Jul 18 09:23:18 2018 +0200
@@ -6,9 +6,10 @@
 				<a tal:define="info view.get_link_info(link);
 							   href link.get_url(request);"
 				   tal:condition="href"
-				   tal:content="info.user_title"
-				   tal:attributes="href href">Link</a>
+				   tal:attributes="href href">${info.user_title}</a>
 			</li>
 		</tal:loop>
+		<li role="presentation"
+			tal:condition="settings.copyright">${settings.copyright}</li>
 	</ul>
 </div>