{{define "content" -}}
<h2><a href="/~{{.Repo.OwnerName}}/{{.Repo.Name}}">~{{.Repo.OwnerName}}/{{.Repo.Name}}</a> · tree</h2>
{{template "viewtabs" (dict "Repo" .Repo "Views" .Views "Current" "tables" "Ref" .Ref)}}
<p class="text-muted">Tables at <code>{{.Ref}}</code></p>
{{if .Tables}}
{{range .Tables}}
<div class="header-extension"></div>
<h4>{{icon "folder"}} {{.Name}} <small class="text-muted">{{.RowCount}} rows</small>
<a class="btn btn-sm btn-secondary"
href="/~{{$.Repo.OwnerName}}/{{$.Repo.Name}}/table/{{$.Ref}}/{{.Name}}">rows</a>
</h4>
<table class="table table-sm">
<thead>
<tr><th>Column</th><th>Type</th><th>Key</th><th>Null</th></tr>
</thead>
<tbody>
{{range .Columns}}
<tr>
<td><code>{{.Name}}</code></td>
<td>{{.Type}}</td>
<td>{{if .PrimaryKey}}PK{{end}}</td>
<td>{{if .Nullable}}yes{{else}}no{{end}}</td>
</tr>
{{end}}
</tbody>
</table>
{{end}}
{{else}}
<p class="text-muted">No tables at this ref.</p>
{{end}}
{{- end}}