<html>
<head>
    <title><%=entry.title %></title>
    <%- include('header.ejs') %>
</head>

<body>
<div id="mainpanel">
<h1><%=entry.title%></h1>
<i>by <%=entry.author%></i><br/><br/>
<%- entry.parsedText %>

<br/><br/>
(<a href="edit">Edit</a> | <a href="delete">Delete</a>)
<br/><br/>
<hr style="border: 1px solid black" />

<i style="font-size: 0.8em">comments</i><br/><br/>

<% entry.comments.forEach(function(comment) { %>
<div><%= comment.text %></div>
<i><%= comment.author %></i>
    <% if(data.isDragonmaster) { %>
    <form action="deletecomment/<%=comment._id%>" method="post"><button type="submit">Delete</button></form>
    <%}%>
    <br/><br/>
<% }); %>


<br/><br/>
<a href="#" onclick="$('#commentform').show()"><i style="font-size: 0.8em">leave a comment</i></a><br/><br/>

<form action="comment" method="POST" id="commentform" style="display:none;">
    <textarea style="width: 80%" name="comment"></textarea><br/>
    <button type="submit">Write comment</button>
</form>
</div>


<%- include('navbar.ejs') %>


</body>

</html>