diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-07 14:02:25 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-07 14:02:25 +0200 |
commit | 18aa098f50e2a2c7db01dd4d04dde460fd40f5d5 (patch) | |
tree | 5e3b3d3ba3206f2765db1a23a378275852154a51 /templates/gititemtree.qtpl | |
parent | d0e0c1eb99303e1000140d4b98c610077278dc42 (diff) | |
download | cerrado-18aa098f50e2a2c7db01dd4d04dde460fd40f5d5.tar.gz cerrado-18aa098f50e2a2c7db01dd4d04dde460fd40f5d5.tar.bz2 cerrado-18aa098f50e2a2c7db01dd4d04dde460fd40f5d5.zip |
feat: Add blob endpoint
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 %} |