Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 09:54:24 +01:00

fix(ui): use right placeholder string in milestones search (#4628)

This PR fixes a wrong placeholder for the search for milestones. I tested it locally (see attachments, below).

Before: https://codeberg.org/attachments/ba845ce1-1f20-4131-a74d-7220986a4acf
After: https://codeberg.org/attachments/0c4e32ee-b1a8-4472-837d-daa2a2a50121

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4628
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Robert Wolff <mahlzahn@posteo.de>
Co-committed-by: Robert Wolff <mahlzahn@posteo.de>
This commit is contained in:
Robert Wolff 2024-07-25 03:33:44 +00:00 committed by 0ko
parent 56dbe3263f
commit 0a74c95b2a
5 changed files with 65 additions and 0 deletions

View file

@ -182,6 +182,7 @@ commit_kind = Search commits...
runner_kind = Search runners...
no_results = No matching results found.
issue_kind = Search issues...
milestone_kind = Search milestones...
pull_kind = Search pulls...
keyword_search_unavailable = Searching by keyword is currently not available. Please contact the site administrator.

View file

@ -11,6 +11,8 @@
{{end}}
{{if .PageIsPullList}}
{{template "shared/search/combo_fuzzy" dict "Value" .Keyword "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.pull_kind") "Tooltip" (ctx.Locale.Tr "explore.go_to")}}
{{else if .PageIsMilestones}}
{{template "shared/search/combo_fuzzy" dict "Value" .Keyword "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.milestone_kind") "Tooltip" (ctx.Locale.Tr "explore.go_to")}}
{{else}}
{{template "shared/search/combo_fuzzy" dict "Value" .Keyword "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.issue_kind") "Tooltip" (ctx.Locale.Tr "explore.go_to")}}
{{end}}

View file

@ -70,6 +70,18 @@ func TestNoLoginViewIssues(t *testing.T) {
MakeRequest(t, req, http.StatusOK)
}
func TestViewIssues(t *testing.T) {
defer tests.PrepareTestEnv(t)()
req := NewRequest(t, "GET", "/user2/repo1/issues")
resp := MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
search := htmlDoc.doc.Find(".list-header-search > .search > .input > input")
placeholder, _ := search.Attr("placeholder")
assert.Equal(t, "Search issues...", placeholder)
}
func TestViewIssuesSortByType(t *testing.T) {
defer tests.PrepareTestEnv(t)()

View file

@ -0,0 +1,25 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package integration
import (
"net/http"
"testing"
"code.gitea.io/gitea/tests"
"github.com/stretchr/testify/assert"
)
func TestViewMilestones(t *testing.T) {
defer tests.PrepareTestEnv(t)()
req := NewRequest(t, "GET", "/user2/repo1/milestones")
resp := MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
search := htmlDoc.doc.Find(".list-header-search > .search > .input > input")
placeholder, _ := search.Attr("placeholder")
assert.Equal(t, "Search milestones...", placeholder)
}

View file

@ -0,0 +1,25 @@
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package integration
import (
"net/http"
"testing"
"code.gitea.io/gitea/tests"
"github.com/stretchr/testify/assert"
)
func TestViewPulls(t *testing.T) {
defer tests.PrepareTestEnv(t)()
req := NewRequest(t, "GET", "/user2/repo1/pulls")
resp := MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
search := htmlDoc.doc.Find(".list-header-search > .search > .input > input")
placeholder, _ := search.Attr("placeholder")
assert.Equal(t, "Search pulls...", placeholder)
}