commits_table.tmpl 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <h4 class="ui top attached header">
  2. {{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}} {{if .Branch}}({{.Branch}}){{end}}
  3. {{if .PageIsCommits}}
  4. <div class="ui right">
  5. <form action="{{.RepoLink}}/commits/{{.BranchName}}/search">
  6. <div class="ui tiny search input">
  7. <input name="q" placeholder="{{.i18n.Tr "repo.commits.search"}}" value="{{.Keyword}}" autofocus>
  8. </div>
  9. <button class="ui black tiny button" data-panel="#add-deploy-key-panel">{{.i18n.Tr "repo.commits.find"}}</button>
  10. </form>
  11. </div>
  12. {{else if .IsDiffCompare}}
  13. <a href="{{$.CommitRepoLink}}/commit/{{.BeforeCommitID}}" class="ui green sha label">{{ShortSha .BeforeCommitID}}</a> ... <a href="{{$.CommitRepoLink}}/commit/{{.AfterCommitID}}" class="ui green sha label">{{ShortSha .AfterCommitID}}</a>
  14. {{end}}
  15. </h4>
  16. {{if .Commits}}
  17. <div class="ui attached table segment">
  18. <table class="ui very basic striped fixed table single line" id="commits-table">
  19. <thead>
  20. <tr>
  21. <th class="four wide">{{.i18n.Tr "repo.commits.author"}}</th>
  22. <th class="nine wide message"><span class="sha">SHA1</span> {{.i18n.Tr "repo.commits.message"}}</th>
  23. <th class="three wide right aligned">{{.i18n.Tr "repo.commits.date"}}</th>
  24. </tr>
  25. </thead>
  26. <tbody>
  27. {{ $r:= List .Commits}}
  28. {{range $r}}
  29. <tr>
  30. <td class="author">
  31. {{if .User}}
  32. <img class="ui avatar image" src="{{.User.AvatarLink}}" alt=""/>&nbsp;&nbsp;<a href="{{AppSubUrl}}/{{.User.Name}}">{{.Author.Name}}</a>
  33. {{else}}
  34. <img class="ui avatar image" src="{{AvatarLink .Author.Email}}" alt=""/>&nbsp;&nbsp;{{.Author.Name}}
  35. {{end}}
  36. </td>
  37. <td class="message collapsing">
  38. <a rel="nofollow" class="ui sha label" href="{{AppSubUrl}}/{{$.Username}}/{{$.Reponame}}/commit/{{.ID}}">{{ShortSha .ID.String}}</a>
  39. {{RenderCommitMessage false .Summary $.RepoLink $.Repository.ComposeMetas}}
  40. </td>
  41. <td class="grey text right aligned">{{TimeSince .Author.When $.Lang}}</td>
  42. </tr>
  43. {{end}}
  44. </tbody>
  45. </table>
  46. </div>
  47. {{end}}
  48. {{with .Page}}
  49. {{if gt .TotalPages 1}}
  50. <div class="center page buttons">
  51. <div class="ui borderless pagination menu">
  52. <a class="{{if not .HasPrevious}}disabled{{end}} item" {{if .HasPrevious}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.Previous}}"{{end}}>
  53. <i class="left arrow icon"></i> {{$.i18n.Tr "repo.issues.previous"}}
  54. </a>
  55. {{range .Pages}}
  56. {{if eq .Num -1}}
  57. <a class="disabled item">...</a>
  58. {{else}}
  59. <a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.Num}}"{{end}}>{{.Num}}</a>
  60. {{end}}
  61. {{end}}
  62. <a class="{{if not .HasNext}}disabled{{end}} item" {{if .HasNext}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.Next}}"{{end}}>
  63. {{$.i18n.Tr "repo.issues.next"}} <i class="icon right arrow"></i>
  64. </a>
  65. </div>
  66. </div>
  67. {{end}}
  68. {{end}}