Skip to content

Commit e3524c6

Browse files
authored
1 parent e71b692 commit e3524c6

File tree

15 files changed

+200
-77
lines changed

15 files changed

+200
-77
lines changed

options/locale/locale_en-US.ini

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,19 @@ confirm_delete_selected = Confirm to delete all selected items?
142142
name = Name
143143
value = Value
144144

145+
filter = Filter
146+
filter.clear = Clear Filter
147+
filter.is_archived = Archived
148+
filter.not_archived = Not Archived
149+
filter.is_fork = Forked
150+
filter.not_fork = Not Forked
151+
filter.is_mirror = Mirrored
152+
filter.not_mirror = Not Mirrored
153+
filter.is_template = Template
154+
filter.not_template = Not Template
155+
filter.public = Public
156+
filter.private = Private
157+
145158
[aria]
146159
navbar = Navigation Bar
147160
footer = Footer

routers/web/explore/repo.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,21 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
109109
language := ctx.FormTrim("language")
110110
ctx.Data["Language"] = language
111111

112+
archived := ctx.FormOptionalBool("archived")
113+
ctx.Data["IsArchived"] = archived
114+
115+
fork := ctx.FormOptionalBool("fork")
116+
ctx.Data["IsFork"] = fork
117+
118+
mirror := ctx.FormOptionalBool("mirror")
119+
ctx.Data["IsMirror"] = mirror
120+
121+
template := ctx.FormOptionalBool("template")
122+
ctx.Data["IsTemplate"] = template
123+
124+
private := ctx.FormOptionalBool("private")
125+
ctx.Data["IsPrivate"] = private
126+
112127
repos, count, err = repo_model.SearchRepository(ctx, &repo_model.SearchRepoOptions{
113128
ListOptions: db.ListOptions{
114129
Page: page,
@@ -125,6 +140,11 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
125140
Language: language,
126141
IncludeDescription: setting.UI.SearchRepoDescription,
127142
OnlyShowRelevant: opts.OnlyShowRelevant,
143+
Archived: archived,
144+
Fork: fork,
145+
Mirror: mirror,
146+
Template: template,
147+
IsPrivate: private,
128148
})
129149
if err != nil {
130150
ctx.ServerError("SearchRepository", err)

routers/web/org/home.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@ func Home(ctx *context.Context) {
8585
page = 1
8686
}
8787

88+
archived := ctx.FormOptionalBool("archived")
89+
ctx.Data["IsArchived"] = archived
90+
91+
fork := ctx.FormOptionalBool("fork")
92+
ctx.Data["IsFork"] = fork
93+
94+
mirror := ctx.FormOptionalBool("mirror")
95+
ctx.Data["IsMirror"] = mirror
96+
97+
template := ctx.FormOptionalBool("template")
98+
ctx.Data["IsTemplate"] = template
99+
100+
private := ctx.FormOptionalBool("private")
101+
ctx.Data["IsPrivate"] = private
102+
88103
var (
89104
repos []*repo_model.Repository
90105
count int64
@@ -102,6 +117,11 @@ func Home(ctx *context.Context) {
102117
Actor: ctx.Doer,
103118
Language: language,
104119
IncludeDescription: setting.UI.SearchRepoDescription,
120+
Archived: archived,
121+
Fork: fork,
122+
Mirror: mirror,
123+
Template: template,
124+
IsPrivate: private,
105125
})
106126
if err != nil {
107127
ctx.ServerError("SearchRepository", err)

routers/web/user/notification.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,21 @@ func NotificationWatching(ctx *context.Context) {
389389
orderBy = db.SearchOrderByRecentUpdated
390390
}
391391

392+
archived := ctx.FormOptionalBool("archived")
393+
ctx.Data["IsArchived"] = archived
394+
395+
fork := ctx.FormOptionalBool("fork")
396+
ctx.Data["IsFork"] = fork
397+
398+
mirror := ctx.FormOptionalBool("mirror")
399+
ctx.Data["IsMirror"] = mirror
400+
401+
template := ctx.FormOptionalBool("template")
402+
ctx.Data["IsTemplate"] = template
403+
404+
private := ctx.FormOptionalBool("private")
405+
ctx.Data["IsPrivate"] = private
406+
392407
repos, count, err := repo_model.SearchRepository(ctx, &repo_model.SearchRepoOptions{
393408
ListOptions: db.ListOptions{
394409
PageSize: setting.UI.User.RepoPagingNum,
@@ -402,6 +417,11 @@ func NotificationWatching(ctx *context.Context) {
402417
Collaborate: optional.Some(false),
403418
TopicOnly: ctx.FormBool("topic"),
404419
IncludeDescription: setting.UI.SearchRepoDescription,
420+
Archived: archived,
421+
Fork: fork,
422+
Mirror: mirror,
423+
Template: template,
424+
IsPrivate: private,
405425
})
406426
if err != nil {
407427
ctx.ServerError("SearchRepository", err)

routers/web/user/profile.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,21 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
162162
}
163163
ctx.Data["NumFollowing"] = numFollowing
164164

165+
archived := ctx.FormOptionalBool("archived")
166+
ctx.Data["IsArchived"] = archived
167+
168+
fork := ctx.FormOptionalBool("fork")
169+
ctx.Data["IsFork"] = fork
170+
171+
mirror := ctx.FormOptionalBool("mirror")
172+
ctx.Data["IsMirror"] = mirror
173+
174+
template := ctx.FormOptionalBool("template")
175+
ctx.Data["IsTemplate"] = template
176+
177+
private := ctx.FormOptionalBool("private")
178+
ctx.Data["IsPrivate"] = private
179+
165180
switch tab {
166181
case "followers":
167182
ctx.Data["Cards"] = followers
@@ -208,6 +223,11 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
208223
TopicOnly: topicOnly,
209224
Language: language,
210225
IncludeDescription: setting.UI.SearchRepoDescription,
226+
Archived: archived,
227+
Fork: fork,
228+
Mirror: mirror,
229+
Template: template,
230+
IsPrivate: private,
211231
})
212232
if err != nil {
213233
ctx.ServerError("SearchRepository", err)
@@ -230,6 +250,11 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
230250
TopicOnly: topicOnly,
231251
Language: language,
232252
IncludeDescription: setting.UI.SearchRepoDescription,
253+
Archived: archived,
254+
Fork: fork,
255+
Mirror: mirror,
256+
Template: template,
257+
IsPrivate: private,
233258
})
234259
if err != nil {
235260
ctx.ServerError("SearchRepository", err)
@@ -275,6 +300,11 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
275300
TopicOnly: topicOnly,
276301
Language: language,
277302
IncludeDescription: setting.UI.SearchRepoDescription,
303+
Archived: archived,
304+
Fork: fork,
305+
Mirror: mirror,
306+
Template: template,
307+
IsPrivate: private,
278308
})
279309
if err != nil {
280310
ctx.ServerError("SearchRepository", err)

templates/admin/repo/list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</div>
88
</h4>
99
<div class="ui attached segment">
10-
{{template "admin/repo/search" .}}
10+
{{template "shared/repo_search" .}}
1111
</div>
1212
<div class="ui attached table segment">
1313
<table class="ui very basic striped table unstackable">

templates/admin/repo/search.tmpl

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

templates/explore/repo_search.tmpl

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

templates/explore/repos.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 repositories">
33
{{template "explore/navbar" .}}
44
<div class="ui container">
5-
{{template "explore/repo_search" .}}
5+
{{template "shared/repo_search" .}}
66
{{template "explore/repo_list" .}}
77
{{template "base/paginate" .}}
88
</div>

templates/org/home.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{{if .ProfileReadme}}
99
<div id="readme_profile" class="markup">{{.ProfileReadme}}</div>
1010
{{end}}
11-
{{template "explore/repo_search" .}}
11+
{{template "shared/repo_search" .}}
1212
{{template "explore/repo_list" .}}
1313
{{template "base/paginate" .}}
1414
</div>

templates/shared/repo_search.tmpl

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<div class="ui secondary filter menu">
2+
<form id="repo-search-form" class="ui form ignore-dirty tw-flex-1 tw-flex tw-flex-row tw-gap-x-2">
3+
{{if .Language}}<input hidden name="language" value="{{.Language}}">{{end}}
4+
<div class="ui fluid action input tw-flex-1">
5+
{{template "shared/searchinput" dict "Value" .Keyword}}
6+
{{if .PageIsExploreRepositories}}
7+
<input type="hidden" name="only_show_relevant" value="{{.OnlyShowRelevant}}">
8+
{{else if .TabName}}
9+
<input type="hidden" name="tab" value="{{.TabName}}">
10+
{{end}}
11+
<button class="ui primary button">{{ctx.Locale.Tr "explore.search"}}</button>
12+
</div>
13+
<!-- Filter -->
14+
<div class="ui dropdown type jump item tw-mr-0">
15+
<span class="text">
16+
{{ctx.Locale.Tr "filter"}}
17+
</span>
18+
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
19+
<div class="menu">
20+
<label class="item"><input type="radio" name="clear-filter"> {{ctx.Locale.Tr "filter.clear"}}</label>
21+
<div class="divider"></div>
22+
<label class="item"><input type="radio" name="archived" {{if .IsArchived.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.is_archived"}}</label>
23+
<label class="item"><input type="radio" name="archived" {{if (not (.IsArchived.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.not_archived"}}</label>
24+
<div class="divider"></div>
25+
<label class="item"><input type="radio" name="fork" {{if .IsFork.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.is_fork"}}</label>
26+
<label class="item"><input type="radio" name="fork" {{if (not (.IsFork.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.not_fork"}}</label>
27+
<div class="divider"></div>
28+
<label class="item"><input type="radio" name="mirror" {{if .IsMirror.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.is_mirror"}}</label>
29+
<label class="item"><input type="radio" name="mirror" {{if (not (.IsMirror.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.not_mirror"}}</label>
30+
<div class="divider"></div>
31+
<label class="item"><input type="radio" name="template" {{if .IsTemplate.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.is_template"}}</label>
32+
<label class="item"><input type="radio" name="template" {{if (not (.IsTemplate.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.not_template"}}</label>
33+
<div class="divider"></div>
34+
<label class="item"><input type="radio" name="private" {{if .IsPrivate.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.private"}}</label>
35+
<label class="item"><input type="radio" name="private" {{if (not (.IsPrivate.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.public"}}</label>
36+
</div>
37+
</div>
38+
<!-- Sort -->
39+
<div class="ui dropdown type jump item gt-mr-0">
40+
<span class="text">
41+
{{ctx.Locale.Tr "repo.issues.filter_sort"}}
42+
</span>
43+
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
44+
<div class="menu">
45+
<label class="{{if eq .SortType "newest"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "newest"}}checked{{end}} value="newest"> {{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</label>
46+
<label class="{{if eq .SortType "oldest"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "oldest"}}checked{{end}} value="oldest"> {{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</label>
47+
<label class="{{if eq .SortType "alphabetically"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "alphabetically"}}checked{{end}} value="alphabetically"> {{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</label>
48+
<label class="{{if eq .SortType "reversealphabetically"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "reversealphabetically"}}checked{{end}} value="reversealphabetically"> {{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</label>
49+
<label class="{{if eq .SortType "recentupdate"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "recentupdate"}}checked{{end}} value="recentupdate"> {{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</label>
50+
<label class="{{if eq .SortType "leastupdate"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "leastupdate"}}checked{{end}} value="leastupdate"> {{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</label>
51+
{{if not .DisableStars}}
52+
<label class="{{if eq .SortType "moststars"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "moststars"}}checked{{end}} value="moststars"> {{ctx.Locale.Tr "repo.issues.filter_sort.moststars"}}</label>
53+
<label class="{{if eq .SortType "feweststars"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "feweststars"}}checked{{end}} value="feweststars"> {{ctx.Locale.Tr "repo.issues.filter_sort.feweststars"}}</label>
54+
{{end}}
55+
<label class="{{if eq .SortType "mostforks"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "mostforks"}}checked{{end}} value="mostforks"> {{ctx.Locale.Tr "repo.issues.filter_sort.mostforks"}}</label>
56+
<label class="{{if eq .SortType "fewestforks"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "fewestforks"}}checked{{end}} value="fewestforks"> {{ctx.Locale.Tr "repo.issues.filter_sort.fewestforks"}}</label>
57+
<label class="{{if eq .SortType "size"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "size"}}checked{{end}} value="size"> {{ctx.Locale.Tr "repo.issues.label.filter_sort.by_size"}}</label>
58+
<label class="{{if eq .SortType "reversesize"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "reversesize"}}checked{{end}} value="reversesize"> {{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_by_size"}}</label>
59+
</div>
60+
</div>
61+
</form>
62+
</div>
63+
{{if and .PageIsExploreRepositories .OnlyShowRelevant}}
64+
<div class="ui message explore-relevancy-note">
65+
<span data-tooltip-content="{{ctx.Locale.Tr "explore.relevant_repositories_tooltip"}}">{{ctx.Locale.Tr "explore.relevant_repositories" (printf "?only_show_relevant=0&sort=%s&q=%s&language=%s" $.SortType (QueryEscape $.Keyword) (QueryEscape $.Language))}}</span>
66+
</div>
67+
{{end}}

templates/user/notification/notification_subscriptions.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
{{template "shared/issuelist" dict "." . "listType" "dashboard"}}
7070
{{end}}
7171
{{else}}
72-
{{template "explore/repo_search" .}}
72+
{{template "shared/repo_search" .}}
7373
{{template "explore/repo_list" .}}
7474
{{template "base/paginate" .}}
7575
{{end}}

templates/user/profile.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
{{template "user/dashboard/feeds" .}}
2121
{{else if eq .TabName "stars"}}
2222
<div class="stars">
23-
{{template "explore/repo_search" .}}
23+
{{template "shared/repo_search" .}}
2424
{{template "explore/repo_list" .}}
2525
{{template "base/paginate" .}}
2626
</div>
@@ -31,7 +31,7 @@
3131
{{else if eq .TabName "overview"}}
3232
<div id="readme_profile" class="markup">{{.ProfileReadme}}</div>
3333
{{else}}
34-
{{template "explore/repo_search" .}}
34+
{{template "shared/repo_search" .}}
3535
{{template "explore/repo_list" .}}
3636
{{template "base/paginate" .}}
3737
{{end}}

0 commit comments

Comments
 (0)