show tags
This commit is contained in:
parent
96712eeadf
commit
38a0717d54
2 changed files with 23 additions and 3 deletions
|
|
@ -96,3 +96,9 @@ blockquote.blockquote {
|
||||||
color: #5a5a5a;
|
color: #5a5a5a;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
background-color: #FFB300;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ let view_post ?is_thread_preview post_id =
|
||||||
let* date = Db.find Q.get_post_date post_id in
|
let* date = Db.find Q.get_post_date post_id in
|
||||||
let* image_info = Db.find_opt Q.get_post_image_info post_id in
|
let* image_info = Db.find_opt Q.get_post_image_info post_id in
|
||||||
|
|
||||||
let* _tags = Db.fold Q.get_post_tags (fun tag acc -> tag :: acc) post_id [] in
|
let* tags = Db.fold Q.get_post_tags (fun tag acc -> tag :: acc) post_id [] in
|
||||||
let* replies =
|
let* replies =
|
||||||
Db.fold Q.get_post_replies (fun reply_id acc -> reply_id :: acc) post_id []
|
Db.fold Q.get_post_replies (fun reply_id acc -> reply_id :: acc) post_id []
|
||||||
in
|
in
|
||||||
|
|
@ -33,9 +33,10 @@ let view_post ?is_thread_preview post_id =
|
||||||
Format.fprintf fmt {|<a class="replyLink" href="#%s">>>%s</a>|} reply
|
Format.fprintf fmt {|<a class="replyLink" href="#%s">>>%s</a>|} reply
|
||||||
reply
|
reply
|
||||||
in
|
in
|
||||||
let pp_print_replies =
|
let pp_print_replies replies =
|
||||||
Format.asprintf {|<div class="replies">%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)
|
||||||
|
replies
|
||||||
in
|
in
|
||||||
|
|
||||||
let replies_view =
|
let replies_view =
|
||||||
|
|
@ -78,6 +79,18 @@ let view_post ?is_thread_preview post_id =
|
||||||
</div>|}
|
</div>|}
|
||||||
nick date post_links_view
|
nick date post_links_view
|
||||||
in
|
in
|
||||||
|
|
||||||
|
let pp_print_tag fmt tag =
|
||||||
|
Format.fprintf fmt {|<span class="tag">%s</span>|} tag
|
||||||
|
in
|
||||||
|
let pp_print_tags tags =
|
||||||
|
Format.asprintf {|<div class="tags">%a</div>|}
|
||||||
|
(Format.pp_print_list ~pp_sep:Format.pp_print_space pp_print_tag)
|
||||||
|
tags
|
||||||
|
in
|
||||||
|
let tags = List.sort String.compare tags in
|
||||||
|
let tags_view = pp_print_tags tags in
|
||||||
|
|
||||||
let post_view =
|
let post_view =
|
||||||
Format.sprintf
|
Format.sprintf
|
||||||
{|
|
{|
|
||||||
|
|
@ -86,10 +99,11 @@ let view_post ?is_thread_preview post_id =
|
||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
<blockquote class="postComment">%s</blockquote>
|
<blockquote class="postComment">%s</blockquote>
|
||||||
|
%s
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|}
|
|}
|
||||||
post_id post_info_view image_view comment
|
post_id post_info_view image_view comment tags_view
|
||||||
in
|
in
|
||||||
Ok post_view
|
Ok post_view
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue