add offset pagination and permalinking to posts
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
<h1><%= thread.title %></h1>
|
||||
<p>Posted under <a href="<%= url_for("topic", {slug = topic.slug}) %>"><%= topic.name %></a>
|
||||
<% for _, post in ipairs(posts) do %>
|
||||
<div>
|
||||
<div id="post-<%= post.id %>">
|
||||
<img src="<%= post.avatar_path or "/avatars/default.webp" %>"><br>
|
||||
<a href="<%= url_for("user", {username = post.username}) %>"><%= post.username %></a>
|
||||
<div><p><%- post.content %></p></div>
|
||||
<a href="#post-<%= post.id %>">permalink</a>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@ -15,8 +16,12 @@
|
||||
<input type="submit" value="Reply">
|
||||
</form>
|
||||
<% end %>
|
||||
<% if next_cursor then %>
|
||||
<a href="<%= url_for('thread', {slug = thread.slug}, {cursor = next_cursor}) %>">
|
||||
Older posts →
|
||||
</a>
|
||||
<span>
|
||||
<% for i = 1, math.max(pages, 1) do %>
|
||||
<% if i == page then %>
|
||||
<%= tostring(i)%>
|
||||
<% else %>
|
||||
<a href="?page=<%= i %>"><%= tostring(i)%></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
|
Reference in New Issue
Block a user