Add routes.

Commit
399101966720517d67d887129dfd6a35558804aa
Author
Marius Peter <marius.peter@tutanota.com>
Author date
Committer
Marius Peter <marius.peter@tutanota.com>
Committer date
lib/routes.ml
index f6151683..5c93ce42 100644..100644
@@ -3,19 +3,23 @@
3 3 type t =
4 4 | Root
5 5 | Repo of string
6 Removed: | Log of string
7 Removed: | Files of string
8 Removed: | Refs of string
6 Added: | Commits of string
9 7 | Commit of string * string
8 Added: | Files of string
10 9 | File of string * string
10 Added: | Branches of string
11 Added: | Tags of string
12 Added: | Readme of string
11 13
12 14 let%path root_path = "/"
13 15 let%path repo_path = "/%s/summary/"
14 Removed: let%path log_path = "/%s/log/"
15 Removed: let%path files_path = "/%s/files/"
16 Removed: let%path refs_path = "/%s/refs/"
16 Added: let%path commits_path = "/%s/commits/"
17 17 let%path commit_path = "/%s/commit/%s"
18 Added: let%path files_path = "/%s/files/"
18 19 let%path file_path = "/%s/file/%s"
20 Added: let%path branches_path = "/%s/branches/"
21 Added: let%path tags_path = "/%s/tags/"
22 Added: let%path readme_path = "/%s/README"
19 23
20 24 let link_to route ?(other_attrs = []) contents =
21 25 let open Dream_html in
@@ -23,10 +27,12 @@
23 27 let path = function
24 28 | Root -> path_attr href root_path
25 29 | Repo repo -> path_attr href repo_path repo
26 Removed: | Log repo -> path_attr href log_path repo
27 Removed: | Files repo -> path_attr href files_path repo
28 Removed: | Refs repo -> path_attr href refs_path repo
30 Added: | Commits repo -> path_attr href commits_path repo
29 31 | Commit (repo, commit) -> path_attr href commit_path repo commit
32 Added: | Files repo -> path_attr href files_path repo
30 33 | File (repo, hash) -> path_attr href file_path repo hash
34 Added: | Branches repo -> path_attr href branches_path repo
35 Added: | Tags repo -> path_attr href tags_path repo
36 Added: | Readme repo -> path_attr href readme_path repo
31 37 in
32 38 a (path route :: other_attrs) [ contents ]