commits_table.tmpl 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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><span class="commits-message">{{.i18n.Tr "repo.commits.message"}}</span></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">
  51. <i style="font-size:11px" class="menu-icon octicon">🕒</i> {{TimeSince .Author.When $.Lang}}
  52. <a class="view-source poping up" href="{{AppSubURL}}/{{$.Username}}/{{$.Reponame}}/src/{{.ID}}" data-content="Browse the repository at this point in the history" data-variation="inverted tiny" data-position="right center">
  53. <i class="code-icon menu-icon octicon octicon-code"></i>
  54. </a>
  55. </td>
  56. </tr>
  57. {{end}}
  58. </tbody>
  59. </table>
  60. </div>
  61. {{end}}
  62. {{if or .HasPrevious .HasNext}}
  63. <br>
  64. <div class="center">
  65. <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}}>
  66. {{$.i18n.Tr "repo.commits.newer"}}
  67. </a>
  68. <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}}>
  69. {{$.i18n.Tr "repo.commits.older"}}
  70. </a>
  71. </div>
  72. {{end}}