aboutsummaryrefslogtreecommitdiff
path: root/templates/gititemtree.qtpl
blob: 68b98566d92fb065d6413d1236d0ee0deb6401cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{% 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() %}
<div class="row">
  <div class="col-md-12">
    <div class="tree-list">
      {% for _, e := range g.Tree.Entries %}
          <div class="mode">{%s Ignore(e.Mode.ToOSFileMode()).String() %}</div>
          {% if e.Mode.IsFile() %}
          <div class="name blob"><a href="/{%s g.Name %}/blob/{%s g.Ref%}/{%s g.CurrentPath %}/{%s e.Name %}">{%s e.Name %}</a></div>
          {% else %}
          <div class="name tree"><a href="./{%s g.CurrentPath %}/{%s e.Name %}">{%s e.Name %}</a></div>
          {% endif %}
          <div class="commit"></div>
          <div class="date"></div>
          <div class="size">{%dl Ignore(g.Tree.Size(e.Name))%} KiB</div>
      {% endfor %}
    </div>
  </div>
</div>
{% endfunc %}