You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

search.tmpl 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. {{template "base/head" .}}
  2. <div class="page-content repository file list">
  3. {{template "repo/header" .}}
  4. <div class="ui container">
  5. <div class="ui repo-search">
  6. <form class="ui form ignore-dirty" method="get">
  7. <div class="ui fluid action input">
  8. <input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "repo.search.search_repo"}}">
  9. <div class="ui dropdown selection">
  10. <input name="t" type="hidden" value="{{.queryType}}">{{svg "octicon-triangle-down" 14 "dropdown icon"}}
  11. <div class="text">{{.i18n.Tr (printf "repo.search.%s" (or .queryType "fuzzy"))}}</div>
  12. <div class="menu transition hidden" tabindex="-1" style="display: block !important;">
  13. <div class="item" data-value="">{{.i18n.Tr "repo.search.fuzzy"}}</div>
  14. <div class="item" data-value="match">{{.i18n.Tr "repo.search.match"}}</div>
  15. </div>
  16. </div>
  17. <button class="ui icon button" type="submit">{{svg "octicon-search" 16}}</button>
  18. </div>
  19. </form>
  20. </div>
  21. {{if .Keyword}}
  22. <h3>
  23. {{.i18n.Tr "repo.search.results" (.Keyword|Escape) (.RepoLink|Escape) (.RepoName|Escape) | Str2html }}
  24. </h3>
  25. <div class="df ac fw">
  26. {{range $term := .SearchResultLanguages}}
  27. <a class="ui text-label df ac mr-1 my-1 {{if eq $.Language $term.Language}}primary {{end}}basic label" href="{{$.SourcePath}}/search?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}{{if ne $.queryType ""}}&t={{$.queryType}}{{end}}">
  28. <i class="color-icon mr-3" style="background-color: {{$term.Color}}"></i>
  29. {{$term.Language}}
  30. <div class="detail">{{$term.Count}}</div>
  31. </a>
  32. {{end}}
  33. </div>
  34. <div class="repository search">
  35. {{range $result := .SearchResults}}
  36. <div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result">
  37. <h4 class="ui top attached normal header">
  38. <span class="file">{{.Filename}}</span>
  39. <a class="ui basic tiny button" rel="nofollow" href="{{$.SourcePath}}/src/commit/{{PathEscape $result.CommitID}}/{{PathEscapeSegments .Filename}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
  40. </h4>
  41. <div class="ui attached table segment">
  42. <div class="file-body file-code code-view">
  43. <table>
  44. <tbody>
  45. <tr>
  46. <td class="lines-num">
  47. {{range .LineNumbers}}
  48. <a href="{{$.SourcePath}}/src/commit/{{PathEscape $result.CommitID}}/{{PathEscapeSegments $result.Filename}}#L{{.}}"><span>{{.}}</span></a>
  49. {{end}}
  50. </td>
  51. <td class="lines-code chroma"><code class="code-inner">{{.FormattedLines | Safe}}</code></td>
  52. </tr>
  53. </tbody>
  54. </table>
  55. </div>
  56. </div>
  57. {{template "shared/searchbottom" dict "root" $ "result" .}}
  58. </div>
  59. {{end}}
  60. </div>
  61. {{template "base/paginate" .}}
  62. {{end}}
  63. </div>
  64. </div>
  65. {{template "base/footer" .}}