{{ template "header.html" . }}
{{ $voter := .Voter }}
<div class="column">
    <div class="ui basic segment">
        <div class="ui floated right secondary menu">

            <a href="/motions/" class="{{ if not .Params.Flags.Unvoted }}active {{ end }}item" title="Show all votes">All votes</a>
            {{ if $voter }}<a href="/motions/?unvoted=1" class="{{ if .Params.Flags.Unvoted }}active {{ end}}item" title="Show my outstanding votes">My outstanding votes</a>{{ end }}
        </div>
        {{ if $voter }}<a class="ui primary button" href="/newmotion/">New motion</a>{{ end }}
        {{ if .PrevPage -}}
        <a href="?page={{ .PrevPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}"
           class="ui left labeled icon button" title="newer motions"><i class="left arrow icon"></i> newer</a>
        {{- end }}
        {{ if .NextPage -}}
        <a href="?page={{ .NextPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}"
           class="ui right labeled icon button" title="older motions"><i class="right arrow icon"></i> older</a>
        {{- end }}
    </div>
</div>
{{ if .Decisions }}
    {{ range .Decisions }}
    <div class="column">
        <div class="ui raised segment">
        {{ template "motion_fragment" . }}
        {{ if $voter }}{{ template "motion_actions" . }}{{ end }}
        </div>
    </div>
    {{ end }}
<div class="column">
    <div class="ui basic segment">
{{ if $voter }}<a class="ui primary button" href="/newmotion/">New motion</a>{{ end }}
{{ if .PrevPage -}}
    <a href="?page={{ .PrevPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}"
       class="ui left labeled icon button" title="newer motions">
        <i class="left arrow icon"></i> newer</a>
{{- end }}
{{ if .NextPage -}}
    <a href="?page={{ .NextPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}"
       class="ui right labeled icon button" title="older motions">
       <i class="right arrow icon"></i> older</a>
{{- end }}
    </div>
</div>
{{ else }}
    {{ if .Params.Flags.Unvoted }}
    <p>There are no motions requiring a vote from you.</p>
    {{ else }}
    <p>There are no motions in the system yet.</p>
    {{ end }}
{{ end }}
{{ template "footer.html" . }}