]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
webish: make each link in the directory name an href to that directory
authorBrian Warner <warner@allmydata.com>
Fri, 29 Jun 2007 18:17:18 +0000 (11:17 -0700)
committerBrian Warner <warner@allmydata.com>
Fri, 29 Jun 2007 18:17:18 +0000 (11:17 -0700)
src/allmydata/web/directory.xhtml
src/allmydata/webish.py

index b6425e315f0c12f169034bb6ec4a79bfac8f5c50..2ef480b43ab90255eb39493c7f2b75cd9a7af4c2 100644 (file)
@@ -9,7 +9,7 @@
   </head>
   <body>
 
-<h1><p n:render="header"></p></h1>
+<h2 n:render="header"></h2>
 
 <div><a href=".">Refresh this view</a></div>
 <div><a href="..">Parent Directory</a></div>
index 85549086f839ebb79a5dc42d754288edc5381bfe..77e54f6b532b6e2a42fe4b17ca153bdbbaba8662 100644 (file)
@@ -133,13 +133,31 @@ class Directory(rend.Page):
         return d
 
     def render_title(self, ctx, data):
-        return ctx.tag["Directory of '%s':" % self._dirname]
+        return ctx.tag["Directory '%s':" % self._dirname]
 
     def render_header(self, ctx, data):
-        header = "Directory of '%s':" % self._dirname
+        parent_directories = self._dirname.split("/")
+        num_dirs = len(parent_directories)
+
+        header = ["Directory '"]
+        for i,d in enumerate(parent_directories):
+            if d == "":
+                link = "/".join([".."] * (num_dirs - i))
+                header.append(T.a(href=link)["/"])
+            else:
+                if i == num_dirs-1:
+                    link = "."
+                else:
+                    link = "/".join([".."] * (num_dirs - i - 1))
+                header.append(T.a(href=link)[d])
+                if i < num_dirs - 1:
+                    header.append("/")
+        header.append("'")
+
         if not self._dirnode.is_mutable():
-            header += " (readonly)"
-        return header
+            header.append(" (readonly)")
+        header.append(":")
+        return ctx.tag[header]
 
     def data_share_uri(self, ctx, data):
         return self._dirnode.get_uri()