change post view

This commit is contained in:
Swrup 2022-01-26 10:11:26 +01:00
parent 4aa1e0a081
commit da6278afe3
2 changed files with 33 additions and 11 deletions

View file

@ -391,10 +391,11 @@ let view_post ?is_thread_preview post_id =
in in
let pp_print_reply fmt reply = let pp_print_reply fmt reply =
Format.fprintf fmt {|<a class="replyLink" href="#%s">>>%s</a>|} reply reply Format.fprintf fmt {|<a class="replyLink" href="#%s">&gt;&gt;%s</a>|} reply
reply
in in
let pp_print_replies = let pp_print_replies =
Format.asprintf {|<div class="repliesLink">%a</div> |} Format.asprintf {|<div class="replies">%a</div>|}
(Format.pp_print_list ~pp_sep:Format.pp_print_space pp_print_reply) (Format.pp_print_list ~pp_sep:Format.pp_print_space pp_print_reply)
in in
@ -405,22 +406,38 @@ let view_post ?is_thread_preview post_id =
let res_nb = Db.find Q.count_thread_posts post_id in let res_nb = Db.find Q.count_thread_posts post_id in
match res_nb with match res_nb with
| Error _ -> "" | Error _ -> ""
| Ok ((0 | 1) as nb) -> Format.sprintf "%d reply" (nb - 1) | Ok ((1 | 2) as nb) ->
| Ok nb -> Format.sprintf "%d replies" (nb - 1) ) Format.sprintf {|<div class="replies">%d reply</div>|} (nb - 1)
| Ok nb ->
Format.sprintf {|<div class="replies">%d replies</div>|} (nb - 1) )
in in
let post_info_view =
Format.sprintf let post_links_view =
{| match is_thread_preview with
<div class="postInfo"> | None ->
<span class=nick>%s</span> Format.sprintf
<span class=date data-time="%d"></span> {|
<span class=postNo> <span class=postNo>
<a href="#%s" title="Link to this post">No.</a> <a href="#%s" title="Link to this post">No.</a>
<a href="javascript:insert_quote('%s')" "class=quoteLink title="Reply to this post">%s</a> <a href="javascript:insert_quote('%s')" "class=quoteLink title="Reply to this post">%s</a>
</span> </span>
%s %s
|}
post_id post_id post_id replies_view
| Some () -> Format.sprintf {|
%s
|} replies_view
in
let post_info_view =
Format.sprintf
{|
<div class="postInfo">
<span class="nick">%s</span>
<span class="date" data-time="%d"></span>
%s
</div>|} </div>|}
nick date post_id post_id post_id replies_view nick date post_links_view
in in
let post_view = let post_view =
Format.sprintf Format.sprintf

View file

@ -40,8 +40,13 @@ blockquote.blockquote {
width: 100%; width: 100%;
} }
.nick {
color: #FFB300;
}
.postComment { .postComment {
display: block; display: block;
padding-top: 10px;
} }
.postImageContainer { .postImageContainer {