don't wrap new-thread-link in a div
This commit is contained in:
parent
fe66d42ba0
commit
cc78db9cb1
1 changed files with 17 additions and 10 deletions
|
|
@ -86,18 +86,25 @@ let mk_dropdown_menu ~class_prefix ~label ~at_title ~placeholder mk_content =
|
||||||
El.div ~at l
|
El.div ~at l
|
||||||
|
|
||||||
let new_thread_link_el t_s =
|
let new_thread_link_el t_s =
|
||||||
let mk user =
|
let is_logged_in = S.map get_user t_s |> S.map Option.is_some in
|
||||||
match user with
|
let href_s =
|
||||||
| None ->
|
let open Page in
|
||||||
(* TODO redirect *)
|
is_logged_in
|
||||||
mk_page_link ~label:"Login to post a thread!" Login
|
|> S.map (function false -> Login | true -> New_thread)
|
||||||
| Some _user ->
|
|> S.map (fun p -> Some (Jstr.of_string (to_path p)))
|
||||||
El.a ~at:[ href (Page.to_path New_thread) ] [ el_txt "New thread" ]
|
|
||||||
in
|
in
|
||||||
let el = El.div ~at:[ class' "new-thread-link-div" ] [] in
|
let content_s =
|
||||||
|
is_logged_in
|
||||||
|
|> S.map (function
|
||||||
|
| false ->
|
||||||
|
(* TODO redirect after login *)
|
||||||
|
[ el_txt "Login to post a thread!" ]
|
||||||
|
| true -> [ el_txt "New thread" ] )
|
||||||
|
in
|
||||||
|
let el = El.a [] in
|
||||||
|
Elr.def_at At.Name.href href_s el;
|
||||||
|
Elr.def_children el content_s;
|
||||||
def_visibility_when_page [ New_thread ] `Off el t_s;
|
def_visibility_when_page [ New_thread ] `Off el t_s;
|
||||||
let children = S.map get_user t_s |> S.map (fun u -> [ mk u ]) in
|
|
||||||
Elr.def_children el children;
|
|
||||||
el
|
el
|
||||||
|
|
||||||
let mk_image ~is_small img_info =
|
let mk_image ~is_small img_info =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue