breadcrumb, but it's hidden
authorTero Marttila <terom@fixme.fi>
Sat, 07 Feb 2009 05:12:57 +0200
changeset 28 b68145b5ce24
parent 27 2acfbbe14226
child 29 b06ff4c05d42
child 44 d09cc8b3709c
breadcrumb, but it's hidden
lib/helpers.py
static/style.css
templates/layout.tmpl
--- a/lib/helpers.py	Sat Feb 07 05:05:29 2009 +0200
+++ b/lib/helpers.py	Sat Feb 07 05:12:57 2009 +0200
@@ -13,3 +13,14 @@
 
     return time.strftime(config.DATETIME_FMT)
 
+def breadcrumb (trail, links=True) :
+    """
+        Returns a nicely formatted breadcrumb tail, optinally with links
+    """
+
+    return ' &raquo; '.join(
+        (
+            '<a href="$site_url/%s">%s</a>' % (page.url, page.title) if links else page.title
+        ) for page in trail
+    )
+
--- a/static/style.css	Sat Feb 07 05:05:29 2009 +0200
+++ b/static/style.css	Sat Feb 07 05:12:57 2009 +0200
@@ -99,6 +99,10 @@
     padding-right: 50px;
 }
 
+div#breadcrumb {
+    font-size: x-small;
+}
+
 /*
  * Footer
  */
--- a/templates/layout.tmpl	Sat Feb 07 05:05:29 2009 +0200
+++ b/templates/layout.tmpl	Sat Feb 07 05:12:57 2009 +0200
@@ -13,13 +13,9 @@
 </ul>
 </%def>
 
-<%def name="breadcumb(trail)">
-${' &raquo; '.join(pi.title for pi in trail)}
-</%def>
-
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
     <head>
-        <title>qmsk.net :: ${breadcumb(menu.ancestry)}</title>
+        <title>qmsk.net ${' :: ' + h.breadcrumb(menu.ancestry, links=False) if menu.ancestry else ''}</title>
         <link rel="Stylesheet" type="text/css" href="${site_root_url}/static/style.css" />
     </head>
     <body>
@@ -33,6 +29,9 @@
                 </div>
 
                 <div id="content">
+                    <div id="breadcrumb">
+                        <!-- ${h.breadcrumb(menu.ancestry)} -->
+                    </div>
                     ${page.content}
                 </div>