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.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. <div class="twelve wide field">
  9. <input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "repo.search.search_repo"}}">
  10. </div>
  11. <div class="two wide field">
  12. <select name="t">
  13. <option value="">{{.i18n.Tr "repo.search.fuzzy"}}</option>
  14. <option value="match" {{if eq .queryType "match"}}selected{{end}}>{{.i18n.Tr "repo.search.match"}}</option>
  15. </select>
  16. </div>
  17. <div class="three field">
  18. <button class="ui button" type="submit">
  19. <i class="icon df ac jc">{{svg "octicon-search" 16}}</i>
  20. </button>
  21. </div>
  22. </div>
  23. </form>
  24. </div>
  25. {{if .Keyword}}
  26. <h3>
  27. {{.i18n.Tr "repo.search.results" (.Keyword|Escape) .RepoLink .RepoName | Str2html }}
  28. </h3>
  29. <div class="df ac fw">
  30. {{range $term := .SearchResultLanguages}}
  31. <a class="ui text-label df ac mr-1 my-1 {{if eq $.Language $term.Language}}primary {{end}}basic label" href="{{EscapePound $.SourcePath}}/search?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}{{if ne $.queryType ""}}&t={{$.queryType}}{{end}}">
  32. <i class="color-icon mr-3" style="background-color: {{$term.Color}}"></i>
  33. {{$term.Language}}
  34. <div class="detail">{{$term.Count}}</div>
  35. </a>
  36. {{end}}
  37. </div>
  38. <div class="repository search">
  39. {{range $result := .SearchResults}}
  40. <div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result">
  41. <h4 class="ui top attached normal header">
  42. <span class="file">{{.Filename}}</span>
  43. <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/src/commit/{{$result.CommitID}}/{{EscapePound .Filename}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
  44. </h4>
  45. <div class="ui attached table segment">
  46. <div class="file-body file-code code-view">
  47. <table>
  48. <tbody>
  49. <tr>
  50. <td class="lines-num">
  51. {{range .LineNumbers}}
  52. <a href="{{EscapePound $.SourcePath}}/src/commit/{{$result.CommitID}}/{{EscapePound $result.Filename}}#L{{.}}"><span>{{.}}</span></a>
  53. {{end}}
  54. </td>
  55. <td class="lines-code"><pre><code class="chroma"><ol class="linenums">{{.FormattedLines | Safe}}</ol></code></pre></td>
  56. </tr>
  57. </tbody>
  58. </table>
  59. </div>
  60. </div>
  61. {{template "shared/searchbottom" dict "root" $ "result" .}}
  62. </div>
  63. {{end}}
  64. </div>
  65. {{template "base/paginate" .}}
  66. {{end}}
  67. </div>
  68. </div>
  69. {{template "base/footer" .}}