-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.tmpl
70 lines (62 loc) · 1.58 KB
/
home.tmpl
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ .mainTitle }}</title>
<link rel="stylesheet" href="/_static/style.css">
</head>
<body>
<div id="topbar" class="wide">
<div class="container">
<div class="top-heading" id="heading-wide"><a href="/">{{ .mainTitle }}</a></div>
</div>
</div>
<div id="homepage">
{{if .homeText}}
<p>{{.homeText}}</p>
{{end}}
{{ range $g := .groups }}
{{if and $g.Name (ne $g.Name "_") }}
<h1>{{ $g.Name }}</h1>
{{end}}
{{if $g.Name}}
<p>{{ $g.Desc }}</p>
{{end}}
<table>
<tbody>
{{ range $pkg := $g.Packages }}
<tr class="indent-{{ $pkg.Depth }}">
<td>
{{ if eq $pkg.Depth 1 }}
<a href="" class="expand">▹</a>
{{ end }}
<a href="{{ $pkg.RelImportPath }}/index.html">{{ $pkg.Name }}</a>
</td>
<td>{{ $pkg.Doc }}</td>
</tr>
{{ end }}
</body>
</table>
{{ end }}
</div>
<script src="/_static/jquery.js"></script>
<script>
$(document).ready(function() {
$('tr:not(.indent-0, .indent-1)').css('display', 'none')
$('.expand').on('click', function(e) {
e.preventDefault()
expand = this.innerHTML == '▹'
this.innerHTML = this.innerHTML === '▾' ? '▹' : '▾'
row = $(this).closest('tr')
while (true) {
row = row.next()
if (row.is('.indent-0, .indent-1') || !row.is('tr'))
break
row.css('display', expand ? '' : 'none')
}
})
})
</script>
</body>
</html>