git » git-arr » commit 5def4c9

views: Include the root tree in the summary

author Alberto Bertogli
2017-08-27 18:17:26 UTC
committer Alberto Bertogli
2017-08-27 18:17:26 UTC
parent 891a9443817329492c75ad99b8ff8899c460dee1

views: Include the root tree in the summary

Including the tree as part of the summary gives a bit more information
and provides an easy path into the tree.

It does clutter things a bit, so this is an experiment and may be
removed later.

views/summary.html +5 -0
views/tree-list.html +16 -0
views/tree.html +2 -16

diff --git a/views/summary.html b/views/summary.html
index d30e895..652ee6e 100644
--- a/views/summary.html
+++ b/views/summary.html
@@ -35,6 +35,11 @@
 % end
 
 % if "master" in repo.branch_names():
+<b><a href="b/master/t/">[master]</a> /</b><br/>
+%     kwargs = dict(repo = repo, tree=repo.tree("master"),
+%                   treeroot="b/master/t", dirname=smstr.from_url(""))
+%     include tree-list **kwargs
+<hr/>
 %     kwargs = dict(repo = repo, start_ref = "refs/heads/master",
 %                   limit = repo.info.commits_in_summary,
 %                   shorten = shorten, repo_root = ".", offset = 0)
diff --git a/views/tree-list.html b/views/tree-list.html
new file mode 100644
index 0000000..5eea1aa
--- /dev/null
+++ b/views/tree-list.html
@@ -0,0 +1,16 @@
+<table class="nice ls">
+% key_func = lambda (t, n, s): (t != 'tree', n.raw)
+% for type, name, size in sorted(tree.ls(dirname.raw), key = key_func):
+    <tr class="{{type}}">
+%   if type == "blob":
+        <td class="name"><a href="{{treeroot}}/f={{name.url}}.html">
+            {{!name.html}}</a></td>
+        <td class="size">{{size}}</td>
+%   elif type == "tree":
+        <td class="name">
+            <a class="explicit" href="{{treeroot}}/{{name.url}}/">
+                {{!name.html}}/</a></td>
+%   end
+    </tr>
+% end
+</table>
diff --git a/views/tree.html b/views/tree.html
index 12c21b0..3f3829c 100644
--- a/views/tree.html
+++ b/views/tree.html
@@ -36,22 +36,8 @@
 % end
 </h3>
 
-<table class="nice ls">
-% key_func = lambda (t, n, s): (t != 'tree', n.raw)
-% for type, name, size in sorted(tree.ls(dirname.raw), key = key_func):
-    <tr class="{{type}}">
-%   if type == "blob":
-        <td class="name"><a href="./f={{name.url}}.html">
-            {{!name.html}}</a></td>
-        <td class="size">{{size}}</td>
-%   elif type == "tree":
-        <td class="name">
-            <a class="explicit" href="./{{name.url}}/">
-                {{!name.html}}/</a></td>
-%   end
-    </tr>
-% end
-</table>
+% kwargs = dict(repo = repo, tree=tree, treeroot=".")
+% include tree-list **kwargs
 
 </body>
 </html>