summaryrefslogtreecommitdiff
path: root/internal/templates/file_tree.gohtml
blob: bd375f5c05bafea6facfeb4c841d0d55c1e0b990 (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
35
36
37
38
39
40
41
42
43
{{- /*gotype:mokhan.ca/xlgmokha/gitmal/pkg/templates.FileTreeParams*/ -}}
{{- define "file_tree" -}}
{{- range .Nodes}}
{{- if .IsDir}}
<details open>
  <summary class="node">
    <svg aria-hidden="true" focusable="false" width="16" height="16" class="dir">
      <use xlink:href="#dir"></use>
    </svg>
    <span class="file-name">{{.Name}}</span>
  </summary>
  <div class="children">
{{- template "file_tree" (FileTreeParams .Children)}}
  </div>
</details>
{{- else}}
<div class="node">
  <div class="icon" aria-hidden="true">
{{- if .IsNew}}
    <svg aria-hidden="true" focusable="false" width="16" height="16" class="file-added">
      <use xlink:href="#file-added"></use>
    </svg>
{{- else if .IsDelete}}
    <svg aria-hidden="true" focusable="false" width="16" height="16" class="file-deleted">
      <use xlink:href="#file-deleted"></use>
    </svg>
{{- else if .IsRename}}
    <svg aria-hidden="true" focusable="false" width="16" height="16" class="file-renamed">
      <use xlink:href="#file-renamed"></use>
    </svg>
{{- else}}
    <svg aria-hidden="true" focusable="false" width="16" height="16">
      <use xlink:href="#file-modified"></use>
    </svg>
{{- end}}
  </div>
  <a href="#{{.Path}}" class="file-name">
    {{.Path | BaseName}}
  </a>
</div>
{{- end}}
{{- end}}
{{- end}}