[OCaml] Mobile-friendly clone of cgit.
Miscellaneous cleanup.
Changed files
bin/main.ml
@@ -1,1 +1,3 @@
1
Added:
(* -*- mode: tuareg; -*- *)
2
Added:
1
3
let () = Ogit.Main.run ()
lib/handlers.ml
@@ -53,11 +53,11 @@
53
53
let readme req =
54
54
let repo = Dream.param req "repo" in
55
55
let* readme = Resolvers.Repo.readme repo in
56
Added:
Views.Repo.file repo
57
Added:
@@
56
58
match readme with
57
Removed:
| None ->
58
Removed:
let content = "README does not exist for " ^ repo in
59
Removed:
Views.Repo.file repo { content }
60
Removed:
| Some file -> Views.Repo.file repo file
59
Added:
| None -> { content = "README does not exist for " ^ repo }
60
Added:
| Some file -> file
61
61
end
62
62
63
63
let all_handlers =
lib/resolvers.ml
@@ -83,8 +83,8 @@
83
83
84
84
let tags repo =
85
85
let* references = all repo in
86
Removed:
let is_branch reference = String.starts_with ~prefix:"v" reference.name in
87
Removed:
Lwt_result.return @@ List.filter is_branch references
86
Added:
let is_tag reference = String.starts_with ~prefix:"v" reference.name in
87
Added:
Lwt_result.return @@ List.filter is_tag references
88
88
89
89
let of_id repo id =
90
90
let* branches = branches repo in
@@ -115,7 +115,7 @@
115
115
{ hash; name; perm }
116
116
117
117
let is_readme { name; _ } =
118
Removed:
String.lowercase_ascii name |> String.starts_with ~prefix:"readme"
118
Added:
String.(lowercase_ascii name |> starts_with ~prefix:"readme")
119
119
end
120
120
121
121
module Tree = struct
lib/views.ml
@@ -10,7 +10,7 @@
10
10
repo : string option;
11
11
subtitle : string;
12
12
active : page;
13
Removed:
content : Dream_html.node list;
13
Added:
content : node list;
14
14
}
15
15
16
16
let page_to_nav_item repo = function
@@ -155,28 +155,6 @@
155
155
];
156
156
}
157
157
158
Removed:
let branches repo branches =
159
Removed:
respond
160
Removed:
@@ Page.render ~page_title:(page_title repo)
161
Removed:
{
162
Removed:
repo = Some repo;
163
Removed:
title = repo;
164
Removed:
subtitle = Resolvers.repo_description repo;
165
Removed:
active = Branches;
166
Removed:
content = HTML.[ ul [] @@ List.map (li_of_branch repo) branches ];
167
Removed:
}
168
Removed:
169
Removed:
let tags repo tags =
170
Removed:
respond
171
Removed:
@@ Page.render ~page_title:(page_title repo)
172
Removed:
{
173
Removed:
repo = Some repo;
174
Removed:
title = repo;
175
Removed:
subtitle = Resolvers.repo_description repo;
176
Removed:
active = Tags;
177
Removed:
content = HTML.[ ul [] @@ List.map (li_of_tag repo) tags ];
178
Removed:
}
179
Removed:
180
158
let commits repo commits =
181
159
respond
182
160
@@ Page.render ~page_title:(page_title repo)
@@ -233,6 +211,38 @@
233
211
subtitle = Resolvers.repo_description repo;
234
212
active = Summary;
235
213
content = HTML.[ h3 [] [ txt "%s" message ] ];
214
Added:
}
215
Added:
216
Added:
let branches repo branches =
217
Added:
let content =
218
Added:
match branches with
219
Added:
| [] -> HTML.[ p [] [ txt "No branches for repo %s" repo ] ]
220
Added:
| branches -> HTML.[ ul [] @@ List.map (li_of_branch repo) branches ]
221
Added:
in
222
Added:
respond
223
Added:
@@ Page.render ~page_title:(page_title repo)
224
Added:
{
225
Added:
repo = Some repo;
226
Added:
title = repo;
227
Added:
subtitle = Resolvers.repo_description repo;
228
Added:
active = Branches;
229
Added:
content;
230
Added:
}
231
Added:
232
Added:
let tags repo tags =
233
Added:
let content =
234
Added:
match tags with
235
Added:
| [] -> HTML.[ p [] [ txt "No tags for repo %s" repo ] ]
236
Added:
| tags -> HTML.[ ul [] @@ List.map (li_of_tag repo) tags ]
237
Added:
in
238
Added:
respond
239
Added:
@@ Page.render ~page_title:(page_title repo)
240
Added:
{
241
Added:
repo = Some repo;
242
Added:
title = repo;
243
Added:
subtitle = Resolvers.repo_description repo;
244
Added:
active = Tags;
245
Added:
content;
236
246
}
237
247
end
238
248