Only show reply button if user is logged in.
This commit is contained in:
parent
82843d5bc2
commit
4ba9de012c
2 changed files with 12 additions and 6 deletions
|
|
@ -479,6 +479,10 @@ proc login(c: var TForumData, name, pass: string): bool =
|
|||
proc hasReplyBtn(c: var TForumData): bool =
|
||||
result = c.req.pathInfo != "/donewthread" and c.req.pathInfo != "/doreply"
|
||||
result = result and c.req.params["action"] != "reply"
|
||||
# If the user is not logged in and there are no page numbers then we shouldn't
|
||||
# generate the div.
|
||||
let pages = ceil(c.totalPosts / PostsPerPage).int
|
||||
result = result and (pages > 1 or c.loggedIn)
|
||||
return c.threadId >= 0 and result
|
||||
|
||||
proc genActionMenu(c: var TForumData): string =
|
||||
|
|
|
|||
14
main.tmpl
14
main.tmpl
|
|
@ -72,12 +72,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="user-post">
|
||||
#let replyUri = c.req.makeUri(c.req.path & "?action=reply#reply")
|
||||
<a href="$replyUri">
|
||||
<div>
|
||||
<span class="reply">Reply</span>
|
||||
</div>
|
||||
</a>
|
||||
#if c.loggedIn():
|
||||
#let replyUri = c.req.makeUri(c.req.path & "?action=reply#reply")
|
||||
<a href="$replyUri">
|
||||
<div>
|
||||
<span class="reply">Reply</span>
|
||||
</div>
|
||||
</a>
|
||||
#end if
|
||||
</div>
|
||||
</div>
|
||||
#end if
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue