You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

code.tmpl 4.0 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. <div class="twelve wide field">
  9. <input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search"}}..." autofocus>
  10. </div>
  11. <div class="two wide field">
  12. <select name="t">
  13. <option value="">{{.i18n.Tr "explore.search.fuzzy"}}</option>
  14. <option value="match" {{if eq .queryType "match"}}selected{{end}}>{{.i18n.Tr "explore.search.match"}}</option>
  15. </select>
  16. </div>
  17. <div class="three field">
  18. <button class="ui blue button">{{.i18n.Tr "explore.search"}}</button>
  19. </div>
  20. </div>
  21. </form>
  22. <div class="ui divider"></div>
  23. <div class="ui user list">
  24. {{if .SearchResults}}
  25. <h3>
  26. {{.i18n.Tr "explore.code_search_results" (.Keyword|Escape) | Str2html }}
  27. </h3>
  28. <div class="df ac fw">
  29. {{range $term := .SearchResultLanguages}}
  30. <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}}">
  31. <i class="color-icon mr-3" style="background-color: {{$term.Color}}"></i>
  32. {{$term.Language}}
  33. <div class="detail">{{$term.Count}}</div>
  34. </a>
  35. {{end}}
  36. </div>
  37. <div class="repository search">
  38. {{range $result := .SearchResults}}
  39. {{$repo := (index $.RepoMaps .RepoID)}}
  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"><a rel="nofollow" href="{{EscapePound $repo.HTMLURL}}">{{$repo.FullName}}</a> - {{.Filename}}</span>
  43. <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>
  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 $repo.HTMLURL}}/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. {{else}}
  66. <div>{{$.i18n.Tr "explore.code_no_results"}}</div>
  67. {{end}}
  68. </div>
  69. {{template "base/paginate" .}}
  70. </div>
  71. </div>
  72. {{template "base/footer" .}}