[OCaml] Mobile-friendly clone of cgit.
refactor name identity_link and overflow_row for what they build
Both functions returned markup but were named as though they returned data. identity renders a person's name as a link that filters the commit list by them; identity alone suggested a value. truncated is an adjective used as a noun, describing the list rather than the row it produces. Rename to identity_link and overflow_row, so each name says what comes back.
Changed files
lib/views/components.ml
@@ -164,7 +164,8 @@
164
164
let file_entry ?modifier ~route name =
165
165
Ui.tree_leaf ?modifier ~href:(url route) name
166
166
167
Removed:
let truncated ~route count =
167
Added:
(** The row closing a truncated listing, linking to the full contents. *)
168
Added:
let overflow_row ~route count =
168
169
Ui.tree_overflow ~href:(url route)
169
170
(Printf.sprintf "%d more items\xe2\x80\xa6" count)
170
171
lib/views/repo.ml
@@ -68,8 +68,8 @@
68
68
69
69
(** A person's name, linking to the commits attributed to them. Keeps the other
70
70
active filters intact so identities compose with type filters. *)
71
Removed:
let identity ?filter_type ?author ?committer ?(show_email = false) ~role repo
72
Removed:
(user : Resolvers.Commit.user) =
71
Added:
let identity_link ?filter_type ?author ?committer ?(show_email = false) ~role
72
Added:
repo (user : Resolvers.Commit.user) =
73
73
let href, role_name =
74
74
match role with
75
75
| `Author ->
@@ -143,7 +143,7 @@
143
143
| None ->
144
144
Ui.inline ~class_:"commit-author"
145
145
[
146
Removed:
identity ?filter_type ?author ?committer ~role:`Author repo
146
Added:
identity_link ?filter_type ?author ?committer ~role:`Author repo
147
147
commit.author;
148
148
]);
149
149
]
@@ -170,7 +170,7 @@
170
170
(List_ext.take tree_display_limit children, total - tree_display_limit)
171
171
in
172
172
let overflow =
173
Removed:
if omitted = 0 then [] else [ Components.truncated ~route omitted ]
173
Added:
if omitted = 0 then [] else [ Components.overflow_row ~route omitted ]
174
174
in
175
175
Components.directory ~modifier ~route ~name:entry.name
176
176
(List.map (tree_row repo) shown @ overflow)
@@ -401,12 +401,14 @@
401
401
[
402
402
("Commit", [ Ui.text commit.hash ]);
403
403
( "Author",
404
Removed:
[ identity ~show_email:true ~role:`Author context.repo commit.author ]
405
Removed:
);
404
Added:
[
405
Added:
identity_link ~show_email:true ~role:`Author context.repo
406
Added:
commit.author;
407
Added:
] );
406
408
("Author date", [ timestamp commit.author.date ]);
407
409
( "Committer",
408
410
[
409
Removed:
identity ~show_email:true ~role:`Committer context.repo
411
Added:
identity_link ~show_email:true ~role:`Committer context.repo
410
412
commit.committer;
411
413
] );
412
414
("Committer date", [ timestamp commit.committer.date ]);