master
 1{{- /*gotype:github.com/antonmedv/gitmal/pkg/templates.FileTreeParams*/ -}}
 2{{ define "file_tree" }}
 3    {{ range .Nodes }}
 4        {{ if .IsDir }}
 5            <details open>
 6                <summary class="node">
 7                    <svg aria-hidden="true" focusable="false" width="16" height="16" class="dir">
 8                        <use xlink:href="#dir"></use>
 9                    </svg>
10                    <span class="file-name">{{ .Name }}</span>
11                </summary>
12                <div class="children">
13                    {{ template "file_tree" (FileTreeParams .Children) }}
14                </div>
15            </details>
16        {{ else }}
17            <div class="node">
18                <div class="icon" aria-hidden="true">
19                    {{ if .IsNew }}
20                        <svg aria-hidden="true" focusable="false" width="16" height="16" class="file-added">
21                            <use xlink:href="#file-added"></use>
22                        </svg>
23                    {{ else if .IsDelete }}
24                        <svg aria-hidden="true" focusable="false" width="16" height="16" class="file-deleted">
25                            <use xlink:href="#file-deleted"></use>
26                        </svg>
27                    {{ else if .IsRename }}
28                        <svg aria-hidden="true" focusable="false" width="16" height="16" class="file-renamed">
29                            <use xlink:href="#file-renamed"></use>
30                        </svg>
31                    {{ else }}
32                        <svg aria-hidden="true" focusable="false" width="16" height="16">
33                            <use xlink:href="#file-modified"></use>
34                        </svg>
35                    {{ end }}
36                </div>
37                <a href="#{{.Path}}" class="file-name">
38                    {{ .Path | BaseName }}
39                </a>
40            </div>
41        {{ end }}
42    {{ end }}
43{{ end }}