1{% import "github.com/go-git/go-git/v5/plumbing/object" %}
2
3{% code
4type GitItemTreePage struct {
5 CurrentPath string
6 Tree *object.Tree
7
8 // TODO: remove this since it can be passed by GitCommit
9 Ref string
10 Name string
11}
12%}
13
14{% func (g *GitItemTreePage) Nav(name, ref string) %}{%= GitItemNav(name, ref, Tree) %}{% endfunc %}
15
16{% func (g *GitItemTreePage) GitContent() %}
17<div class="row">
18 <div class="col-md-12">
19 <div class="tree-list">
20 {% for _, e := range g.Tree.Entries %}
21 <div class="mode">{%s Ignore(e.Mode.ToOSFileMode()).String() %}</div>
22 {% if e.Mode.IsFile() %}
23 <div class="name blob"><a href="/{%s g.Name %}/blob/{%s g.Ref%}/{%s g.CurrentPath %}/{%s e.Name %}">{%s e.Name %}</a></div>
24 {% else %}
25 <div class="name tree"><a href="./{%s g.CurrentPath %}/{%s e.Name %}">{%s e.Name %}</a></div>
26 {% endif %}
27 <div class="commit"></div>
28 <div class="date"></div>
29 <div class="size">{%dl Ignore(g.Tree.Size(e.Name))%} KiB</div>
30 {% endfor %}
31 </div>
32 </div>
33</div>
34{% endfunc %}