From: Brian Warner Date: Fri, 29 Jun 2007 18:17:18 +0000 (-0700) Subject: webish: make each link in the directory name an href to that directory X-Git-Tag: allmydata-tahoe-0.4.0~8 X-Git-Url: https://git.rkrishnan.org/webapi.txt?a=commitdiff_plain;h=6427b44b427efde7c4f788d64b1695d83ab578e9;p=tahoe-lafs%2Ftahoe-lafs.git webish: make each link in the directory name an href to that directory --- diff --git a/src/allmydata/web/directory.xhtml b/src/allmydata/web/directory.xhtml index b6425e31..2ef480b4 100644 --- a/src/allmydata/web/directory.xhtml +++ b/src/allmydata/web/directory.xhtml @@ -9,7 +9,7 @@ -

+

Refresh this view
Parent Directory
diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py index 85549086..77e54f6b 100644 --- a/src/allmydata/webish.py +++ b/src/allmydata/webish.py @@ -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()