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 =
|
proc hasReplyBtn(c: var TForumData): bool =
|
||||||
result = c.req.pathInfo != "/donewthread" and c.req.pathInfo != "/doreply"
|
result = c.req.pathInfo != "/donewthread" and c.req.pathInfo != "/doreply"
|
||||||
result = result and c.req.params["action"] != "reply"
|
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
|
return c.threadId >= 0 and result
|
||||||
|
|
||||||
proc genActionMenu(c: var TForumData): string =
|
proc genActionMenu(c: var TForumData): string =
|
||||||
|
|
|
||||||
14
main.tmpl
14
main.tmpl
|
|
@ -72,12 +72,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="user-post">
|
<div class="user-post">
|
||||||
#let replyUri = c.req.makeUri(c.req.path & "?action=reply#reply")
|
#if c.loggedIn():
|
||||||
<a href="$replyUri">
|
#let replyUri = c.req.makeUri(c.req.path & "?action=reply#reply")
|
||||||
<div>
|
<a href="$replyUri">
|
||||||
<span class="reply">Reply</span>
|
<div>
|
||||||
</div>
|
<span class="reply">Reply</span>
|
||||||
</a>
|
</div>
|
||||||
|
</a>
|
||||||
|
#end if
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
#end if
|
#end if
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue