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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {{template "base/head" .}}
  2. <div role="main" aria-label="{{.Title}}" 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}}"{{if .CodeIndexerUnavailable}} disabled{{end}} placeholder="{{ctx.Locale.Tr "repo.search.search_repo"}}">
  9. <div class="ui dropdown selection {{if .CodeIndexerUnavailable}} disabled{{end}}" data-tooltip-content="{{ctx.Locale.Tr "repo.search.type.tooltip"}}">
  10. <input name="t" type="hidden"{{if .CodeIndexerUnavailable}} disabled{{end}} value="{{.queryType}}">{{svg "octicon-triangle-down" 14 "dropdown icon"}}
  11. <div class="text">{{ctx.Locale.Tr (printf "repo.search.%s" (or .queryType "fuzzy"))}}</div>
  12. <div class="menu">
  13. <div class="item" data-value="" data-tooltip-content="{{ctx.Locale.Tr "repo.search.fuzzy.tooltip"}}">{{ctx.Locale.Tr "repo.search.fuzzy"}}</div>
  14. <div class="item" data-value="match" data-tooltip-content="{{ctx.Locale.Tr "repo.search.match.tooltip"}}">{{ctx.Locale.Tr "repo.search.match"}}</div>
  15. </div>
  16. </div>
  17. <button class="ui icon button"{{if .CodeIndexerUnavailable}} disabled{{end}} type="submit">{{svg "octicon-search" 16}}</button>
  18. </div>
  19. </form>
  20. </div>
  21. {{if .CodeIndexerUnavailable}}
  22. <div class="ui error message">
  23. <p>{{ctx.Locale.Tr "repo.search.code_search_unavailable"}}</p>
  24. </div>
  25. {{else if .Keyword}}
  26. <h3>
  27. {{ctx.Locale.Tr "repo.search.results" (.Keyword|Escape) (.RepoLink|Escape) (.RepoName|Escape) | Str2html}}
  28. </h3>
  29. {{if .SearchResults}}
  30. <div class="flex-text-block gt-fw">
  31. {{range $term := .SearchResultLanguages}}
  32. <a class="ui {{if eq $.Language $term.Language}}primary{{end}} basic label gt-m-0" href="{{$.SourcePath}}/search?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}{{if ne $.queryType ""}}&t={{$.queryType}}{{end}}">
  33. <i class="color-icon gt-mr-3" style="background-color: {{$term.Color}}"></i>
  34. {{$term.Language}}
  35. <div class="detail">{{$term.Count}}</div>
  36. </a>
  37. {{end}}
  38. </div>
  39. <div class="repository search">
  40. {{range $result := .SearchResults}}
  41. <div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result">
  42. <h4 class="ui top attached normal header gt-df gt-fw">
  43. <span class="file gt-f1">{{.Filename}}</span>
  44. <a role="button" class="ui basic tiny button" rel="nofollow" href="{{$.SourcePath}}/src/commit/{{PathEscape $result.CommitID}}/{{PathEscapeSegments .Filename}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a>
  45. </h4>
  46. <div class="ui attached table segment">
  47. <div class="file-body file-code code-view">
  48. <table>
  49. <tbody>
  50. <tr>
  51. <td class="lines-num">
  52. {{range .LineNumbers}}
  53. <a href="{{$.SourcePath}}/src/commit/{{PathEscape $result.CommitID}}/{{PathEscapeSegments $result.Filename}}#L{{.}}"><span>{{.}}</span></a>
  54. {{end}}
  55. </td>
  56. <td class="lines-code chroma"><code class="code-inner">{{.FormattedLines}}</code></td>
  57. </tr>
  58. </tbody>
  59. </table>
  60. </div>
  61. </div>
  62. {{template "shared/searchbottom" dict "root" $ "result" .}}
  63. </div>
  64. {{end}}
  65. </div>
  66. {{template "base/paginate" .}}
  67. {{else}}
  68. <div>{{ctx.Locale.Tr "repo.search.code_no_results"}}</div>
  69. {{end}}
  70. {{end}}
  71. </div>
  72. </div>
  73. {{template "base/footer" .}}