Updated content link summary adapter
authorThierry Florac <thierry.florac@onf.fr>
Fri, 16 Nov 2018 11:24:35 +0100
changeset 223 615c0a774971
parent 222 fa1df486025b
child 224 d1189038613e
Updated content link summary adapter
src/pyams_default_theme/shared/site/link.py
--- a/src/pyams_default_theme/shared/site/link.py	Fri Nov 16 08:24:37 2018 +0100
+++ b/src/pyams_default_theme/shared/site/link.py	Fri Nov 16 11:24:35 2018 +0100
@@ -19,7 +19,7 @@
 from pyams_utils.adapter import ContextRequestAdapter, adapter_config
 from pyams_utils.interfaces.url import IRelativeURL
 
-from pyams_content import _
+from pyams_default_theme import _
 
 
 @adapter_config(context=(IContentLink, IPyAMSUserLayer), provides=IRelativeURL)
@@ -45,18 +45,22 @@
     @property
     def title(self):
         title = II18n(self.context).query_attribute('navigation_title', request=self.request)
-        if (title is None) and (self.target_info is not None):
+        if (not title) and (self.target_info is not None):
             title = self.target_info.title
         return title
 
     @property
     def header(self):
-        if self.target_info is not None:
-            return self.target_info.header
+        header = II18n(self.context).query_attribute('navigation_header', request=self.request)
+        if (not header) and (self.target_info is not None):
+            header = self.target_info.header
+        return header
 
     @property
     def button_title(self):
+        title = None
         if self.target_info is not None:
-            return self.target_info.button_title
-        else:
-            return self.request.localizer.translate(_("Consult content"))
+            title = self.target_info.button_title
+        if not title:
+            title = _("Consult content")
+        return self.request.localizer.translate(title)