Complete the grouping design within the existing table.

This commit is contained in:
Kerwin Bryant 2025-04-03 02:58:35 +00:00
parent c27d87a9ac
commit b29d401233
3 changed files with 17 additions and 1 deletions

View File

@ -20,6 +20,12 @@ func NewDateUtils() *DateUtils {
return (*DateUtils)(nil) // the util is stateless, and we do not need to create an instance
}
func (du *DateUtils) DaysInterval(t1, t2 time.Time) int {
t1 = time.Date(t1.Year(), t1.Month(), t1.Day(), 0, 0, 0, 0, t1.Location())
t2 = time.Date(t2.Year(), t2.Month(), t2.Day(), 0, 0, 0, 0, t2.Location())
return int(t2.Sub(t1).Hours() / 24)
}
// AbsoluteShort renders in "Jan 01, 2006" format
func (du *DateUtils) AbsoluteShort(time any) template.HTML {
return dateTimeFormat("short", time)

View File

@ -11,7 +11,13 @@
</thead>
<tbody class="commit-list">
{{$commitRepoLink := $.RepoLink}}{{if $.CommitRepoLink}}{{$commitRepoLink = $.CommitRepoLink}}{{end}}
{{$groupDate := DateUtils.ParseLegacy ""}}
{{range .Commits}}
{{$commitDate := ""}}{{if .Committer}}{{$commitDate = .Committer.When}}{{else}}{{$commitDate = .Author.When}}{{end}}
{{if ne (DateUtils.DaysInterval $groupDate $commitDate) 0}}
{{$groupDate = $commitDate}}
<tr class="header"><td colspan="5">Commits on {{DateUtils.AbsoluteShort $groupDate}}</td></tr>
{{end}}
<tr>
<td class="author">
<div class="tw-flex">

View File

@ -916,7 +916,11 @@ td .commit-summary {
width: 200px;
}
.repository #commits-table.ui.basic.striped.table tbody tr:nth-child(2n) {
.repository #commits-table.ui.basic.striped.table tbody tr {
background-color: inherit !important;
}
.repository #commits-table.ui.basic.striped.table tbody tr:not(.header):nth-child(2n) {
background-color: var(--color-light) !important;
}