commits_table.tmpl 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <h4 class="ui top attached header">
  2. {{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}}
  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="{{$.RepoLink}}/commit/{{.BeforeCommitId}}" class="ui green sha label">{{ShortSha .BeforeCommitId}}</a> ... <a href="{{$.RepoLink}}/commit/{{.AfterCommitId}}" class="ui green sha label">{{ShortSha .AfterCommitId}}</a>
  14. {{end}}
  15. </h4>
  16. <div class="ui attached table segment">
  17. <table class="ui very basic striped commits table">
  18. <thead>
  19. <tr>
  20. <th>{{.i18n.Tr "repo.commits.author"}}</th>
  21. <th>SHA1</th>
  22. <th>{{.i18n.Tr "repo.commits.message"}}</th>
  23. <th>{{.i18n.Tr "repo.commits.date"}}</th>
  24. </tr>
  25. </thead>
  26. <tbody>
  27. {{ $username := .Username}}
  28. {{ $reponame := .Reponame}}
  29. {{ $r:= List .Commits}}
  30. {{range $r}}
  31. <tr>
  32. <td class="author">
  33. {{if .User}}
  34. <img class="ui avatar image" src="{{.User.AvatarLink}}" alt=""/>&nbsp;&nbsp;<a href="{{AppSubUrl}}/{{.User.Name}}">{{.Author.Name}}</a>
  35. {{else}}
  36. <img class="ui avatar image" src="{{AvatarLink .Author.Email}}" alt=""/>&nbsp;&nbsp;{{.Author.Name}}
  37. {{end}}
  38. </td>
  39. <td class="sha"><a rel="nofollow" class="ui green sha label" href="{{AppSubUrl}}/{{$username}}/{{$reponame}}/commit/{{.Id}} ">{{SubStr .Id.String 0 10}} </a></td>
  40. <td class="message"><span class="text truncate">{{RenderCommitMessage .Summary $.RepoLink}}</span></td>
  41. <td class="date">{{TimeSince .Author.When $.Lang}}</td>
  42. </tr>
  43. {{end}}
  44. </tbody>
  45. </table>
  46. </div>
  47. {{with .Page}}
  48. {{if gt .TotalPages 1}}
  49. <div class="center page buttons">
  50. <div class="ui borderless pagination menu">
  51. <a class="{{if not .HasPrevious}}disabled{{end}} item" {{if .HasPrevious}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.Previous}}"{{end}}>
  52. <i class="left arrow icon"></i> {{$.i18n.Tr "repo.issues.previous"}}
  53. </a>
  54. {{range .Pages}}
  55. {{if eq .Num -1}}
  56. <a class="disabled item">...</a>
  57. {{else}}
  58. <a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.Num}}"{{end}}>{{.Num}}</a>
  59. {{end}}
  60. {{end}}
  61. <a class="{{if not .HasNext}}disabled{{end}} item" {{if .HasNext}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.Next}}"{{end}}>
  62. {{$.i18n.Tr "repo.issues.next"}} <i class="icon right arrow"></i>
  63. </a>
  64. </div>
  65. </div>
  66. {{end}}
  67. {{end}}