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.
This commit is contained in:
Alberto Bertogli 2017-08-27 19:17:26 +01:00
parent 891a944381
commit 5def4c9e01
3 changed files with 23 additions and 16 deletions

@ -35,6 +35,11 @@
% end % end
% if "master" in repo.branch_names(): % 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", % kwargs = dict(repo = repo, start_ref = "refs/heads/master",
% limit = repo.info.commits_in_summary, % limit = repo.info.commits_in_summary,
% shorten = shorten, repo_root = ".", offset = 0) % shorten = shorten, repo_root = ".", offset = 0)

16
views/tree-list.html Normal file

@ -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>

@ -36,22 +36,8 @@
% end % end
</h3> </h3>
<table class="nice ls"> % kwargs = dict(repo = repo, tree=tree, treeroot=".")
% key_func = lambda (t, n, s): (t != 'tree', n.raw) % include tree-list **kwargs
% 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>
</body> </body>
</html> </html>