extends vibelog.admin.layout

block vibelog.title
	- title = "Post overview";

block vibelog-localnav
	ul.admin-local-nav
		li
			a(href="../") Back to admin panel
		li
			a(href="../make_post") Make new post

block vibelog-content
	- import std.datetime;

	table(width="100%")
		tr
			th Date
			th Pub
			th Comment
			th Header
			th Author
			th Category
			th View
			th Edit
			th Delete
		- foreach (post; info.posts)
			- if (info.loginUser.isPostAdmin() || info.loginUser.username == post.author)
				tr
					td= (cast(Date)post.date).toSimpleString()
					td= post.isPublic ? "yes" : ""
					td= post.commentsAllowed ? "yes" : ""
					td= post.header
					td= post.author
					td= post.category
					td
						form(action="#{info.settings.siteURL}posts/#{post.name}", method="GET")
							input(type="submit", value="view")
					td
						form(action="#{post.name}/", method="GET")
							input(type="submit", value="edit")
					td
						form(action="#{post.name}/delete", method="POST")
							input(type="hidden", name="id", value="#{post.id.toString()}")
							input(type="submit", value="delete")
