nquest/views/team/list.gotmpl

35 lines
No EOL
934 B
Go Template

{{ template "header" . }}
<h1>Команды</h1>
{{$MyTeam := 0}}
{{if and .User .User.Team }}
{{$MyTeam = .User.Team.Team.ID}}
{{end}}
{{if and .User (not .User.Team) }}
<div class="d-grid gap-2 col-6 mx-auto mb-2">
<a href="/team/new" class="btn btn-primary">Создать команду</a>
</div>
{{end}}
<table class="table table-bordered">
<thead class="table-primary">
<tr>
<th scope="col">Название</th>
<th scope="col" class="thin">Количество участников</th>
</tr>
</thead>
<tbody>
{{range .Teams}}
<tr class="{{ if eq $MyTeam .ID }}active{{ end }}">
<td>
<a href="/team/{{.ID}}">
{{.Name}}
</a>
</td>
<td>
{{len .Members}}
</td>
</tr>
{{end}}
</tbody>
</table>
{{ template "footer" . }}