diff options
author | Marius Peter <marius.peter@tutanota.com> | 2025-06-07 19:42:02 +0200 |
---|---|---|
committer | Marius Peter <marius.peter@tutanota.com> | 2025-06-07 19:42:02 +0200 |
commit | 0647fb79dea80219ea0b0be2b315163d9a5d3ae2 (patch) | |
tree | 0e098461d5e6e7343082f3905ea7a565d50b44df /lib/views.ml | |
parent | 21cbcf2e8b69403f3973fa19e5e96bee5ba870b7 (diff) |
Routes.link_to now accepts arbitrary nodes as content.
Diffstat (limited to 'lib/views.ml')
-rw-r--r-- | lib/views.ml | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/lib/views.ml b/lib/views.ml index 283d8d9..b6cf617 100644 --- a/lib/views.ml +++ b/lib/views.ml @@ -82,8 +82,10 @@ let root () = Sys.readdir config.git_project_root |> Array.to_list |> List.sort String.compare in - HTML.( - div [ id "repositories" ] [ ul [] @@ List.map Routes.li_of_repo repos ]) + let li_of_repo repo = + HTML.li [] [ Routes.link_to (Routes.Repo repo) (txt "%s" repo) ] + in + HTML.(div [ id "repositories" ] [ ul [] @@ List.map li_of_repo repos ]) in let body_data = { @@ -99,19 +101,24 @@ module Repo = struct let page_title repo = Printf.sprintf "%s — %s" repo (repo_description repo) let li_of_branch repo (branch : branch) = - HTML.(li [] [ Routes.link_to branch.name (Tag (repo, branch.name)) ]) + HTML.( + li [] [ Routes.link_to (Tag (repo, branch.name)) (txt "%s" branch.name) ]) let li_of_commit repo commit = + let open HTML in match commit.message with + | None -> li [] [ txt "%s" commit.short_hash ] | Some msg -> - HTML.( - li [] - [ - Routes.link_to - (commit.short_hash ^ " - " ^ msg) - (Commit (repo, commit.hash)); - ]) - | None -> HTML.(li [] [ txt "%s" commit.short_hash ]) + li [] + [ + Routes.link_to + (Commit (repo, commit.hash)) + (null + [ + span [ class_ "commit-hash" ] [ txt "%s" commit.short_hash ]; + txt " — %s" msg; + ]); + ] let summary repo branches commits authors = let li_of_branch = li_of_branch repo in |