summaryrefslogtreecommitdiff
path: root/lib/routes.ml
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2025-06-09 18:11:34 +0200
committerMarius Peter <marius.peter@tutanota.com>2025-06-09 18:11:34 +0200
commit50960c7ccbae4a4e8f4f53010543752635b4d8cd (patch)
treeec18a7dff3ab0beb6d2c5776ce43572dfdf8c004 /lib/routes.ml
parentafe686e6bab1d4b6a85b1f5c610f57fcf1a72d74 (diff)
Implement Topnav module with proper routes.
Diffstat (limited to 'lib/routes.ml')
-rw-r--r--lib/routes.ml27
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/routes.ml b/lib/routes.ml
index 84c2851..f615168 100644
--- a/lib/routes.ml
+++ b/lib/routes.ml
@@ -3,27 +3,30 @@
type t =
| Root
| Repo of string
- | Tag of string * string
+ | Log of string
+ | Files of string
+ | Refs of string
| Commit of string * string
- | Tree of string * string
- | Blob of string * string
+ | File of string * string
let%path root_path = "/"
-let%path repo_path = "/%s/"
-let%path tag_path = "/%s/refs/%s"
+let%path repo_path = "/%s/summary/"
+let%path log_path = "/%s/log/"
+let%path files_path = "/%s/files/"
+let%path refs_path = "/%s/refs/"
let%path commit_path = "/%s/commit/%s"
-let%path tree_path = "/%s/tree/%s"
-let%path blob_path = "/%s/blob/%s"
+let%path file_path = "/%s/file/%s"
-let link_to route contents =
+let link_to route ?(other_attrs = []) contents =
let open Dream_html in
let open HTML in
let path = function
| Root -> path_attr href root_path
| Repo repo -> path_attr href repo_path repo
- | Tag (repo, branch) -> path_attr href tag_path repo branch
+ | Log repo -> path_attr href log_path repo
+ | Files repo -> path_attr href files_path repo
+ | Refs repo -> path_attr href refs_path repo
| Commit (repo, commit) -> path_attr href commit_path repo commit
- | Tree (repo, hash) -> path_attr href tree_path repo hash
- | Blob (repo, hash) -> path_attr href blob_path repo hash
+ | File (repo, hash) -> path_attr href file_path repo hash
in
- a [ path route ] [ contents ]
+ a (path route :: other_attrs) [ contents ]
Copyright 2019--2025 Marius PETER