commits_table.tmpl 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <h4 class="ui top attached header">
  2. {{if .PageIsCommits}}
  3. {{.i18n.Tr "repo.commits.commit_history"}}
  4. {{else}}
  5. {{.CommitsCount}} {{.i18n.Tr "repo.commits.commits"}}
  6. {{end}}
  7. {{if .PageIsCommits}}
  8. <div class="ui right">
  9. <form action="{{.RepoLink}}/commits/{{.BranchName}}/search">
  10. <div class="ui tiny search input">
  11. <input name="q" placeholder="{{.i18n.Tr "repo.commits.search"}}" value="{{.Keyword}}" autofocus>
  12. </div>
  13. <button class="ui black tiny button" data-panel="#add-deploy-key-panel">{{.i18n.Tr "repo.commits.find"}}</button>
  14. </form>
  15. </div>
  16. {{else if .IsDiffCompare}}
  17. <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>
  18. {{end}}
  19. </h4>
  20. {{if .Commits}}
  21. <div class="ui attached table segment">
  22. <table class="ui very basic striped fixed table single line" id="commits-table">
  23. <thead>
  24. <tr>
  25. <th class="four wide">{{.i18n.Tr "repo.commits.author"}}</th>
  26. <th class="nine wide message"><span class="sha">SHA1</span> {{.i18n.Tr "repo.commits.message"}}</th>
  27. <th class="three wide right aligned">{{.i18n.Tr "repo.commits.date"}}</th>
  28. </tr>
  29. </thead>
  30. <tbody>
  31. {{ $r:= List .Commits}}
  32. {{range $r}}
  33. <tr>
  34. <td class="author">
  35. {{if .User}}
  36. <img class="ui avatar image" src="{{.User.RelAvatarLink}}" alt=""/>&nbsp;&nbsp;<a href="{{AppSubUrl}}/{{.User.Name}}">{{.Author.Name}}</a>
  37. {{else}}
  38. <img class="ui avatar image" src="{{AvatarLink .Author.Email}}" alt=""/>&nbsp;&nbsp;{{.Author.Name}}
  39. {{end}}
  40. </td>
  41. <td class="message collapsing has-emoji">
  42. <a rel="nofollow" class="ui sha label" href="{{AppSubUrl}}/{{$.Username}}/{{$.Reponame}}/commit/{{.ID}}">{{ShortSha .ID.String}}</a>
  43. <span {{if gt .ParentCount 1}}class="grey text"{{end}}>{{RenderCommitMessage false .Summary $.RepoLink $.Repository.ComposeMetas}}</span>
  44. </td>
  45. <td class="grey text right aligned">{{TimeSince .Author.When $.Lang}}</td>
  46. </tr>
  47. {{end}}
  48. </tbody>
  49. </table>
  50. </div>
  51. {{end}}
  52. {{if or .HasPrevious .HasNext}}
  53. <br>
  54. <div class="center">
  55. <a class="ui small button {{if not .HasPrevious}}disabled{{end}}" {{if .HasPrevious}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.PreviousPage}}&pageSize={{.PageSize}}"{{end}}>
  56. {{$.i18n.Tr "repo.commits.newer"}}
  57. </a>
  58. <a class="ui small button {{if not .HasNext}}disabled{{end}}" {{if .HasNext}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.NextPage}}&pageSize={{.PageSize}}"{{end}}>
  59. {{$.i18n.Tr "repo.commits.older"}}
  60. </a>
  61. </div>
  62. {{end}}