@Title{Blog}@
@CSS{
	td:last-child{
		white-space:nowrap;
	}
}@
@CSSSmall{
	@media(orientation:portrait){
		td:nth-child(3), th:nth-child(3){
			display:none;
		}
	}
	td:first-child, th:first-child{
		display:none;
	}
	
	table{
		width:100%;
	}
	
	td:last-child,th:last-child,td:nth-child(3), th:nth-child(3){
		width:1px;
	}
}@
@JavaScript{
	$(function(){
		$("button.jsNav").click(function(e){
			Navigate($(this).val());
			return false;
		});
	});
}@
@ButtonsRight{
	<button onclick="window.location.href='/blog/create'" title="Create">
		<img src="/images/add.svg" alt="Add" />
	</button>
}@
@Body{
<form action="" method="post" id="manageForm">
	<input type="hidden" name="formSubmitted" value="yes" />
	<table>
		<tr>
			<th>ID</th>
			<th>Title</th>
			<th>Timestamp</th>
			<th>Actions</th>
		</tr>
		<?php foreach ($posts as $post){?>
		<tr>
			<td><?=$post->PostId?></td>
			<td><a href="/blog/viewdraft/<?=$post->PostUrl?>"><?=$post->PostTitle?></a></td>
			<td><?=$post->PostTimestamp?></td>
			<td>
				<button value="<?=$post->PostId?>" name="delete" title="Delete">
					<img src="/images/delete.svg" alt="Delete" />
				</button>
				<button value="/blog/edit/<?=$post->PostId?>" name="edit" title="Edit" class="jsNav">
					<img src="/images/edit.svg" alt="Edit" />
				</button>
				<?php if ($post->PostContent != $post->PostDraft) {?>
					<button value="<?=$post->PostId?>" name="publish" title="Publish">
						<img src="/images/send.svg" alt="Publish" />
					</button>
				<?php } else {?>
					<img src="/images/done.svg" alt="Done" title="Published" />
				<?php } ?>
			</td>
		</tr>
		<?php } ?>
	</table>
</form>
}@