Skip to content

Commit d9b35e3

Browse files
committed
finish
1 parent 74e70b7 commit d9b35e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+174
-208
lines changed

options/locale/locale_en-US.ini

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,27 @@ filter.private = Private
157157

158158
[search]
159159
search = Search
160-
search_kind = Search %s...
161160
type_tooltip = Search type
162161
fuzzy = Fuzzy
163162
fuzzy_tooltip = Include results that also match the search term closely
164163
match = Match
165164
match_tooltip = Include only results that match the exact search term
166-
no_results = No %s matching your search term found.
167-
unavailable = %s is currently not available. Please contact your site administrator.
168-
kind.code = Code search
169-
kind.keyword = Searching by keyword
165+
repo_kind = Search repos...
166+
repo_no_results = No matching repositories found.
167+
user_kind = Search users...
168+
user_no_results = No matching users found.
169+
org_kind = Search orgs...
170+
org_no_results = No matching organizations found.
171+
team_kind = Search teams...
172+
code_kind = Search code...
173+
code_no_results = No matching source code found.
174+
code_search_unavailable = Code search is currently not available. Please contact your site administrator.
175+
package_kind = Search packages...
176+
project_kind = Search projects...
177+
branch_kind = Search branches...
178+
commit_kind = Search commits...
179+
runner_kind = Search runners...
180+
keyword_search_unavailable = Searching by keyword is currently not available. Please contact your site administrator.
170181

171182
[aria]
172183
navbar = Navigation Bar

routers/web/explore/code.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@ func Code(ctx *context.Context) {
3434
language := ctx.FormTrim("l")
3535
keyword := ctx.FormTrim("q")
3636

37-
queryType := ctx.FormTrim("t")
38-
isFuzzy := queryType != "match"
37+
isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
3938

4039
ctx.Data["Keyword"] = keyword
4140
ctx.Data["Language"] = language
42-
ctx.Data["queryType"] = queryType
41+
ctx.Data["IsFuzzy"] = isFuzzy
4342
ctx.Data["PageIsViewCode"] = true
4443

4544
if keyword == "" {

routers/web/repo/search.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ func Search(ctx *context.Context) {
2424
language := ctx.FormTrim("l")
2525
keyword := ctx.FormTrim("q")
2626

27-
queryType := ctx.FormTrim("t")
28-
isFuzzy := queryType != "match"
27+
isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
2928

3029
ctx.Data["Keyword"] = keyword
3130
ctx.Data["Language"] = language
32-
ctx.Data["queryType"] = queryType
31+
ctx.Data["IsFuzzy"] = isFuzzy
3332
ctx.Data["PageIsViewCode"] = true
3433

3534
if keyword == "" {

routers/web/user/code.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ func CodeSearch(ctx *context.Context) {
3535
ctx.Data["IsPackageEnabled"] = setting.Packages.Enabled
3636
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
3737
ctx.Data["Title"] = ctx.Tr("explore.code")
38+
ctx.Data["PageIsExploreCode"] = true
3839

3940
language := ctx.FormTrim("l")
4041
keyword := ctx.FormTrim("q")
4142

42-
queryType := ctx.FormTrim("t")
43-
isFuzzy := queryType != "match"
43+
isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
4444

4545
ctx.Data["Keyword"] = keyword
4646
ctx.Data["Language"] = language
47-
ctx.Data["queryType"] = queryType
47+
ctx.Data["IsFuzzy"] = isFuzzy
4848
ctx.Data["IsCodePage"] = true
4949

5050
if keyword == "" {

services/context/pagination.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ func (p *Pagination) SetDefaultParams(ctx *Context) {
5353
p.AddParam(ctx, "sort", "SortType")
5454
p.AddParam(ctx, "q", "Keyword")
5555
// do not add any more uncommon params here!
56-
p.AddParam(ctx, "t", "queryType")
56+
p.AddParam(ctx, "fuzzy", "IsFuzzy")
5757
}

templates/admin/base/search.tmpl

Lines changed: 0 additions & 23 deletions
This file was deleted.

templates/admin/emails/list.tmpl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
<div class="ui attached segment">
77
<div class="ui secondary filter menu gt-ac gt-mx-0">
88
<form class="ui form ignore-dirty gt-f1">
9-
<div class="ui fluid action input">
10-
{{template "shared/search/input" dict "Value" .Keyword}}
11-
{{template "shared/search/button"}}
12-
</div>
9+
{{template "shared/search/combo" dict "Value" .Keyword}}
1310
</form>
1411
<!-- Sort -->
1512
<div class="ui dropdown type jump item gt-mr-0">

templates/admin/org/list.tmpl

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,26 @@
77
</div>
88
</h4>
99
<div class="ui attached segment">
10-
{{template "admin/base/search" .}}
10+
<div class="ui secondary filter menu gt-ac gt-mx-0">
11+
<form class="ui form ignore-dirty gt-f1">
12+
{{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.org_kind")}}
13+
</form>
14+
<!-- Sort -->
15+
<div class="ui dropdown type jump item gt-mr-0">
16+
<span class="text">
17+
{{ctx.Locale.Tr "repo.issues.filter_sort"}}
18+
</span>
19+
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
20+
<div class="menu">
21+
<a class="{{if or (eq .SortType "oldest") (not .SortType)}}active {{end}}item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</a>
22+
<a class="{{if eq .SortType "newest"}}active {{end}}item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</a>
23+
<a class="{{if eq .SortType "alphabetically"}}active {{end}}item" href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a>
24+
<a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
25+
<a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</a>
26+
<a class="{{if eq .SortType "leastupdate"}}active {{end}}item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</a>
27+
</div>
28+
</div>
29+
</div>
1130
</div>
1231
<div class="ui attached table segment">
1332
<table class="ui very basic striped table unstackable">

templates/admin/packages/list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<form class="ui form ignore-dirty">
1616
<div class="ui fluid action input">
1717
{{template "shared/search/input" dict "Value" .Query}}
18-
<select class="ui dropdown" name="type">
18+
<select class="ui small dropdown" name="type">
1919
<option value="">{{ctx.Locale.Tr "packages.filter.type"}}</option>
2020
<option value="all">{{ctx.Locale.Tr "packages.filter.type.all"}}</option>
2121
{{range $type := .AvailableTypes}}

templates/admin/user/list.tmpl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@
5252
</div>
5353
</div>
5454

55-
<!-- Search Text -->
56-
<div class="ui fluid action input">
57-
{{template "shared/search/input" dict "Value" .Keyword}}
58-
{{template "shared/search/button"}}
59-
</div>
55+
{{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.user_kind")}}
6056
</form>
6157
</div>
6258
<div class="ui attached table segment">

templates/code/searchcombo.tmpl

Lines changed: 0 additions & 14 deletions
This file was deleted.

templates/code/searchform.tmpl

Lines changed: 0 additions & 14 deletions
This file was deleted.

templates/code/searchresults.tmpl

Lines changed: 0 additions & 30 deletions
This file was deleted.

templates/explore/code.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content explore users">
33
{{template "explore/navbar" .}}
44
<div class="ui container">
5-
{{template "code/searchcombo" .}}
5+
{{template "shared/search/code/search" .}}
66
</div>
77
</div>
88
{{template "base/footer" .}}

templates/explore/repo_list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
</div>
5959
{{else}}
6060
<div>
61-
{{ctx.Locale.Tr "search.no_results" (ctx.Locale.Tr "explore.repos")}}
61+
{{ctx.Locale.Tr "search.repo_no_results"}}
6262
</div>
6363
{{end}}
6464
</div>

templates/explore/search.tmpl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<div class="ui secondary filter menu gt-ac gt-mx-0">
22
<form class="ui form ignore-dirty gt-f1">
3-
<div class="ui fluid action input">
4-
{{template "shared/search/input" dict "Value" .Keyword}}
5-
{{template "shared/search/button"}}
6-
</div>
3+
{{if .PageIsExploreUsers}}
4+
{{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.user_kind")}}
5+
{{else}}
6+
{{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.org_kind")}}
7+
{{end}}
78
</form>
89
<!-- Sort -->
910
<div class="ui dropdown type jump item gt-mr-0">

templates/explore/user_list.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
</div>
2727
</div>
2828
{{else}}
29-
<div class="flex-item">{{ctx.Locale.Tr "search.no_results" (ctx.Locale.Tr "explore.users")}}</div>
29+
<div class="flex-item">
30+
{{if .PageIsExploreUsers}}
31+
{{ctx.Locale.Tr "search.user_no_results"}}
32+
{{else}}
33+
{{ctx.Locale.Tr "search.org_no_results"}}
34+
{{end}}
35+
</div>
3036
{{end}}
3137
</div>

templates/explore/users.tmpl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
{{template "explore/navbar" .}}
44
<div class="ui container">
55
{{template "explore/search" .}}
6-
76
{{template "explore/user_list" .}}
8-
97
{{template "base/paginate" .}}
108
</div>
119
</div>

templates/org/team/members.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<input type="hidden" name="uid" value="{{.SignedUser.ID}}">
1515
<div id="search-user-box" class="ui search gt-mr-3"{{if .IsEmailInviteEnabled}} data-allow-email="true" data-allow-email-description="{{ctx.Locale.Tr "org.teams.invite_team_member" $.Team.Name}}"{{end}}>
1616
<div class="ui input">
17-
<input class="prompt" name="uname" placeholder="{{ctx.Locale.Tr "search.search_kind" (ctx.Locale.Tr "explore.users")}}" autocomplete="off" required>
17+
<input class="prompt" name="uname" placeholder="{{ctx.Locale.Tr "search.user_kind"}}" autocomplete="off" required>
1818
</div>
1919
</div>
2020
<button class="ui primary button">{{ctx.Locale.Tr "org.teams.add_team_member"}}</button>

templates/org/team/repositories.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{{.CsrfTokenHtml}}
1515
<div id="search-repo-box" data-uid="{{.Org.ID}}" class="ui search">
1616
<div class="ui input">
17-
<input class="prompt" name="repo_name" placeholder="{{ctx.Locale.Tr "search.search_kind" (ctx.Locale.Tr "repository")}}" autocomplete="off" required>
17+
<input class="prompt" name="repo_name" placeholder="{{ctx.Locale.Tr "search.repo_kind"}}" autocomplete="off" required>
1818
</div>
1919
</div>
2020
<button class="ui primary button gt-ml-3">{{ctx.Locale.Tr "add"}}</button>

templates/package/shared/list.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
{{if .HasPackages}}
33
<form class="ui form ignore-dirty">
44
<div class="ui fluid action input">
5-
{{template "shared/search/input" dict "Value" .Query}}
6-
<select class="ui dropdown" name="type">
5+
{{template "shared/search/input" dict "Value" .Query (ctx.Locale.Tr "search.package_kind")}}
6+
<select class="ui small dropdown" name="type">
77
<option value="">{{ctx.Locale.Tr "packages.filter.type"}}</option>
88
<option value="all">{{ctx.Locale.Tr "packages.filter.type.all"}}</option>
99
{{range $type := .AvailableTypes}}

templates/package/shared/versionlist.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<p><a href="{{.PackageDescriptor.PackageWebLink}}">{{.PackageDescriptor.Package.Name}}</a> / <strong>{{ctx.Locale.Tr "packages.versions"}}</strong></p>
22
<form class="ui form ignore-dirty">
33
<div class="ui fluid action input">
4-
{{template "shared/search/input" dict "Value" .Query}}
5-
<select class="ui dropdown" name="sort">
4+
{{template "shared/search/input" dict "Value" .Query "Placeholder" (ctx.Locale.Tr "search.package_kind")}}
5+
<select class="ui small dropdown" name="sort">
66
<option value="version_asc"{{if eq .Sort "version_asc"}} selected="selected"{{end}}>{{ctx.Locale.Tr "filter.string.asc"}}</option>
77
<option value="version_desc"{{if eq .Sort "version_desc"}} selected="selected"{{end}}>{{ctx.Locale.Tr "filter.string.desc"}}</option>
88
<option value="created_asc"{{if eq .Sort "created_asc"}} selected="selected"{{end}}>{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</option>
99
<option value="created_desc"{{if or (eq .Sort "") (eq .Sort "created_desc")}} selected="selected"{{end}}>{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</option>
1010
</select>
1111
{{if eq .PackageDescriptor.Package.Type "container"}}
12-
<select class="ui dropdown" name="tagged">
12+
<select class="ui small dropdown" name="tagged">
1313
{{$isTagged := or (eq .Tagged "") (eq .Tagged "tagged")}}
1414
<option value="tagged"{{if $isTagged}} selected="selected"{{end}}>{{ctx.Locale.Tr "packages.filter.container.tagged"}}</option>
1515
<option value="untagged"{{if not $isTagged}} selected="selected"{{end}}>{{ctx.Locale.Tr "packages.filter.container.untagged"}}</option>

templates/projects/list.tmpl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@
2121
<div class="list-header">
2222
<!-- Search -->
2323
<form class="list-header-search ui form ignore-dirty">
24-
<div class="ui small search fluid action input">
25-
<input type="hidden" name="state" value="{{$.State}}">
26-
{{template "shared/search/input" dict "Value" .Keyword}}
27-
{{template "shared/search/button"}}
28-
</div>
24+
<input type="hidden" name="state" value="{{$.State}}">
25+
{{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.project_kind")}}
2926
</form>
3027
<!-- Sort -->
3128
<div class="list-header-sort ui small dropdown type jump item">

templates/repo/branch/list.tmpl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@
7575

7676
<div class="ui attached segment">
7777
<form class="ignore-dirty" method="get">
78-
<div class="ui fluid action input">
79-
{{template "shared/search/input" dict "Value" .Keyword}}
80-
{{template "shared/search/button"}}
81-
</div>
78+
{{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.branch_kind")}}
8279
</form>
8380
</div>
8481

templates/repo/commits_table.tmpl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,12 @@
2121
<div class="ui attached segment">
2222
<form class="ignore-dirty" action="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/search">
2323
<div class="ui fluid action input">
24-
{{template "shared/search/input" dict "Value" .Keyword}}
25-
<div class="ui small dropdown selection {{if .CodeIndexerUnavailable}} disabled{{end}}" data-tooltip-content="{{ctx.Locale.Tr "search.type_tooltip"}}">
26-
<input name="all" type="hidden" value="{{.All}}">{{svg "octicon-triangle-down" 14 "dropdown icon"}}
27-
<div class="text">{{if .All}}{{ctx.Locale.Tr "repo.commits.search_all"}}{{else}}{{ctx.Locale.Tr "repo.commits.search_branch"}}{{end}}</div>
28-
<div class="menu">
29-
<div class="item" data-value="">{{ctx.Locale.Tr "repo.commits.search_branch"}}</div>
30-
<div class="item" data-value="true">{{ctx.Locale.Tr "repo.commits.search_all"}}</div>
31-
</div>
32-
</div>
33-
{{template "shared/search/button" (ctx.Locale.Tr "repo.commits.search.tooltip")}}
24+
{{template "shared/search/input" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.commit_kind")}}
25+
<select class="ui small dropdown" name="all">
26+
<option value="false">{{ctx.Locale.Tr "repo.commits.search_branch"}}</option>
27+
<option {{if .All}} selected="selected"{{end}} value="true">{{ctx.Locale.Tr "repo.commits.search_all"}}</option>
28+
</select>
29+
{{template "shared/search/button" dict "Tooltip" (ctx.Locale.Tr "repo.commits.search.tooltip")}}
3430
</div>
3531
</form>
3632
</div>

0 commit comments

Comments
 (0)