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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {{template "base/head" .}}
  2. <div class="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. <button class="ui button" type="submit">
  10. <i class="search icon"></i>
  11. </button>
  12. </div>
  13. </form>
  14. </div>
  15. {{if .Keyword}}
  16. <h3>
  17. {{.i18n.Tr "repo.search.results" (.Keyword|Escape) .RepoLink .RepoName | Str2html }}
  18. </h3>
  19. <div>
  20. {{range $term := .SearchResultLanguages}}
  21. <a class="ui text-label {{if eq $.Language $term.Language}}primary {{end}}basic label" href="{{EscapePound $.SourcePath}}/search?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}">
  22. <i class="color-icon" style="background-color: {{$term.Color}}"></i>
  23. {{$term.Language}}
  24. <div class="detail">{{$term.Count}}</div>
  25. </a>
  26. {{end}}
  27. </div>
  28. <div class="repository search">
  29. {{range $result := .SearchResults}}
  30. <div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result">
  31. <h4 class="ui top attached normal header">
  32. <span class="file">{{.Filename}}</span>
  33. <a class="ui basic grey tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/src/commit/{{$result.CommitID}}/{{EscapePound .Filename}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
  34. </h4>
  35. <div class="ui attached table segment">
  36. <div class="file-body file-code code-view">
  37. <table>
  38. <tbody>
  39. <tr>
  40. <td class="lines-num">
  41. {{range .LineNumbers}}
  42. <a href="{{EscapePound $.SourcePath}}/src/commit/{{$result.CommitID}}/{{EscapePound $result.Filename}}#L{{.}}"><span>{{.}}</span></a>
  43. {{end}}
  44. </td>
  45. <td class="lines-code"><pre><code class="chroma"><ol class="linenums">{{.FormattedLines | Safe}}</ol></code></pre></td>
  46. </tr>
  47. </tbody>
  48. </table>
  49. </div>
  50. </div>
  51. <div class="ui bottom attached table segment">
  52. {{if $result.Language}}
  53. <i class="color-icon" style="background-color: {{$result.Color}}"></i>{{$result.Language}}
  54. {{end}}
  55. &nbsp;
  56. {{if not $result.UpdatedUnix.IsZero}}
  57. <span class="ui small grey text pull right">{{$.i18n.Tr "explore.code_last_indexed_at" (TimeSinceUnix $result.UpdatedUnix $.i18n.Lang) | Safe}} &nbsp;</span>
  58. {{end}}
  59. </div>
  60. </div>
  61. {{end}}
  62. </div>
  63. {{template "base/paginate" .}}
  64. {{end}}
  65. </div>
  66. </div>
  67. {{template "base/footer" .}}