-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: filter repositories by type
- Loading branch information
Showing
14 changed files
with
178 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<div class="ui secondary filter menu gt-ac gt-mx-0"> | ||
<form class="ui form ignore-dirty gt-f1"> | ||
<input type="hidden" name="sort" value="{{$.SortType}}"> | ||
<input type="hidden" name="language" value="{{$.Language}}"> | ||
<div class="ui fluid action input"> | ||
{{template "shared/searchinput" dict "Value" .Keyword}} | ||
{{if .PageIsExploreRepositories}} | ||
<input type="hidden" name="only_show_relevant" value="{{.OnlyShowRelevant}}"> | ||
{{else if .TabName}} | ||
<input type="hidden" name="tab" value="{{.TabName}}"> | ||
{{end}} | ||
<button class="ui primary button">{{ctx.Locale.Tr "explore.search"}}</button> | ||
</div> | ||
</form> | ||
{{$tabQuery := printf "tab=%s&" .TabName}} | ||
{{if not .TabName}}{{$tabQuery = ""}}{{end}} | ||
{{$languageQuery := printf "language=%s&" .Language}} | ||
{{if not .TabName}}{{$languageQuery = ""}}{{end}} | ||
{{$queryParams := printf "%s%sq=%s" $tabQuery $languageQuery .Keyword}} | ||
<!-- Filter --> | ||
{{$queryParamsWithSort := printf "%s&sort=%s" $queryParams .SortType}} | ||
<form class="ui form ignore-dirty" id="repo-search-form" data-query-params="{{$queryParamsWithSort}}"> | ||
<div class="ui dropdown type jump item gt-mr-0"> | ||
<span class="text"> | ||
{{ctx.Locale.Tr "repo.issues.filter"}} | ||
</span> | ||
{{svg "octicon-triangle-down" 14 "dropdown icon"}} | ||
<div class="menu"> | ||
<a class="item" href="{{printf "%s?%s" .Link $queryParamsWithSort}}">{{ctx.Locale.Tr "repo.issues.filter.reset"}}</a> | ||
<div class="divider"></div> | ||
<label class="item no-blur"><input type="radio" name="archived" {{if .IsArchived.IsTrue}}checked{{end}} value="1"> {{ctx.Locale.Tr "repo.issues.filter.is_archived"}}</label> | ||
<label class="item no-blur"><input type="radio" name="archived" {{if .IsArchived.IsFalse}}checked{{end}} value="0"> {{ctx.Locale.Tr "repo.issues.filter.not_archived"}}</label> | ||
<div class="divider"></div> | ||
<label class="item no-blur"><input type="radio" name="fork" {{if .IsFork.IsTrue}}checked{{end}} value="1"> {{ctx.Locale.Tr "repo.issues.filter.is_fork"}}</label> | ||
<label class="item no-blur"><input type="radio" name="fork" {{if .IsFork.IsFalse}}checked{{end}} value="0"> {{ctx.Locale.Tr "repo.issues.filter.not_fork"}}</label> | ||
<div class="divider"></div> | ||
<label class="item no-blur"><input type="radio" name="mirror" {{if .IsMirror.IsTrue}}checked{{end}} value="1"> {{ctx.Locale.Tr "repo.issues.filter.is_mirror"}}</label> | ||
<label class="item no-blur"><input type="radio" name="mirror" {{if .IsMirror.IsFalse}}checked{{end}} value="0"> {{ctx.Locale.Tr "repo.issues.filter.not_mirror"}}</label> | ||
<div class="divider"></div> | ||
<label class="item no-blur"><input type="radio" name="private" {{if .IsPrivate.IsFalse}}checked{{end}} value="0"> {{ctx.Locale.Tr "repo.issues.filter.public"}}</label> | ||
<label class="item no-blur"><input type="radio" name="private" {{if .IsPrivate.IsTrue}}checked{{end}} value="1"> {{ctx.Locale.Tr "repo.issues.filter.private"}}</label> | ||
</div> | ||
</div> | ||
</form> | ||
<!-- Sort --> | ||
<div class="ui dropdown type jump item gt-mr-0"> | ||
<span class="text"> | ||
{{ctx.Locale.Tr "repo.issues.filter_sort"}} | ||
</span> | ||
{{svg "octicon-triangle-down" 14 "dropdown icon"}} | ||
<div class="menu"> | ||
{{$href := printf "%s?%s" .Link $queryParams}} | ||
<a class="{{if eq .SortType "newest"}}active {{end}}item" href="{{$href}}&sort=newest">{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</a> | ||
<a class="{{if eq .SortType "oldest"}}active {{end}}item" href="{{$href}}&sort=oldest">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</a> | ||
<a class="{{if eq .SortType "alphabetically"}}active {{end}}item" href="{{$href}}&sort=alphabetically">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> | ||
<a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="{{$href}}&sort=reversealphabetically">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> | ||
<a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="{{$href}}&sort=recentupdate">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</a> | ||
<a class="{{if eq .SortType "leastupdate"}}active {{end}}item" href="{{$href}}&sort=leastupdate">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</a> | ||
{{if not .DisableStars}} | ||
<a class="{{if eq .SortType "moststars"}}active {{end}}item" href="{{$href}}&sort=moststars">{{ctx.Locale.Tr "repo.issues.filter_sort.moststars"}}</a> | ||
<a class="{{if eq .SortType "feweststars"}}active {{end}}item" href="{{$href}}&sort=feweststars">{{ctx.Locale.Tr "repo.issues.filter_sort.feweststars"}}</a> | ||
{{end}} | ||
<a class="{{if eq .SortType "mostforks"}}active {{end}}item" href="{{$href}}&sort=mostforks">{{ctx.Locale.Tr "repo.issues.filter_sort.mostforks"}}</a> | ||
<a class="{{if eq .SortType "fewestforks"}}active {{end}}item" href="{{$href}}&sort=fewestforks">{{ctx.Locale.Tr "repo.issues.filter_sort.fewestforks"}}</a> | ||
</div> | ||
</div> | ||
</div> | ||
{{if and .PageIsExploreRepositories .OnlyShowRelevant}} | ||
<div class="ui message explore-relevancy-note"> | ||
<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))|Escape) | Safe}}</span> | ||
</div> | ||
{{end}} | ||
<div class="divider"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export function initRepositorySearch() { | ||
const repositorySearchForm = document.querySelector('#repo-search-form'); | ||
if (!repositorySearchForm) return; | ||
|
||
for (const radio of repositorySearchForm.querySelectorAll('input[type=radio]')) { | ||
radio.addEventListener('click', (ev) => { | ||
ev.preventDefault(); | ||
|
||
const formData = new FormData(repositorySearchForm); | ||
const params = new URLSearchParams(formData); | ||
const otherQueryParams = repositorySearchForm.getAttribute('data-query-params'); | ||
window.location.search = `${otherQueryParams}&${params.toString()}`; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters