diff options
Diffstat (limited to 'templates/gititemtree.qtpl')
-rw-r--r-- | templates/gititemtree.qtpl | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/templates/gititemtree.qtpl b/templates/gititemtree.qtpl index 5ace7b0..be7a27d 100644 --- a/templates/gititemtree.qtpl +++ b/templates/gititemtree.qtpl @@ -1,10 +1,28 @@ +{% import "github.com/go-git/go-git/v5/plumbing/object" %} + {% code type GitItemTreePage struct { + CurrentPath string + Tree *object.Tree + + // TODO: remove this since it can be passed by GitCommit + Ref string + Name string } %} {% func (g *GitItemTreePage) Nav(name, ref string) %}{%= GitItemNav(name, ref, Tree) %}{% endfunc %} {% func (g *GitItemTreePage) GitContent() %} -<h4>Tree</h4> +{% for _, e := range g.Tree.Entries %} +<div class="row"> + <div class="col">{%s Ignore(e.Mode.ToOSFileMode()).String() %}</div> + {% if e.Mode.IsFile() %} + <div class="col-md"><a href="/{%s g.Name %}/blob/{%s g.Ref%}/{%s g.CurrentPath %}/{%s e.Name %}">{%s e.Name %}</a></div> + {% else %} + <div class="col-md"><a href="./{%s g.CurrentPath %}/{%s e.Name %}">{%s e.Name %}</a></div> + {% endif %} + <div class="col-md">{%dl Ignore(g.Tree.Size(e.Name))%} KiB</div> +</div> +{% endfor %} {% endfunc %} |