fix(ui): move file rename notice to before pagination (#8818)

Followup to https://codeberg.org/forgejo/forgejo/pulls/1442

Move the rename notice to a more suitable place.

Co-authored-by: Gusted <postmaster@gusted.xyz>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8818
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
0ko 2025-08-10 21:35:34 +02:00 committed by Gusted
commit 04e04b7073
12 changed files with 28 additions and 7 deletions

View file

@ -13,11 +13,6 @@
</div> </div>
</div> </div>
{{template "repo/commits_table" .}} {{template "repo/commits_table" .}}
{{if .OldFilename}}
<div class="ui bottom attached header">
<span>{{ctx.Locale.Tr "repo.commits.renamed_from" .OldFilename}} (<a href="{{.OldFilenameHistory}}">{{ctx.Locale.Tr "repo.commits.browse_further"}}</a>)</span>
</div>
{{end}}
</div> </div>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}

View file

@ -37,4 +37,10 @@
{{template "repo/commits_list" .}} {{template "repo/commits_list" .}}
{{end}} {{end}}
{{if .OldFilename}}
<div class="ui bottom attached header">
<span>{{ctx.Locale.Tr "repo.commits.renamed_from" .OldFilename}} (<a href="{{.OldFilenameHistory}}">{{ctx.Locale.Tr "repo.commits.browse_further"}}</a>)</span>
</div>
{{end}}
{{template "base/paginate" .}} {{template "base/paginate" .}}

View file

@ -1,2 +1,2 @@
P pack-6dd3a6fe138f1d77e14c2e6b8e6c41e5ae242adf.pack P pack-1cc75cb726e1cc54d31c00c741912da8baa644a4.pack

View file

@ -1,4 +1,4 @@
# pack-refs with: peeled fully-peeled sorted # pack-refs with: peeled fully-peeled sorted
d8f53dfb33f6ccf4169c34970b5e747511c18beb refs/heads/cake-recipe d8f53dfb33f6ccf4169c34970b5e747511c18beb refs/heads/cake-recipe
80b83c5c8220c3aa3906e081f202a2a7563ec879 refs/heads/master f3e315de30a90851c5b27f824a3c4efc3caa9941 refs/heads/master
d8f53dfb33f6ccf4169c34970b5e747511c18beb refs/tags/v1.0 d8f53dfb33f6ccf4169c34970b5e747511c18beb refs/tags/v1.0

View file

@ -587,6 +587,26 @@ func TestRenamedFileHistory(t *testing.T) {
assert.Equal(t, "/user2/repo59/commits/commit/80b83c5c8220c3aa3906e081f202a2a7563ec879/licnse", oldFileHistoryLink) assert.Equal(t, "/user2/repo59/commits/commit/80b83c5c8220c3aa3906e081f202a2a7563ec879/licnse", oldFileHistoryLink)
}) })
t.Run("Renamed file, pagination", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
defer test.MockVariableValue(&setting.Git.CommitsRangeSize, 1)() // Limit commits displayed on the page to one
resp := MakeRequest(t, NewRequest(t, "GET", "/user2/repo59/commits/branch/master/license"), http.StatusOK)
page1 := NewHTMLParser(t, resp.Body)
resp = MakeRequest(t, NewRequest(t, "GET", "/user2/repo59/commits/branch/master/license?page=2"), http.StatusOK)
page2 := NewHTMLParser(t, resp.Body)
// Browse further is only shown on 2nd page
browseFurtherSel := ".ui.bottom.attached.header a[href='/user2/repo59/commits/commit/80b83c5c8220c3aa3906e081f202a2a7563ec879/licnse']"
page1.AssertElement(t, browseFurtherSel, false)
page2.AssertElement(t, browseFurtherSel, true)
// Pagination goes after Browser further
afterBrowseFurther := page2.Find(browseFurtherSel).Parent().Parent().NextAll()
assert.Equal(t, 1, afterBrowseFurther.Find(".pagination.menu").Length())
})
t.Run("Non renamed file", func(t *testing.T) { t.Run("Non renamed file", func(t *testing.T) {
req := NewRequest(t, "GET", "/user2/repo59/commits/branch/master/README.md") req := NewRequest(t, "GET", "/user2/repo59/commits/branch/master/README.md")
resp := MakeRequest(t, req, http.StatusOK) resp := MakeRequest(t, req, http.StatusOK)