cacert-boardvoting/ui/html/partials/nav.html

45 lines
No EOL
2 KiB
HTML

{{ define "nav" }}
{{ $user := .User }}
{{ if $user }}
{{ if canManageUsers $user }}
<nav class="ui top attached tabular menu">
<a class="{{ if eq .ActiveNav "motions" }}active {{ end }}item" href="/motions/">Motions</a>
<a class="{{ if eq .ActiveNav "users" }}active {{ end }}item" href="/users/">User management</a>
</nav>
{{ end }}
{{ end }}
{{ if eq .ActiveNav "motions"}}
<nav class="ui secondary pointing menu">
<a href="/motions/" class="{{ if eq .ActiveSubNav "all-motions" }}active {{ end }}item"
title="Show all motions">All
motions</a>
{{ if $user }}
{{ if canVote $user }}
<a href="/motions/?unvoted=1" class="{{ if eq .ActiveSubNav "unvoted-motions" }}active {{ end}}item"
title="My unvoted motions">My unvoted motions</a>
{{ end }}
{{ if canStartVote $user }}
<div class="right item">
<a class="ui primary labeled icon button" href="/newmotion/">
<i class="magic icon"></i>
New motion</a>
</div>
{{ end }}
{{ end }}
</nav>
{{ end }}
{{ if eq .ActiveNav "users"}}
{{ if $user }}
{{ if canManageUsers $user }}
<nav class="ui secondary pointing menu">
<a href="/users/" class="{{ if eq .ActiveSubNav "users" }}active {{ end }}item">Manage users</a>
<a href="/voters/" class="{{ if eq .ActiveSubNav "manage-voters" }}active {{ end }}item">Manage voters</a>
<div class="right item">
<a class="ui primary labeled icon button" href="/new-user/">
<i class="magic icon"></i> Add User</a>
</div>
</nav>
{{ end }}
{{ end }}
{{ end }}
{{ end }}