- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 6.2k
 
Filter Repositories by type #29231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Filter Repositories by type #29231
Changes from 5 commits
      Commits
    
    
            Show all changes
          
          
            25 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      04c51f9
              
                feature: filter repositories by type
              
              
                zokkis 3c386fd
              
                i18n: moved translations
              
              
                zokkis 5310843
              
                chore: shorten ev variable name
              
              
                zokkis 9d339f6
              
                refactor: removed unused template
              
              
                zokkis 3ab87b6
              
                style: remove divider
              
              
                zokkis f77def7
              
                i18n: clear filter
              
              
                zokkis cc9971b
              
                enhance: added template filter
              
              
                zokkis 21d32d4
              
                i18n: template filter
              
              
                zokkis 45c5635
              
                Merge branch 'main' into feature/filter-repo-by-type
              
              
                6543 11f8cd9
              
                PathEscape
              
              
                zokkis 30d9f02
              
                lint: corrected
              
              
                zokkis 466ea37
              
                escaping
              
              
                zokkis f8560f1
              
                Merge branch 'main' into feature/filter-repo-by-type
              
              
                zokkis d4291fb
              
                review fix
              
              
                zokkis ae846c1
              
                correct escaping
              
              
                zokkis 6662065
              
                use form for search instead of printf
              
              
                zokkis fc8a646
              
                Merge branch 'main' into feature/filter-repo-by-type
              
              
                6543 618c63f
              
                convert as repo_model.SearchRepoOptions should be addressed seperatly
              
              
                6543 e0fd398
              
                adjust template
              
              
                6543 86d0304
              
                Merge branch 'main' into feature/filter-repo-by-type
              
              
                6543 f1b518e
              
                Merge branch 'main' into feature/filter-repo-by-type
              
              
                zokkis 3912ff0
              
                Merge branch 'main' into feature/filter-repo-by-type
              
              
                6543 9a553c1
              
                switch to follow order above
              
              
                6543 6acd87d
              
                adjust to latest refactors
              
              
                6543 fe7830b
              
                Merge branch 'main' into feature/filter-repo-by-type
              
              
                6543 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 was deleted.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or 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 hidden or 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 hidden or 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,72 @@ | ||
| <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}} | ||
                
      
                  zokkis marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| {{if not .TabName}}{{$tabQuery = ""}}{{end}} | ||
| {{$languageQuery := printf "language=%s&" .Language}} | ||
| {{if not .TabName}}{{$languageQuery = ""}}{{end}} | ||
| {{$queryParams := printf "%s%sq=%s" $tabQuery $languageQuery .Keyword}} | ||
                
      
                  zokkis marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| <!-- Filter --> | ||
| {{$queryParamsWithSort := printf "%s&sort=%s" $queryParams .SortType}} | ||
| <form class="ui form ignore-dirty" id="repo-search-form" data-query-params="{{$queryParamsWithSort}}"> | ||
                
      
                  zokkis marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| <div class="ui dropdown type jump item gt-mr-0"> | ||
| <span class="text"> | ||
| {{ctx.Locale.Tr "filter"}} | ||
| </span> | ||
| {{svg "octicon-triangle-down" 14 "dropdown icon"}} | ||
| <div class="menu"> | ||
| <a class="item" href="{{printf "%s?%s" .Link $queryParamsWithSort}}">{{ctx.Locale.Tr "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 "filter.is_archived"}}</label> | ||
| <label class="item no-blur"><input type="radio" name="archived" {{if .IsArchived.IsFalse}}checked{{end}} value="0"> {{ctx.Locale.Tr "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 "filter.is_fork"}}</label> | ||
| <label class="item no-blur"><input type="radio" name="fork" {{if .IsFork.IsFalse}}checked{{end}} value="0"> {{ctx.Locale.Tr "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 "filter.is_mirror"}}</label> | ||
| <label class="item no-blur"><input type="radio" name="mirror" {{if .IsMirror.IsFalse}}checked{{end}} value="0"> {{ctx.Locale.Tr "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 "filter.public"}}</label> | ||
| <label class="item no-blur"><input type="radio" name="private" {{if .IsPrivate.IsTrue}}checked{{end}} value="1"> {{ctx.Locale.Tr "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}} | ||
  
    
      This file contains hidden or 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 hidden or 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 hidden or 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', (e) => { | ||
| e.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 hidden or 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
    
  
  
    
              
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.