Fix localization of release/tag counters on releases page
This commit is contained in:
parent
95ccbb5995
commit
83e6b0c0c6
|
@ -1231,22 +1231,22 @@ clear_ref = `Clear current reference`
|
|||
filter_branch_and_tag = Filter branch or tag
|
||||
find_tag = Find tag
|
||||
branches = Branches
|
||||
tag = Tag
|
||||
tags = Tags
|
||||
issues = Issues
|
||||
pulls = Pull requests
|
||||
project_board = Projects
|
||||
packages = Packages
|
||||
actions = Actions
|
||||
release = Release
|
||||
releases = Releases
|
||||
labels = Labels
|
||||
milestones = Milestones
|
||||
org_labels_desc = Organization level labels that can be used with <strong>all repositories</strong> under this organization
|
||||
org_labels_desc_manage = manage
|
||||
|
||||
milestones = Milestones
|
||||
commits = Commits
|
||||
commit = Commit
|
||||
release = Release
|
||||
releases = Releases
|
||||
tag = Tag
|
||||
|
||||
n_commit_one=%s commit
|
||||
n_commit_few=%s commits
|
||||
|
@ -1254,6 +1254,8 @@ n_branch_one=%s branch
|
|||
n_branch_few=%s branches
|
||||
n_tag_one=%s tag
|
||||
n_tag_few=%s tags
|
||||
n_release_one = %s release
|
||||
n_release_few = %s releases
|
||||
|
||||
released_this = released this
|
||||
file.title = %s at %s
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<div class="tw-flex">
|
||||
<div class="tw-flex-1 tw-flex tw-items-center">
|
||||
<h2 class="ui compact small menu small-menu-items">
|
||||
<a class="{{if and .PageIsReleaseList (not .PageIsSingleTag)}}active {{end}}item" href="{{.RepoLink}}/releases">{{ctx.Locale.PrettyNumber .NumReleases}} {{ctx.Locale.TrN .NumReleases "repo.release" "repo.releases"}}</a>
|
||||
<a class="{{if and .PageIsReleaseList (not .PageIsSingleTag)}}active {{end}}item" href="{{.RepoLink}}/releases">{{ctx.Locale.TrN .NumReleases "repo.n_release_one" "repo.n_release_few" (ctx.Locale.PrettyNumber .NumReleases)}}</a>
|
||||
{{if $canReadCode}}
|
||||
<a class="{{if or .PageIsTagList .PageIsSingleTag}}active {{end}}item" href="{{.RepoLink}}/tags">{{ctx.Locale.PrettyNumber .NumTags}} {{ctx.Locale.TrN .NumTags "repo.tag" "repo.tags"}}</a>
|
||||
<a class="{{if or .PageIsTagList .PageIsSingleTag}}active {{end}}item" href="{{.RepoLink}}/tags">{{ctx.Locale.TrN .NumTags "repo.n_tag_one" "repo.n_tag_few" (ctx.Locale.PrettyNumber .NumTags)}}</a>
|
||||
{{end}}
|
||||
</h2>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Copyright 2024 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package integration
|
||||
|
@ -6,6 +7,7 @@ package integration
|
|||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -66,6 +68,13 @@ func checkLatestReleaseAndCount(t *testing.T, session *TestSession, repoURL, ver
|
|||
titleText := htmlDoc.doc.Find("#release-list > li .detail h4 a").First().Text()
|
||||
assert.EqualValues(t, version, titleText)
|
||||
|
||||
// Check release count in the counter on the Release/Tag switch, as well as that the tab is highlighted
|
||||
if count < 10 { // Only check values less than 10, should be enough attempts before this test cracks
|
||||
// 10 is the pagination limit, but the counter can have more than that
|
||||
releaseTab := htmlDoc.doc.Find(".repository.releases .ui.compact.menu a.active.item[href$='/releases']")
|
||||
assert.Contains(t, releaseTab.Text(), strconv.Itoa(count)+" release") // Could be "1 release" or "4 releases"
|
||||
}
|
||||
|
||||
releaseList := htmlDoc.doc.Find("#release-list > li")
|
||||
assert.EqualValues(t, count, releaseList.Length())
|
||||
}
|
||||
|
@ -77,7 +86,7 @@ func TestViewReleases(t *testing.T) {
|
|||
req := NewRequest(t, "GET", "/user2/repo1/releases")
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
// if CI is to slow this test fail, so lets wait a bit
|
||||
// if CI is too slow this test fail, so lets wait a bit
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,13 @@ func TestTagViewWithoutRelease(t *testing.T) {
|
|||
req := NewRequestf(t, "GET", "/%s/releases/tag/no-release", repo.FullName())
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
// Test that the tags sub-menu is active
|
||||
// Test that the tags sub-menu is active and has a counter
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
htmlDoc.AssertElement(t, ".small-menu-items .active.item[href*='/tags']", true)
|
||||
tagsTab := htmlDoc.Find(".small-menu-items .active.item[href$='/tags']")
|
||||
assert.Contains(t, tagsTab.Text(), "4 tags")
|
||||
|
||||
// Test that the release sub-menu isn't active
|
||||
releaseLink := htmlDoc.Find(".small-menu-items .item[href*='/releases']")
|
||||
releaseLink := htmlDoc.Find(".small-menu-items .item[href$='/releases']")
|
||||
assert.False(t, releaseLink.HasClass("active"))
|
||||
|
||||
// Test that the title is displayed
|
||||
|
|
Loading…
Reference in New Issue