commits_table.tmpl 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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">{{ShortSHA1 .BeforeCommitID}}</a> ... <a href="{{$.CommitRepoLink}}/commit/{{.AfterCommitID}}" class="ui green sha label">{{ShortSHA1 .AfterCommitID}}</a>
  18. {{end}}
  19. </h4>
  20. {{if .Commits}}
  21. <div class="ui unstackable attached table segment">
  22. <table id="commits-table" class="ui unstackable very basic striped fixed table single line">
  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">
  42. {{/* Username or Reponame doesn't present we assume the source repository no longer exists */}}
  43. {{if not (and $.Username $.Reponame)}}
  44. <span class="ui sha label">{{ShortSHA1 .ID.String}}</span>
  45. {{else}}
  46. <a rel="nofollow" class="ui sha label" href="{{AppSubURL}}/{{$.Username}}/{{$.Reponame}}/commit/{{.ID}}">{{ShortSHA1 .ID.String}}</a>
  47. {{end}}
  48. <span class="{{if gt .ParentCount 1}}grey text {{end}} has-emoji">{{RenderCommitMessage false .Summary $.RepoLink $.Repository.ComposeMetas | Str2HTML}}</span>
  49. </td>
  50. <td class="grey text right aligned">{{TimeSince .Author.When $.Lang}}</td>
  51. </tr>
  52. {{end}}
  53. </tbody>
  54. </table>
  55. </div>
  56. {{end}}
  57. {{if or .HasPrevious .HasNext}}
  58. <br>
  59. <div class="center">
  60. <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}}>
  61. {{$.i18n.Tr "repo.commits.newer"}}
  62. </a>
  63. <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}}>
  64. {{$.i18n.Tr "repo.commits.older"}}
  65. </a>
  66. </div>
  67. {{end}}