[OCaml] Mobile-friendly clone of cgit.
fix remove README panel from files/ directory listings
The README is now shown only on the summary page. Directory listings in files/ no longer fetch or display the inline README panel. Remove the find_readme helper (now unused) and the ?readme parameter from Repo.files.
Changed files
lib/handlers.ml
@@ -240,20 +240,10 @@
240
240
let* diff = Resolvers.Diff.of_commit repository commit in
241
241
Views.Repo.commit context commit diff
242
242
243
Removed:
let find_readme repository (tree : Resolvers.Tree.t) =
244
Removed:
match List.find_opt Resolvers.Entry.is_readme tree.entries with
245
Removed:
| None -> Lwt_result.return None
246
Removed:
| Some entry ->
247
Removed:
Lwt.bind (Resolvers.blob_or_tree repository entry.hash) (function
248
Removed:
| Ok (`Blob blob) -> Lwt.return (Ok (Some blob))
249
Removed:
| Ok _ -> Lwt.return (Ok None)
250
Removed:
| Error e -> Lwt.return (Error e))
251
Removed:
252
243
let files_at_head repository context =
253
244
let* tree = Resolvers.Tree.head repository in
254
245
let* nodes = Resolvers.Tree.expand repository tree in
255
Removed:
let* readme = find_readme repository tree in
256
Removed:
Views.Repo.files context [] ?readme nodes
246
Added:
Views.Repo.files context [] nodes
257
247
258
248
let file_id repository context id =
259
249
let* trail = Resolvers.Tree.find_path repository id in
@@ -261,8 +251,7 @@
261
251
match object_ with
262
252
| `Tree tree ->
263
253
let* nodes = Resolvers.Tree.expand repository tree in
264
Removed:
let* readme = find_readme repository tree in
265
Removed:
Views.Repo.files context trail ?readme nodes
254
Added:
Views.Repo.files context trail nodes
266
255
| `Blob blob -> Views.Repo.file context trail blob
267
256
268
257
let raw_file repository _context id =
lib/views/repo.ml
@@ -278,16 +278,11 @@
278
278
commits;
279
279
]
280
280
281
Removed:
let files context trail ?readme (entries : Resolvers.Tree.tree_node list) =
282
Removed:
let readme_panel =
283
Removed:
match readme with
284
Removed:
| None -> Ui.nothing
285
Removed:
| Some (blob : Resolvers.Blob.t) -> Components.inline_readme blob.content
286
Removed:
in
281
Added:
let files context trail (entries : Resolvers.Tree.tree_node list) =
287
282
render_page context ~active:Files
288
283
~toolbar:[ path_trail context.repo trail ]
289
284
[
290
Removed:
Ui.items_of ~id:"file-tree" (tree_row context.repo) entries; readme_panel;
285
Added:
Ui.items_of ~id:"file-tree" (tree_row context.repo) entries;
291
286
]
292
287
293
288
let file context trail (blob : Resolvers.Blob.t) =