[OCaml] Mobile-friendly clone of cgit.
refactor add descriptive ids to notable ul elements
- #repo-list-favorites, #repo-list, #repo-list-archived (root page) - #commit-list (summary and commits pages) - #file-tree (files page) - #branch-list, #tag-list (branches/tags pages) - #nav-links (top nav), #bottom-nav-links (bottom nav)
Changed files
lib/views/layout.ml
@@ -55,7 +55,7 @@
55
55
label
56
56
[ for_ "nav-toggle"; class_ "nav-hamburger"; Aria.label "Menu" ]
57
57
[ txt "\xe2\x8b\xae" ];
58
Removed:
ul [] (List.map li_of_item nav_items);
58
Added:
ul [ id "nav-links" ] (List.map li_of_item nav_items);
59
59
])
60
60
61
61
let page_header ~has_repo page_title subtitle =
@@ -132,7 +132,7 @@
132
132
HTML.(
133
133
nav
134
134
[ id "bottom-nav"; Aria.label "Mobile navigation" ]
135
Removed:
[ ul [] (List.map li_of_item items) ])
135
Added:
[ ul [ id "bottom-nav-links" ] (List.map li_of_item items) ])
136
136
137
137
let body ~user_name ~root_title page_data =
138
138
let open HTML in
lib/views/repo.ml
@@ -490,7 +490,7 @@
490
490
HTML.
491
491
[
492
492
h3 [] [ txt "Latest commits" ];
493
Removed:
ul [] (List.map (li_of_commit context.repo) commits);
493
Added:
ul [ id "commit-list" ] (List.map (li_of_commit context.repo) commits);
494
494
p
495
495
[ class_ "summary-more" ]
496
496
[
@@ -663,7 +663,8 @@
663
663
render_page context ~active:Commits ~toolbar:[ tb ]
664
664
HTML.
665
665
[
666
Removed:
ul []
666
Added:
ul
667
Added:
[ id "commit-list" ]
667
668
(List.map
668
669
(li_of_commit ~hide_pill ?filter_type ?author ?committer
669
670
context.repo)
@@ -725,7 +726,8 @@
725
726
render_page context ~active:Files ~toolbar:[ tb ]
726
727
HTML.
727
728
[
728
Removed:
ul [] (List.map (li_of_tree_node context.repo) entries); readme_section;
729
Added:
ul [ id "file-tree" ] (List.map (li_of_tree_node context.repo) entries);
730
Added:
readme_section;
729
731
]
730
732
731
733
let file ?(active = Layout.Files) context trail (blob : Resolvers.Blob.t) =
@@ -898,7 +900,13 @@
898
900
let content =
899
901
match branches with
900
902
| [] -> HTML.[ p [] [ txt "No branches for repo %s" context.repo ] ]
901
Removed:
| branches -> HTML.[ ul [] (List.map (li_of_branch context.repo) branches) ]
903
Added:
| branches ->
904
Added:
HTML.
905
Added:
[
906
Added:
ul
907
Added:
[ id "branch-list" ]
908
Added:
(List.map (li_of_branch context.repo) branches);
909
Added:
]
902
910
in
903
911
render_page context ~active:Branches content
904
912
@@ -906,6 +914,7 @@
906
914
let content =
907
915
match tags with
908
916
| [] -> HTML.[ p [] [ txt "No tags for repo %s" context.repo ] ]
909
Removed:
| tags -> HTML.[ ul [] (List.map (li_of_tag context.repo) tags) ]
917
Added:
| tags ->
918
Added:
HTML.[ ul [ id "tag-list" ] (List.map (li_of_tag context.repo) tags) ]
910
919
in
911
920
render_page context ~active:Tags content
lib/views/root.ml
@@ -57,8 +57,9 @@
57
57
58
58
let render ~user_name ~root_title ~dates ?(favorites = []) ?(archived = [])
59
59
?readme nodes =
60
Removed:
let repo_list nodes =
61
Removed:
HTML.(ul [] (List.map (li_of_fs_node ~prefix:"" ~dates) nodes))
60
Added:
let repo_list list_id nodes =
61
Added:
HTML.(
62
Added:
ul [ id "%s" list_id ] (List.map (li_of_fs_node ~prefix:"" ~dates) nodes))
62
63
in
63
64
let favorites_section =
64
65
match favorites with
@@ -76,7 +77,7 @@
76
77
span [ class_ "tree-chevron" ] [ txt "\xe2\x80\xba" ];
77
78
h1 [] [ txt "Favorites" ];
78
79
];
79
Removed:
repo_list favorites;
80
Added:
repo_list "repo-list-favorites" favorites;
80
81
];
81
82
])
82
83
in
@@ -87,7 +88,7 @@
87
88
(match (favorites, archived) with
88
89
| [], [] ->
89
90
(* No partitioning — render flat without a heading *)
90
Removed:
[ repo_list nodes ]
91
Added:
[ repo_list "repo-list" nodes ]
91
92
| _ ->
92
93
if nodes = [] then []
93
94
else
@@ -100,7 +101,7 @@
100
101
span [ class_ "tree-chevron" ] [ txt "\xe2\x80\xba" ];
101
102
h1 [] [ txt "Repositories" ];
102
103
];
103
Removed:
repo_list nodes;
104
Added:
repo_list "repo-list" nodes;
104
105
];
105
106
]))
106
107
in
@@ -120,7 +121,7 @@
120
121
span [ class_ "tree-chevron" ] [ txt "\xe2\x80\xba" ];
121
122
h1 [] [ txt "Archived" ];
122
123
];
123
Removed:
repo_list archived;
124
Added:
repo_list "repo-list-archived" archived;
124
125
];
125
126
])
126
127
in