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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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"><a rel="nofollow" href="{{EscapePound $repo.HTMLURL}}">{{$repo.FullName}}</a> - {{.Filename}}</span>
  41. <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $repo.HTMLURL}}/src/commit/{{$result.CommitID}}/{{EscapePound .Filename}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
  42. </h4>
  43. <div class="ui attached table segment">
  44. <div class="file-body file-code code-view">
  45. <table>
  46. <tbody>
  47. <tr>
  48. <td class="lines-num">
  49. {{range .LineNumbers}}
  50. <a href="{{EscapePound $repo.HTMLURL}}/src/commit/{{$result.CommitID}}/{{EscapePound $result.Filename}}#L{{.}}"><span>{{.}}</span></a>
  51. {{end}}
  52. </td>
  53. <td class="lines-code"><pre><code class="chroma"><ol class="linenums">{{.FormattedLines | Safe}}</ol></code></pre></td>
  54. </tr>
  55. </tbody>
  56. </table>
  57. </div>
  58. </div>
  59. {{template "shared/searchbottom" dict "root" $ "result" .}}
  60. </div>
  61. {{end}}
  62. </div>
  63. {{else}}
  64. <div>{{$.i18n.Tr "explore.code_no_results"}}</div>
  65. {{end}}
  66. </div>
  67. {{template "base/paginate" .}}
  68. </div>
  69. </div>
  70. {{template "base/footer" .}}