Add category add button on new thread
This commit is contained in:
parent
82463ea423
commit
d5df46823a
2 changed files with 11 additions and 3 deletions
|
|
@ -83,7 +83,7 @@ proc render(): VNode =
|
|||
route([
|
||||
r("/newthread",
|
||||
(params: Params) =>
|
||||
(render(state.newThread))
|
||||
(render(state.newThread, getLoggedInUser()))
|
||||
),
|
||||
r("/profile/@username",
|
||||
(params: Params) =>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ when defined(js):
|
|||
include karax/prelude
|
||||
import karax / [kajax, kdom]
|
||||
|
||||
import error, replybox, threadlist, post, category
|
||||
import error, replybox, threadlist, post, category, user
|
||||
import karaxutils, categorypicker
|
||||
|
||||
type
|
||||
|
|
@ -47,7 +47,15 @@ when defined(js):
|
|||
ajaxPost(uri, @[], cast[cstring](formData),
|
||||
(s: int, r: kstring) => onCreatePost(s, r, state))
|
||||
|
||||
proc render*(state: NewThread): VNode =
|
||||
proc render*(state: NewThread, currentUser: Option[User]): VNode =
|
||||
|
||||
let loggedIn = currentUser.isSome()
|
||||
let currentAdmin =
|
||||
currentUser.isSome() and currentUser.get().rank == Admin
|
||||
|
||||
if currentAdmin:
|
||||
state.categoryPicker.setAddEnabled(true)
|
||||
|
||||
result = buildHtml():
|
||||
section(class="container grid-xl"):
|
||||
tdiv(id="new-thread"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue