66 lines
1.3 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 #threadInfos > 0}
<table>
<thead>
<tr>
<th>Thread</th>
<th>Replies</th>
<th>Last Reply</th>
</tr>
</thead>
<tbody>
{for threadInfo in threadInfos}
<tr>
<td>
<div>
<a href="/forum/{threadInfo.Thread.ID}">{threadInfo.Thread.Title}</a>
</div>
<div>
by {threadInfo.Author.Username} • {threadInfo.Thread.PostedTime().Format("Jan 2, 2006 3:04 PM")}
</div>
</td>
<td>
{threadInfo.Thread.Replies}
</td>
<td>
{if threadInfo.LastReplyBy}
by {threadInfo.LastReplyBy.Username}<br>
{threadInfo.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}