[OCaml] Mobile-friendly clone of cgit.
refactor taste-check cleanup
- Remove dead .breadcrumbs CSS rule (replaced by .path-pill) - Remove dead li_of_entry function (replaced by li_of_preloaded) - Fix duplicate #blob id: inline README now uses class='blob' - Extend blob CSS selectors to cover both #blob and .blob - DRY: filter_commits now reuses Views.Repo.parse_conventional instead of re-implementing conventional commit prefix matching Remaining known debt: - Magic sticky top:88px depends on navbar+toolbar height - commits_branch handler lacks pagination query support - div#main ul li specificity could be tighter
Changed files
lib/handlers.ml
@@ -67,22 +67,14 @@
67
67
(fun (commit : Resolvers.Commit.t) ->
68
68
match commit.message with
69
69
| None -> false
70
Removed:
| Some message -> (
70
Added:
| Some message ->
71
71
let summary =
72
72
match String.split_on_char '\n' message with
73
73
| [] -> ""
74
74
| s :: _ -> s
75
75
in
76
Removed:
match String.index_opt summary ':' with
77
Removed:
| None -> false
78
Removed:
| Some colon_pos ->
79
Removed:
let prefix = String.sub summary 0 colon_pos in
80
Removed:
let type_name =
81
Removed:
match String.index_opt prefix '(' with
82
Removed:
| Some paren_pos -> String.sub prefix 0 paren_pos
83
Removed:
| None -> prefix
84
Removed:
in
85
Removed:
String.lowercase_ascii type_name = ct))
76
Added:
let commit_type, _ = Views.Repo.parse_conventional summary in
77
Added:
commit_type = Some ct)
86
78
commits
87
79
88
80
let page_size = 20
lib/static/styles.css
@@ -188,10 +188,6 @@
188
188
border-top: none;
189
189
}
190
190
191
Removed:
div#main .breadcrumbs li {
192
Removed:
border: none;
193
Removed:
}
194
Removed:
195
191
/* File/branch/tag list items (still use li > a wrapping pattern) */
196
192
197
193
div#main ul li > a {
@@ -457,7 +453,8 @@
457
453
font-size: 0.85em;
458
454
}
459
455
460
Removed:
#blob {
456
Added:
#blob,
457
Added:
.blob {
461
458
display: grid;
462
459
column-gap: 1.5em;
463
460
row-gap: 0.2em;
@@ -466,24 +463,28 @@
466
463
overflow-x: auto;
467
464
}
468
465
469
Removed:
#blob a.line-anchor {
466
Added:
#blob a.line-anchor,
467
Added:
.blob a.line-anchor {
470
468
color: #b0b0b0;
471
469
text-decoration: none;
472
470
text-align: right;
473
471
}
474
472
475
Removed:
#blob a.line-anchor:target {
473
Added:
#blob a.line-anchor:target,
474
Added:
.blob a.line-anchor:target {
476
475
color: white;
477
476
background-color: grey;
478
477
}
479
478
480
Removed:
#blob a.line-anchor:hover {
479
Added:
#blob a.line-anchor:hover,
480
Added:
.blob a.line-anchor:hover {
481
481
color: skyblue;
482
482
background-color: inherit;
483
483
text-decoration: none;
484
484
}
485
485
486
Removed:
#blob span.line {
486
Added:
#blob span.line,
487
Added:
.blob span.line {
487
488
white-space: preserve-spaces;
488
489
}
489
490
@@ -675,7 +676,7 @@
675
676
border-bottom: 1px solid #3a3a3a;
676
677
}
677
678
678
Removed:
.readme-inline #blob {
679
Added:
.readme-inline .blob {
679
680
padding: 0.5em 0;
680
681
}
681
682
@@ -844,7 +845,8 @@
844
845
width: 100%;
845
846
}
846
847
847
Removed:
#blob {
848
Added:
#blob,
849
Added:
.blob {
848
850
column-gap: 0.75em;
849
851
row-gap: 0;
850
852
grid-template-columns: max-content auto;
lib/views/repo.ml
@@ -145,13 +145,6 @@
145
145
ago_span;
146
146
])
147
147
148
Removed:
let li_of_entry repo (entry : Resolvers.Entry.t) =
149
Removed:
let route = Routes.File (repo, entry.hash) in
150
Removed:
let text =
151
Removed:
txt "%s" (if entry.perm = Dir then entry.name ^ "/" else entry.name)
152
Removed:
in
153
Removed:
HTML.(li [] [ Routes.link_to route text ])
154
Removed:
155
148
let rec li_of_preloaded repo (pe : Resolvers.Tree.preloaded_entry) =
156
149
let entry = pe.entry in
157
150
let route = Routes.File (repo, entry.hash) in
@@ -369,7 +362,7 @@
369
362
HTML.(
370
363
section
371
364
[ class_ "readme-inline" ]
372
Removed:
[ h3 [] [ txt "README" ]; div [ id "blob" ] formatted ])
365
Added:
[ h3 [] [ txt "README" ]; div [ class_ "blob" ] formatted ])
373
366
in
374
367
render_page context ~active:Files
375
368
HTML.