diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-09-21 22:06:23 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-09-21 22:06:23 -0400 |
commit | 33956600602a5eb037a643b98104eed6f30e538d (patch) | |
tree | f9adf116bcb71a9a10f2391f93ce424d8feb8f1c /gitsrht/templates/tree.html | |
parent | bea00bb3dbf168410641180a3cff8cc6c2a0735e (diff) |
Support rendering any level of the tree
Diffstat (limited to 'gitsrht/templates/tree.html')
-rw-r--r-- | gitsrht/templates/tree.html | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/gitsrht/templates/tree.html b/gitsrht/templates/tree.html index 6cdf248..d089bc9 100644 --- a/gitsrht/templates/tree.html +++ b/gitsrht/templates/tree.html @@ -3,7 +3,16 @@ <div class="header-extension"> <div class="container-fluid"> <span style="padding-left: 1rem"> - /{{path}} + {% if path != [''] %} + <a href="{{url_for("repo.tree", + owner=repo.owner.canonical_name, repo=repo.name, branch=branch_name)}}" + >{{repo.name}}</a>{% endif %}/{% for part in path%}{% + if loop.last %}{{part}}{% else %}<a + href="{{url_for("repo.tree", owner=repo.owner.canonical_name, + repo=repo.name, branch=branch_name, + path=path_join(*path[:loop.index]))}}" + >{{part}}</a>/{% + endif %}{% endfor %} </span> <div class="pull-right"> <a href="#">{{commit.id.hex[:8]}}</a> — @@ -19,12 +28,28 @@ <div class="row" style="margin-bottom: 1rem"> <div class="col-md-12"> <div class="tree-list"> + {% if path != [''] %} + <div class="mode"></div> + <div class="name tree"> + <a href="{{url_for("repo.tree", + owner=repo.owner.canonical_name, repo=repo.name, branch=branch_name, + path=path_join(*path[:-1]) if path[:-1] else None)}}">..</a> + </div> + <div class="commit"></div> + <div class="date"></div> + <div class="size"></div> + {% endif %} {% for entry in tree %} <div class="mode"> {{stat.filemode(entry.filemode)}} </div> <div class="name {{entry.type}}"> - <a href="#">{{entry.name}}{% if entry.type == "tree" %}/{% endif %}</a> + <a href="{{url_for("repo.tree", + owner=repo.owner.canonical_name, repo=repo.name, branch=branch_name, + path=path_join(*(path + [entry.name])))}}" + > + {{entry.name}}{% if entry.type == "tree" %}/{% endif %} + </a> </div> <div class="commit"> {% if entry.commit %} |