Added 'back_url' attribute in IPageHeader interface
authorThierry Florac <tflorac@ulthar.net>
Sat, 21 Feb 2015 13:52:31 +0100
changeset 1 7fc1c60c01eb
parent 0 bb4aabe07487
child 2 a0a4774f0ce9
Added 'back_url' attribute in IPageHeader interface
src/pyams_skin/interfaces/__init__.py
src/pyams_skin/templates/header.pt
--- a/src/pyams_skin/interfaces/__init__.py	Thu Feb 19 10:59:00 2015 +0100
+++ b/src/pyams_skin/interfaces/__init__.py	Sat Feb 21 13:52:31 2015 +0100
@@ -91,6 +91,8 @@
 class IPageHeader(Interface):
     """Page header interface used by 'header' content provider"""
 
+    back_url = TextLine(title="Back URL target")
+
     icon_class = TextLine(title='Icon CSS class')
 
     title = TextLine(title='Page title')
--- a/src/pyams_skin/templates/header.pt	Thu Feb 19 10:59:00 2015 +0100
+++ b/src/pyams_skin/templates/header.pt	Sat Feb 21 13:52:31 2015 +0100
@@ -1,6 +1,12 @@
 <tal:if define="header view.header"
 		condition="header">
-	<h1 class="page-title">
+	<h1 class="page-title" tal:define="back_url header.back_url | nothing">
+		<a class="font-xs hint" data-ams-target="#content"
+		   title="Back to previous page"
+		   tal:condition="back_url"
+		   tal:attributes="href back_url">
+			<i class="fa fa-fw fa-step-backward"></i>
+		</a>
 		<i tal:attributes="class header.icon_class"></i>
 		<tal:var content="header.title" />
 		<tal:if condition="header.subtitle">