[OCaml] Mobile-friendly clone of cgit.
Replace commit short hash with timestamp.
Changed files
lib/static/styles.css
@@ -77,7 +77,7 @@
77
77
padding: 0.5em 0;
78
78
}
79
79
80
Removed:
.commit-hash {
80
Added:
.timestamp {
81
81
font-family: monospace;
82
82
}
83
83
lib/views.ml
@@ -99,17 +99,23 @@
99
99
HTML.(li [] [ Routes.link_to (Refs repo) (txt "%s" branch.name) ])
100
100
101
101
let li_of_commit repo (commit : Resolvers.Commit.t) =
102
Removed:
let short_hash = Resolvers.short_hash commit.hash in
103
Removed:
let hash_span =
104
Removed:
HTML.(span [ class_ "commit-hash" ] [ txt "%s" short_hash ])
102
Added:
let timestamp (date, _) =
103
Added:
let tm = date |> Int64.to_float |> Unix.localtime in
104
Added:
Printf.sprintf "%04d-%02d-%02d %02d:%02d" (tm.tm_year + 1900)
105
Added:
(tm.tm_mon + 1) tm.tm_mday tm.tm_hour tm.tm_min
105
106
in
107
Added:
let timestamp_span =
108
Added:
(* HTML.(span [ class_ "commit-hash" ] [ txt "%s" commit.datetime ]) *)
109
Added:
HTML.(
110
Added:
span [ class_ "timestamp" ] [ txt "%s" (timestamp commit.author.date) ])
111
Added:
in
106
112
let description =
107
113
match commit.message with
108
114
| None -> HTML.null []
109
115
| Some msg -> txt " %s" msg
110
116
in
111
117
let route = Routes.Commit (repo, commit.hash) in
112
Removed:
let node = HTML.null [ hash_span; description ] in
118
Added:
let node = HTML.null [ timestamp_span; description ] in
113
119
HTML.li [] [ Routes.link_to route node ]
114
120
115
121
let li_of_entry repo (entry : Resolvers.Entry.t) =