<form method="GET" action="{{webPath "manage/threadattrs"}}" class="staff-form">
<h3>Select a board</h3>
{{with $.boards -}}
<select name="board">
	{{range $_, $board := $.boards}}
		<option value="{{$board.Dir}}" {{with $.board}}{{if eq $.board.Dir $board.Dir}}selected="selected"{{end}}{{end}}>/{{$board.Dir}}/ - {{$board.Title}}</option>
	{{else}}
		<i>No boards</i>
	{{end}}
</select>
<input type="submit" value="Show threads" /><br />
</form>
{{else}}
<i>No boards</i>
{{end}}
{{with $.board}}
<h3>Select a thread</h3>
{{if (lt (len $.threads) 1)}}
<i>No threads on </i>
{{else -}}
<form action="{{$.formURL}}" method="GET">
	<input type="hidden" name="board" value="{{$.board.Dir}}">
<select name="thread">
{{- range $_, $thread := $.threads}}
	{{with $opIDstr := (print (index $.opMap $thread.ID)) -}}
	<option value="{{$opIDstr}}" {{with $.thread}}{{if eq $opIDstr (print $.topPostID)}}selected="selected"{{end}}{{end}}>>>/{{$.board.Dir}}/{{$opIDstr}}</option>
	{{end -}}
{{end -}}
</select>
<input type="submit" value="Show attributes">
</form>
{{with $.thread}}
<form action="{{$.formURL}}" method="POST">
	<input type="hidden" name="board" value="{{$.board.Dir}}">
	<input type="hidden" name="thread" value="{{$.topPostID}}">
<h3>Thread attributes for <a href="{{webPath $.board.Dir "res" (print $.topPostID)}}.html">#{{$.topPostID}}</a> (click to toggle)</h3>
<table>
	<tr>
		<th>Locked</th>
		<td><input type="submit" name="{{if $.thread.Locked}}unlock{{else}}lock{{end}}" value="{{if $.thread.Locked}}Locked{{else}}Not locked{{end}}" /></td>
	</tr>
	<tr>
		<th>Stickied</th>
		<td><input type="submit" name="{{if $.thread.Stickied}}unsticky{{else}}sticky{{end}}" value="{{if $.thread.Stickied}}Stickied{{else}}Not stickied{{end}}" /></td>
	</tr>
	<tr>
		<th>Anchored</th>
		<td><input type="submit" name="{{if $.thread.Anchored}}unanchor{{else}}anchor{{end}}" value="{{if $.thread.Anchored}}Anchored{{else}}Not anchored{{end}}" /></td>
	</tr>
	<tr>
		<th>Cyclic</th>
		<td><input type="submit" name="{{if $.thread.Cyclic}}uncyclic{{else}}cyclic{{end}}" value="{{if $.thread.Cyclic}}Cyclic{{else}}Not cyclic{{end}}" /></td>
	</tr>
</table>
</form>
{{- end}}
{{- end}}
{{- end}}