66 lines
1.2 KiB
HTML

{include "layout.html"}
{block "content"}
<div class="thread-title mb-05">
<h2>Forum</h2>
<div>
<a href="/forum/new"><button class="btn btn-primary">New Thread</button></a>
</div>
</div>
{if #threads > 0}
<table>
<thead>
<tr>
<th>Thread</th>
<th>Replies</th>
<th>Last Reply</th>
</tr>
</thead>
<tbody>
{for thread in threads}
<tr>
<td>
<div>
<a href="/forum/{thread.ID}">{thread.Title}</a>
</div>
<div>
by {thread.AuthorUsername} • {thread.PostedTime().Format("Jan 2, 2006 3:04 PM")}
</div>
</td>
<td>
{thread.Replies}
</td>
<td>
{if thread.HasReplies}
by {thread.LastReplyUsername}<br>
{thread.LastPostTime().Format("Jan 2, 2006 3:04 PM")}
{else}
No replies
{/if}
</td>
</tr>
{/for}
</tbody>
</table>
{if totalPages > 1}
<div>
{if hasPrev}
<a href="/forum?page={currentPage - 1}"><button class="btn">Previous</button></a>
{/if}
<span>Page {currentPage} of {totalPages}</span>
{if hasNext}
<a href="/forum?page={currentPage + 1}"><button class="btn">Next</button></a>
{/if}
</div>
{/if}
{else}
<div>
No threads yet. <a href="/forum/new">Create the first one!</a>
</div>
{/if}
{/block}