summaryrefslogtreecommitdiff
path: root/lib/views.ml
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2025-06-21 14:06:43 +0200
committerMarius Peter <marius.peter@tutanota.com>2025-06-21 14:06:43 +0200
commit08a42b99a2ba69e953dc5ffd7e2b429f2f808874 (patch)
treee74753bd72e8af59cb54706e38c46f99757dc3c6 /lib/views.ml
parent034ae69f2f22d7957386e73b3c42053fbf0cdfb2 (diff)
Reintroduce branches.
Diffstat (limited to 'lib/views.ml')
-rw-r--r--lib/views.ml42
1 files changed, 22 insertions, 20 deletions
diff --git a/lib/views.ml b/lib/views.ml
index ca012fc..3a5de9d 100644
--- a/lib/views.ml
+++ b/lib/views.ml
@@ -95,25 +95,27 @@ module Repo = struct
let li_of_author author = HTML.(li [] [ txt "%s" author ])
- (* let li_of_branch repo (branch : Resolvers.Branch.t) = *)
- (* HTML.(li [] [ Routes.link_to (Refs repo) (txt "%s" branch.name) ]) *)
+ let li_of_branch repo (branch : Resolvers.Branch.t) =
+ HTML.(li [] [ Routes.link_to (Refs repo) (txt "%s" branch.name) ])
let li_of_commit repo (commit : Resolvers.Commit.t) =
- let open HTML in
let short_hash = Resolvers.short_hash commit.hash in
- match commit.message with
- | None -> li [] [ txt "%s" short_hash ]
- | Some msg ->
- li []
- [
- Routes.link_to
- (Commit (repo, commit.hash))
- (null
- [
- span [ class_ "commit-hash" ] [ txt "%s" short_hash ];
- txt " — %s" msg;
- ]);
- ]
+ let content =
+ match commit.message with
+ | None -> txt "%s" short_hash
+ | Some msg ->
+ let route = Routes.Commit (repo, commit.hash) in
+ let node =
+ HTML.(
+ null
+ [
+ span [ class_ "commit-hash" ] [ txt "%s" short_hash ];
+ txt " — %s" msg;
+ ])
+ in
+ Routes.link_to route node
+ in
+ HTML.li [] [ content ]
let li_of_entry repo (entry : Resolvers.Entry.t) =
let display_name =
@@ -125,12 +127,12 @@ module Repo = struct
in
HTML.(li [] [ Routes.link_to route @@ txt "%s" display_name ])
- let summary repo _branches commits authors =
+ let summary repo branches commits authors =
let content =
HTML.
[
h3 [] [ txt "Branches" ];
- (* ul [] (List.map (li_of_branch repo) branches); *)
+ ul [] (List.map (li_of_branch repo) branches);
h3 [] [ txt "Latest commits" ];
ul [] (List.map (li_of_commit repo) commits);
h3 [] [ txt "Authors" ];
@@ -146,12 +148,12 @@ module Repo = struct
content;
}
- let refs repo _branches =
+ let refs repo branches =
let content =
HTML.
[
h3 [] [ txt "Branches" ];
- (* ul [] (List.map (li_of_branch repo) branches); *)
+ ul [] (List.map (li_of_branch repo) branches);
]
in
respond
Copyright 2019--2025 Marius PETER