34 lines
1.4 KiB
Plaintext
34 lines
1.4 KiB
Plaintext
<%
|
|
local is_locked = ntob(thread.is_locked)
|
|
local can_post = (not is_locked and not me:is_guest()) or me:is_mod()
|
|
-- not locked, not guest, not mod = not false and not false or false = true and true or false = true
|
|
-- locked, not guest, not mod = not true and not false or false = false and true or false = false
|
|
-- not locked, guest, not mod = not false and not true or false = true and false or false = false
|
|
-- not locked, not guest, mod = not false and not false or true = true and true and true
|
|
%>
|
|
<main>
|
|
<nav class="darkbg">
|
|
<h1 class="thread-title"><%= thread.title %></h1>
|
|
<span>Posted in <a href="<%= url_for("topic", {slug = topic.slug}) %>"><%= topic.name %></a></span>
|
|
</nav>
|
|
<% for i, post in ipairs(posts) do %>
|
|
<% render("views.threads.post", {post = post, is_latest = i == #posts}) %>
|
|
<% end %>
|
|
</main>
|
|
|
|
<nav id="bottomnav">
|
|
<% render("views.common.pagination", {page_count = pages, current_page = page}) %>
|
|
</nav>
|
|
|
|
<% if is_locked then -%>
|
|
<% render("views.common.infobox", {kind = constants.InfoboxKind.LOCK, msg = "This thread is locked."}) %>
|
|
<% end -%>
|
|
<% if can_post then %>
|
|
<h1>Respond to "<%= thread.title %>"</h1>
|
|
<form method="post">
|
|
<textarea id="post_content" name="post_content" placeholder="Response body" rows=7 required></textarea><br>
|
|
<input type="submit" value="Post reply">
|
|
</form>
|
|
<script src="/static/js/thread.js"></script>
|
|
<% end %>
|