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.

55 lines
2.8 KiB

  1. {{template "base/head" .}}
  2. <div class="explore users">
  3. {{template "explore/navbar" .}}
  4. <div class="ui container">
  5. <form class="ui form ignore-dirty" style="max-width: 100%">
  6. <div class="ui fluid action input">
  7. <input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search"}}..." autofocus>
  8. <input type="hidden" name="tab" value="{{$.TabName}}">
  9. <button class="ui blue button">{{.i18n.Tr "explore.search"}}</button>
  10. </div>
  11. </form>
  12. <div class="ui divider"></div>
  13. <div class="ui user list">
  14. {{if .SearchResults}}
  15. <h3>
  16. {{.i18n.Tr "explore.code_search_results" (.Keyword|Escape) | Str2html }}
  17. </h3>
  18. <div class="repository search">
  19. {{range $result := .SearchResults}}
  20. {{$repo := (index $.RepoMaps .RepoID)}}
  21. <div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result">
  22. <h4 class="ui top attached normal header">
  23. <span class="file"><a rel="nofollow" href="{{EscapePound $repo.HTMLURL}}">{{$repo.FullName}}</a> - {{.Filename}}</span>
  24. <a class="ui basic grey tiny button" rel="nofollow" href="{{EscapePound $repo.HTMLURL}}/src/branch/{{$repo.DefaultBranch}}/{{EscapePound .Filename}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
  25. </h4>
  26. <div class="ui attached table segment">
  27. <div class="file-body file-code code-view">
  28. <table>
  29. <tbody>
  30. <tr>
  31. <td class="lines-num">
  32. {{range .LineNumbers}}
  33. <a href="{{EscapePound $repo.HTMLURL}}/src/branch/{{$repo.DefaultBranch}}/{{EscapePound $result.Filename}}#L{{.}}"><span>{{.}}</span></a>
  34. {{end}}
  35. </td>
  36. <td class="lines-code"><pre><code class="{{.HighlightClass}}"><ol class="linenums">{{.FormattedLines}}</ol></code></pre></td>
  37. </tr>
  38. </tbody>
  39. </table>
  40. </div>
  41. </div>
  42. </div>
  43. {{end}}
  44. </div>
  45. {{else}}
  46. <div>{{$.i18n.Tr "explore.code_no_results"}}</div>
  47. {{end}}
  48. </div>
  49. {{template "base/paginate" .}}
  50. </div>
  51. </div>
  52. {{template "base/footer" .}}