fix user avatar
This commit is contained in:
parent
87a9806056
commit
e6fe0ab5df
3 changed files with 10 additions and 26 deletions
|
|
@ -208,17 +208,7 @@ module User = struct
|
||||||
match user.avatar_info with
|
match user.avatar_info with
|
||||||
| None -> []
|
| None -> []
|
||||||
| Some info ->
|
| Some info ->
|
||||||
let alt_at =
|
[ Html_util.mk_image ~is_small:true (Avatar (user.user_id, info)) ]
|
||||||
if String.equal "" info.alt then []
|
|
||||||
else [ alt info.alt; name info.name; title info.alt ]
|
|
||||||
in
|
|
||||||
let at =
|
|
||||||
[ Fmt.kstr src "/user/%s/avatar" user.user_id
|
|
||||||
; class' "img-thumbnail"
|
|
||||||
]
|
|
||||||
@ alt_at
|
|
||||||
in
|
|
||||||
[ El.img ~at () ]
|
|
||||||
in
|
in
|
||||||
h1 user.user_nick :: bio :: img
|
h1 user.user_nick :: bio :: img
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,8 @@ let date post =
|
||||||
[ el_txt (print_date post.date) ]
|
[ el_txt (print_date post.date) ]
|
||||||
|
|
||||||
(* TODO rm this since we can click the post_id? *)
|
(* TODO rm this since we can click the post_id? *)
|
||||||
let link_to_post ?(is_vignette = false) post =
|
let link_to_post post =
|
||||||
let url =
|
let url = Fmt.str "#%d" post.id in
|
||||||
if is_vignette then Fmt.str "/thread/%d#%d" post.parent_t_id post.id
|
|
||||||
else Fmt.str "#%d" post.id
|
|
||||||
in
|
|
||||||
El.a
|
El.a
|
||||||
~at:[ href url; title "Link to this post"; class' "post-link-to-self" ]
|
~at:[ href url; title "Link to this post"; class' "post-link-to-self" ]
|
||||||
[ el_txt "#" ]
|
[ el_txt "#" ]
|
||||||
|
|
@ -154,21 +151,15 @@ let backlinks t_s post =
|
||||||
let l = List.map (post_id_quote t_s) post.backlinks in
|
let l = List.map (post_id_quote t_s) post.backlinks in
|
||||||
El.div ~at:[ class' "post-replies" ] l
|
El.div ~at:[ class' "post-replies" ] l
|
||||||
|
|
||||||
let image _t_s ?(is_vignette = false) post =
|
let image _t_s post =
|
||||||
match post.image_info with
|
match post.image_info with
|
||||||
| None -> None
|
| None -> None
|
||||||
| Some image -> (
|
| Some image ->
|
||||||
let img_small =
|
let img_small =
|
||||||
Html_util.mk_image ~is_small:true (Img_info.Post (post.id, image))
|
Html_util.mk_image ~is_small:true (Img_info.Post (post.id, image))
|
||||||
in
|
in
|
||||||
let el = El.div ~at:[ class' "post-image-div" ] [ img_small ] in
|
let el = El.div ~at:[ class' "post-image-div" ] [ img_small ] in
|
||||||
match is_vignette with
|
Some el
|
||||||
| true -> Some el
|
|
||||||
| false ->
|
|
||||||
hold_on el Ev.click (fun _ev ->
|
|
||||||
let v = Img_info.Post (post.id, image) in
|
|
||||||
Events.send_action (Image_change (Some v)) );
|
|
||||||
Some el )
|
|
||||||
|
|
||||||
let comment =
|
let comment =
|
||||||
let open Comment in
|
let open Comment in
|
||||||
|
|
|
||||||
|
|
@ -133,4 +133,7 @@ let mk_image ~is_small img_info =
|
||||||
; mk_at "loading" "lazy"
|
; mk_at "loading" "lazy"
|
||||||
]
|
]
|
||||||
in
|
in
|
||||||
El.img ~at ()
|
let el = El.img ~at () in
|
||||||
|
hold_on el Ev.click (fun _ev ->
|
||||||
|
Events.send_action (Image_change (Some img_info)) );
|
||||||
|
el
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue