diff options
Diffstat (limited to 'lib/views.ml')
-rw-r--r-- | lib/views.ml | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/views.ml b/lib/views.ml index 843afdc..0fc9764 100644 --- a/lib/views.ml +++ b/lib/views.ml @@ -1,3 +1,5 @@ +open Config + type head_data = { page_title : string } type body_data = { @@ -49,7 +51,7 @@ module Page = struct let footer () = let today = Unix.localtime (Unix.time ()) in let year = string_of_int (today.Unix.tm_year + 1900) in - let footer_text = Printf.sprintf "Copyright %s %s" year Config.author in + let footer_text = Printf.sprintf "Copyright %s %s" year config.user in footer [] [ txt "%s" footer_text ] let default_head_data = { page_title = "Ogit" } @@ -88,9 +90,9 @@ let root () = let body_data = { title = "Ogit"; - subtitle = "Repositories for " ^ Config.author; + subtitle = "Repositories for " ^ config.user; topnav = HTML.null []; - content = [ repositories_in Config.git_directory ]; + content = [ repositories_in config.repositories_root ]; } in Page.render body_data @@ -101,7 +103,7 @@ module Repo = struct let li_of_branch branch = HTML.(li [] [ a [ href "%s" branch ] [ txt "%s" branch ] ]) in - let li_of_commit (commit : Git_helpers.Commit.t) = + let li_of_commit (commit : Git_presenters.Commit.t) = match commit.message with | Some msg -> HTML.( @@ -109,7 +111,7 @@ module Repo = struct [ a [ href "commit/?id=%s" commit.hash ] - [ txt "%s %s" (Git_helpers.short_hash commit.hash) msg ]; + [ txt "%s %s" commit.short_hash msg ]; ]) | None -> HTML.(li [] [ a [ href "" ] [ txt "caca!!" ] ]) in @@ -130,7 +132,7 @@ module Repo = struct Page.render { title = repo; - subtitle = Git_helpers.repo_description repo; + subtitle = Git_presenters.repo_description repo; topnav = Components.topnav repo; content; } @@ -141,7 +143,7 @@ module Repo = struct HTML. { title = repo; - subtitle = Git_helpers.repo_description repo; + subtitle = Git_presenters.repo_description repo; topnav = Components.topnav repo; content = [ null [] ]; } @@ -152,7 +154,7 @@ module Repo = struct HTML. { title = repo; - subtitle = Git_helpers.repo_description repo; + subtitle = Git_presenters.repo_description repo; topnav = Components.topnav repo; content = [ null [] ]; } @@ -163,17 +165,16 @@ module Repo = struct HTML. { title = repo; - subtitle = Git_helpers.repo_description repo; + subtitle = Git_presenters.repo_description repo; topnav = Components.topnav repo; content = [ null [] ]; } - let commit repo (commit : Git_helpers.Commit.t) = + let commit repo (commit : Git_presenters.Commit.t) = let open Dream_html in - let open Git_helpers in let message = match commit.message with Some msg -> msg | None -> "" in let content = HTML.[ h3 [] [ txt "%s" message ] ] in - let title = Printf.sprintf "%s : %s" repo (short_hash commit.hash) in + let title = Printf.sprintf "%s : %s" repo commit.short_hash in Page.render { title; subtitle = ""; topnav = Components.topnav repo; content } end |