[OCaml] Mobile-friendly clone of cgit.
remove branches/ page
Remove the branches page entirely: - Remove Branches route variant and dispatcher - Remove branches handler function - Remove branches view function and branch_row helper - Remove Branches from page type and navigation links - Update dispatch tests
Changed files
lib/handlers.ml
@@ -265,10 +265,6 @@
265
265
Views.Repo.files context trail ?readme nodes
266
266
| `Blob blob -> Views.Repo.file context trail blob
267
267
268
Removed:
let branches repository context =
269
Removed:
let* branches = Resolvers.Reference.branches repository in
270
Removed:
Views.Repo.branches context branches
271
Removed:
272
268
let tags repository context =
273
269
let* tags = Resolvers.Reference.tags repository in
274
270
Views.Repo.tags context tags
@@ -374,7 +370,6 @@
374
370
| Routes.Raw hash ->
375
371
Repo.with_repository config name (fun repository context ->
376
372
Repo.raw_file repository context hash)
377
Removed:
| Routes.Branches_page -> Repo.with_repository config name Repo.branches
378
373
| Routes.Tags_page -> Repo.with_repository config name Repo.tags
379
374
| Routes.Readme_page -> Repo.with_repository config name Repo.readme)
380
375
in
lib/routes.ml
@@ -20,7 +20,6 @@
20
20
| Commit of string * string
21
21
| Files of string
22
22
| File of string * string
23
Removed:
| Branches of string
24
23
| Tags of string
25
24
| Readme of string
26
25
| Raw_file of string * string
@@ -35,7 +34,6 @@
35
34
| Commit (repo, hash) -> "/" ^ repo ^ "/commit/" ^ hash
36
35
| Files repo -> "/" ^ repo ^ "/files/"
37
36
| File (repo, hash) -> "/" ^ repo ^ "/file/" ^ hash
38
Removed:
| Branches repo -> "/" ^ repo ^ "/branches/"
39
37
| Tags repo -> "/" ^ repo ^ "/tags/"
40
38
| Readme repo -> "/" ^ repo ^ "/README"
41
39
| Raw_file (repo, hash) -> "/" ^ repo ^ "/raw/" ^ hash
@@ -49,7 +47,6 @@
49
47
| Commit_detail of string
50
48
| Files_page
51
49
| File_detail of string
52
Removed:
| Branches_page
53
50
| Tags_page
54
51
| Readme_page
55
52
| Raw of string
@@ -61,7 +58,6 @@
61
58
"commit";
62
59
"files";
63
60
"file";
64
Removed:
"branches";
65
61
"tags";
66
62
"README";
67
63
"raw";
@@ -90,7 +86,6 @@
90
86
| "commit", [ hash ] -> Some (Commit_detail hash)
91
87
| "files", _ -> Some Files_page
92
88
| "file", [ hash ] -> Some (File_detail hash)
93
Removed:
| "branches", _ -> Some Branches_page
94
89
| "tags", _ -> Some Tags_page
95
90
| "README", _ -> Some Readme_page
96
91
| "raw", [ hash ] -> Some (Raw hash)
lib/views.ml
@@ -19,6 +19,5 @@
19
19
let files = Repo.files
20
20
let file = Repo.file
21
21
let commit = Repo.commit
22
Removed:
let branches = Repo.branches
23
22
let tags = Repo.tags
24
23
end
lib/views/components.ml
@@ -14,7 +14,6 @@
14
14
| Summary
15
15
| Commits
16
16
| Files
17
Removed:
| Branches
18
17
| Tags
19
18
| Readme
20
19
(** Which repository page is being shown. Drives the [aria-current] marker
@@ -58,7 +57,6 @@
58
57
| Summary -> Routes.Repo repo
59
58
| Commits -> Routes.Commits repo
60
59
| Files -> Routes.Files repo
61
Removed:
| Branches -> Routes.Branches repo
62
60
| Tags -> Routes.Tags repo
63
61
| Readme -> Routes.Readme repo
64
62
@@ -66,7 +64,6 @@
66
64
| Summary -> "Summary"
67
65
| Commits -> "Commits"
68
66
| Files -> "Files"
69
Removed:
| Branches -> "Branches"
70
67
| Tags -> "Tags"
71
68
| Readme -> "README"
72
69
@@ -138,7 +135,7 @@
138
135
~control_class:"nav-hamburger" ~label:"Menu" ~glyph:"\xe2\x8b\xae" ();
139
136
Ui.nav_links ~id:"nav-links"
140
137
(List.map (page_link repo ~active)
141
Removed:
[ Summary; Commits; Files; Branches; Tags; Readme ]);
138
Added:
[ Summary; Commits; Files; Tags; Readme ]);
142
139
]
143
140
144
141
(** The same repository destinations as {!repo_nav}, condensed and pinned to the
lib/views/layout.ml
@@ -15,7 +15,6 @@
15
15
| Summary
16
16
| Commits
17
17
| Files
18
Removed:
| Branches
19
18
| Tags
20
19
| Readme
21
20
lib/views/repo.ml
@@ -103,10 +103,6 @@
103
103
104
104
(** {1 Rows} *)
105
105
106
Removed:
let branch_row repo (branch : Resolvers.Reference.t) =
107
Removed:
Ui.item
108
Removed:
[ Components.route_link (Commits_branch (repo, branch.name)) branch.name ]
109
Removed:
110
106
let tag_row repo (tag : Resolvers.Reference.t) =
111
107
Ui.item [ Components.route_link (Tags repo) tag.name ]
112
108
@@ -405,17 +401,6 @@
405
401
@ [ metadata ]
406
402
@ Ui.Diff.view ~empty_message:"No file changes in this commit."
407
403
(List.map diff_file diff))
408
Removed:
409
Removed:
let branches context branches =
410
Removed:
render_page context ~active:Branches
411
Removed:
(match branches with
412
Removed:
| [] ->
413
Removed:
[
414
Removed:
Ui.paragraph_text
415
Removed:
(Printf.sprintf "No branches for repo %s" context.repo);
416
Removed:
]
417
Removed:
| branches ->
418
Removed:
[ Ui.items_of ~id:"branch-list" (branch_row context.repo) branches ])
419
404
420
405
let tags context tags =
421
406
render_page context ~active:Tags
test/test_dispatch.ml
@@ -10,7 +10,6 @@
10
10
| Ogit.Routes.Commit_detail h -> "Commit_detail " ^ h
11
11
| Ogit.Routes.Files_page -> "Files_page"
12
12
| Ogit.Routes.File_detail h -> "File_detail " ^ h
13
Removed:
| Ogit.Routes.Branches_page -> "Branches_page"
14
13
| Ogit.Routes.Tags_page -> "Tags_page"
15
14
| Ogit.Routes.Readme_page -> "Readme_page"
16
15
| Ogit.Routes.Raw h -> "Raw " ^ h
@@ -36,7 +35,6 @@
36
35
check_dispatch "summary" "myrepo/summary/" (Some ("myrepo", Summary));
37
36
check_dispatch "commits" "myrepo/commits/" (Some ("myrepo", Commits_page));
38
37
check_dispatch "files" "myrepo/files/" (Some ("myrepo", Files_page));
39
Removed:
check_dispatch "branches" "myrepo/branches/" (Some ("myrepo", Branches_page));
40
38
check_dispatch "tags" "myrepo/tags/" (Some ("myrepo", Tags_page));
41
39
check_dispatch "readme" "myrepo/README" (Some ("myrepo", Readme_page))
42
40