extends vibenews.admin.layout

block title
	- title = "Admin panel";
	
block vibenews.navigation
	ul
		li
			a(href="./")= title

block vibenews.body
	h2 Groups
	form(method="POST", action="/groups/create")
		table
			tr
				th Name
				th Caption
				th Active
				th Public
			- foreach( g; groups )
				tr
					td
						a(href="/groups/#{g.name}/show")= g.name
					td= g.caption
					td= g.active ? "yes" : "no"
					td= g.readOnlyAuthTags.length || g.readWriteAuthTags.length ? "no" : "yes"
			tr
				td
					input#name(type="text", name="name")
				td
					input#caption(type="text", name="caption")
				td(colspan="2")
					input(type="submit", value="Create")

	h2 Categories
	form(method="POST", action="/categories/create")
		table
			tr
				th Caption
				th Index
				th Groups
			- foreach( cat; categories )
				tr
					td
						a(href="/categories/#{cat._id}/show")= cat.caption
					td= cat.index
					td= cat.groups.length
			tr
				td
					input#name(type="text", name="caption")
				td
					input#name(type="text", name="index")
				td
					input(type="submit", value="Create")

	h2 Users

	form(method="GET", action="/users/")
		input(type="submit", value="Manage users")
	
	h2 Maintainance
	form(method="POST", action="/groups/repair-numbers")
		input(type="submit", value="Repair group numbers")
	form(method="POST", action="/groups/repair-threads")
		input(type="submit", value="Repair threads")
	form(method="POST", action="/reclassify_spam")
		input(type="submit", value="Reclassify all messages for spam")		