summaryrefslogtreecommitdiff
path: root/views/forum_thread.ejs
diff options
context:
space:
mode:
Diffstat (limited to 'views/forum_thread.ejs')
-rw-r--r--views/forum_thread.ejs32
1 files changed, 32 insertions, 0 deletions
diff --git a/views/forum_thread.ejs b/views/forum_thread.ejs
new file mode 100644
index 0000000..fad8829
--- /dev/null
+++ b/views/forum_thread.ejs
@@ -0,0 +1,32 @@
+<%- include('header', { title: thread.subject }) %>
+<style>
+table { width: 100%; max-width: 50em; }
+td.body { white-space: pre-wrap; padding: 10px 10px; }
+th.author { border-right: none; }
+th.time { text-align: right; border-left: none; font-weight: normal; }
+td.edit { text-align: right; border: none; }
+</style>
+<% posts.forEach((row) => { %>
+<p>
+<table>
+<tr>
+<th class="nowrap author"><%= row.author_name %>
+<th class="nowrap time"><%= row.ctime %>
+<%= row.edited ? "(edited " + row.mtime + ")" : "" %>
+<tr>
+<td class="body" colspan="2"><%- row.body %></td>
+<% if (user) { %>
+<tr>
+<td class="edit" colspan=2>
+<% if (row.author_id === user.user_id) { %>
+<a href="/forum/edit/<%- row.post_id %>">Edit</a>
+<% } %>
+<a href="/forum/reply/<%- row.post_id %>">Reply</a>
+<% } %>
+</table>
+<% }); %>
+<%
+if (user) {
+ %><p><a href="/forum/reply/<%- posts[0].post_id %>">Reply</a><%
+}
+%>