2
0

commits_table.tmpl 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. {{range .Commits}}
  32. <tr>
  33. <td class="author">
  34. {{if .User}}
  35. <img class="ui avatar image" src="{{.User.RelAvatarLink}}" alt=""/>&nbsp;&nbsp;<a href="{{AppSubURL}}/{{.User.Name}}">{{.Author.Name}}</a>
  36. {{else}}
  37. <img class="ui avatar image" src="{{AvatarLink .Author.Email}}" alt=""/>&nbsp;&nbsp;{{.Author.Name}}
  38. {{end}}
  39. </td>
  40. <td class="message collapsing">
  41. {{/* Username or Reponame doesn't present we assume the source repository no longer exists */}}
  42. {{if not (and $.Username $.Reponame)}}
  43. <span class="ui sha label">{{ShortSHA1 .ID.String}}</span>
  44. {{else}}
  45. <a rel="nofollow" class="ui sha label" href="{{AppSubURL}}/{{$.Username}}/{{$.Reponame}}/commit/{{.ID}}">{{ShortSHA1 .ID.String}}</a>
  46. {{end}}
  47. <span class="{{if gt .ParentsCount 1}}grey text {{end}} has-emoji">{{RenderCommitMessage false .Summary $.RepoLink $.Repository.ComposeMetas | Str2HTML}}</span>
  48. </td>
  49. <td class="grey text right aligned">{{TimeSince .Author.When $.Lang}}</td>
  50. </tr>
  51. {{end}}
  52. </tbody>
  53. </table>
  54. </div>
  55. {{end}}
  56. {{if or .HasPrevious .HasNext}}
  57. <br>
  58. <div class="center">
  59. <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}}>
  60. {{$.i18n.Tr "repo.commits.newer"}}
  61. </a>
  62. <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}}>
  63. {{$.i18n.Tr "repo.commits.older"}}
  64. </a>
  65. </div>
  66. {{end}}