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.

code.tmpl 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. {{template "base/head" .}}
  2. <div class="page-content explore users">
  3. {{template "explore/navbar" .}}
  4. <div class="ui container">
  5. <form class="ui form ignore-dirty" style="max-width: 100%">
  6. <input type="hidden" name="tab" value="{{$.TabName}}">
  7. <div class="ui fluid action input">
  8. <input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search"}}..." autofocus>
  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 "explore.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 "explore.search.fuzzy"}}</div>
  14. <div class="item" data-value="match">{{.i18n.Tr "explore.search.match"}}</div>
  15. </div>
  16. </div>
  17. <button class="ui blue button">{{.i18n.Tr "explore.search"}}</button>
  18. </div>
  19. </form>
  20. <div class="ui divider"></div>
  21. <div class="ui user list">
  22. {{if .SearchResults}}
  23. <h3>
  24. {{.i18n.Tr "explore.code_search_results" (.Keyword|Escape) | Str2html }}
  25. </h3>
  26. <div class="df ac fw">
  27. {{range $term := .SearchResultLanguages}}
  28. <a class="ui text-label df ac mr-1 my-1 {{if eq $.Language $term.Language}}primary {{end}}basic label" href="{{AppSubUrl}}/explore/code?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}{{if ne $.queryType ""}}&t={{$.queryType}}{{end}}">
  29. <i class="color-icon mr-3" style="background-color: {{$term.Color}}"></i>
  30. {{$term.Language}}
  31. <div class="detail">{{$term.Count}}</div>
  32. </a>
  33. {{end}}
  34. </div>
  35. <div class="repository search">
  36. {{range $result := .SearchResults}}
  37. {{$repo := (index $.RepoMaps .RepoID)}}
  38. <div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result">
  39. <h4 class="ui top attached normal header">
  40. <span class="file">
  41. <a rel="nofollow" href="{{$repo.HTMLURL}}">{{$repo.FullName}}</a>
  42. {{if $repo.IsArchived}}
  43. <span class="ui basic label">{{$.i18n.Tr "repo.desc.archived"}}</span>
  44. {{end}}
  45. - {{.Filename}}
  46. </span>
  47. <a class="ui basic tiny button" rel="nofollow" href="{{$repo.HTMLURL}}/src/commit/{{$result.CommitID | PathEscape}}/{{.Filename | PathEscapeSegments}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
  48. </h4>
  49. <div class="ui attached table segment">
  50. <div class="file-body file-code code-view">
  51. <table>
  52. <tbody>
  53. <tr>
  54. <td class="lines-num">
  55. {{range .LineNumbers}}
  56. <a href="{{$repo.HTMLURL}}/src/commit/{{$result.CommitID | PathEscape}}/{{$result.Filename | PathEscapeSegments}}#L{{.}}"><span>{{.}}</span></a>
  57. {{end}}
  58. </td>
  59. <td class="lines-code chroma"><code class="code-inner">{{.FormattedLines | Safe}}</code></td>
  60. </tr>
  61. </tbody>
  62. </table>
  63. </div>
  64. </div>
  65. {{template "shared/searchbottom" dict "root" $ "result" .}}
  66. </div>
  67. {{end}}
  68. </div>
  69. {{else}}
  70. <div>{{$.i18n.Tr "explore.code_no_results"}}</div>
  71. {{end}}
  72. </div>
  73. {{template "base/paginate" .}}
  74. </div>
  75. </div>
  76. {{template "base/footer" .}}