diff --git a/options/locale_next/locale_en-US.json b/options/locale_next/locale_en-US.json index 85a21ef28d..f3ac162fac 100644 --- a/options/locale_next/locale_en-US.json +++ b/options/locale_next/locale_en-US.json @@ -52,6 +52,10 @@ "relativetime.1week": "last week", "relativetime.1month": "last month", "relativetime.1year": "last year", + "repo.files.caption": "Repository files (latest commit first)", + "repo.files.filename": "Filename", + "repo.files.last_commit_message": "Latest commit message", + "repo.files.last_commit_date": "Latest commit date", "repo.issues.filter_poster.hint": "Filter by the author", "repo.issues.filter_assignee.hint": "Filter by assigned user", "repo.issues.filter_reviewers.hint": "Filter by user who reviewed", diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index ffd8b1a515..cc583d18c7 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -1,17 +1,23 @@ - + + + + + + + - + + - - {{if .HasParentPath}} diff --git a/tests/integration/repo_test.go b/tests/integration/repo_test.go index 1b4a574f13..2f189bf7a8 100644 --- a/tests/integration/repo_test.go +++ b/tests/integration/repo_test.go @@ -70,7 +70,7 @@ func testViewRepo(t *testing.T) { resp := session.MakeRequest(t, req, http.StatusOK) htmlDoc := NewHTMLParser(t, resp.Body) - files := htmlDoc.doc.Find("#repo-files-table > TBODY > TR") + files := htmlDoc.doc.Find("#repo-files-table > tbody > tr:not(.commit-list)") type file struct { fileName string @@ -1039,7 +1039,7 @@ func TestRepoFilesList(t *testing.T) { resp := MakeRequest(t, req, http.StatusOK) htmlDoc := NewHTMLParser(t, resp.Body) - filesList := htmlDoc.Find("#repo-files-table tbody tr").Map(func(_ int, s *goquery.Selection) string { + filesList := htmlDoc.Find("#repo-files-table tbody tr:not(.commit-list)").Map(func(_ int, s *goquery.Selection) string { return s.AttrOr("data-entryname", "") }) diff --git a/web_src/css/repo.css b/web_src/css/repo.css index 00f159f33b..0619f154af 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -233,12 +233,22 @@ td .commit-summary { } /* this is what limits the commit table width to a value that works on all viewport sizes */ -#repo-files-table th:first-of-type { +.repo-files-table-latest-commit-left { max-width: calc(calc(min(100vw, 1280px)) - 145px - calc(2 * var(--page-margin-x))); } -.repository.file.list #repo-files-table thead th { +.repo-files-table-latest-commit-cell { font-weight: var(--font-weight-normal); + background: var(--color-box-header); + text-align: inherit; + color: var(--color-text); + vertical-align: inherit; + border-left: none; + padding: 6px 5px 6px 10px; +} + +.latest-commit .commit-summary { + white-space: nowrap; } .repository.file.list #repo-files-table tbody .svg { @@ -246,6 +256,16 @@ td .commit-summary { margin-right: 5px; } +@media (min-width: 767.98px) { + #repo-files-table tbody > tr.commit-list td { + border-bottom: 1px solid var(--color-secondary); + } + + #repo-files-table tbody > tr:is(.entry, .has-parent):nth-child(2) td { + border-top: none; + } +} + .repository.file.list #repo-files-table tbody .svg.octicon-reply { margin-right: 10px; } @@ -262,7 +282,7 @@ td .commit-summary { color: var(--color-secondary-dark-7); } -.repository.file.list #repo-files-table td { +.repository.file.list #repo-files-table td:not(.repo-files-table-latest-commit-cell) { padding-top: 0; padding-bottom: 0; overflow: initial; @@ -328,7 +348,7 @@ td .commit-summary { padding-bottom: 8px; } -.repository.file.list #repo-files-table td a { +.repository.file.list #repo-files-table td a:not(.sha, .author-wrapper) { padding-top: 8px; padding-bottom: 8px; }
+ {{ctx.Locale.Tr "repo.files.caption"}} +
{{ctx.Locale.Tr "repo.files.filename"}}{{ctx.Locale.Tr "repo.files.last_commit_message"}}{{ctx.Locale.Tr "repo.files.last_commit_date"}}
+
{{template "repo/latest_commit" .}}
- -
{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}{{end}}{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}{{end}}
{{svg "octicon-reply" 16 "tw-mr-2"}}..