Newer
Older
gitbucket_jkp / src / main / twirl / repo / commit.scala.html
  1. @(commitId: String,
  2. commit: util.JGitUtil.CommitInfo,
  3. branches: List[String],
  4. tags: List[String],
  5. repository: service.RepositoryService.RepositoryInfo,
  6. diffs: Seq[util.JGitUtil.DiffInfo],
  7. oldCommitId: Option[String])(implicit context: app.Context)
  8. @import context._
  9. @import view.helpers._
  10. @import util.Implicits._
  11. @html.main(commit.shortMessage, Some(repository)){
  12. @html.header("code", repository)
  13. @tab(commitId, repository, "commits")
  14. <table class="table table-bordered">
  15. <tr>
  16. <th>
  17. <div class="pull-right align-right">
  18. <a href="@url(repository)/tree/@commit.id" class="btn btn-small">Browse code</a>
  19. </div>
  20. <div class="commit-log">@link(commit.summary, repository)</div>
  21. @if(commit.description.isDefined){
  22. <pre class="commit-description">@link(commit.description.get, repository)</pre>
  23. }
  24. <div class="small" style="font-weight: normal;">
  25. @if(branches.nonEmpty){
  26. <span class="muted">
  27. <img src="@assets/common/images/branch.png"/>
  28. @branches.zipWithIndex.map { case (branch, i) =>
  29. <a href="@url(repository)/tree/@encodeRefName(branch)" class="branch" id="branch-@i">@branch</a>
  30. }
  31. </span>
  32. }
  33. @if(tags.nonEmpty){
  34. <span class="muted">
  35. <img src="@assets/common/images/tag.png"/>
  36. @tags.zipWithIndex.map { case (tag, i) =>
  37. <a href="@url(repository)/tree/@tag" class="tag" id="tag-@i">@tag</a>
  38. }
  39. </span>
  40. }
  41. </div>
  42. </th>
  43. </tr>
  44. <tr>
  45. <td>
  46. @avatar(commit, 20)
  47. @user(commit.committer, commit.mailAddress, "username strong")
  48. <span class="muted">@datetime(commit.time)</span>
  49. <div class="pull-right monospace small" style="text-align: right;">
  50. <div>
  51. @if(commit.parents.size == 0){
  52. <span class="muted">0 parent</span>
  53. }
  54. @if(commit.parents.size == 1){
  55. <span class="muted">1 parent</span>
  56. <a href="@url(repository)/commit/@commit.parents(0)" class="commit-id">@commit.parents(0).substring(0, 7)</a>
  57. }
  58. <span class="muted">commit</span> @commit.id
  59. </div>
  60. @if(commit.parents.size > 1){
  61. <div>
  62. <span class="muted">@commit.parents.size parents
  63. @commit.parents.map { parent =>
  64. <a href="@url(repository)/commit/@parent" class="commit-id">@parent.substring(0, 7)</a>
  65. }.mkHtml(" + ")
  66. </span>
  67. </div>
  68. }
  69. </div>
  70. </td>
  71. </tr>
  72. </table>
  73. @helper.html.diff(diffs, repository, Some(commit.id), oldCommitId, true)
  74. }
  75. <script>
  76. $(function(){
  77. $('a.branch:first, a.tag:first').css({
  78. 'font-weight': 'bold',
  79. 'color': '#555555'
  80. });
  81.  
  82. @if(branches.size > 5){
  83. // hide branches
  84. @for(i <- 1 to branches.size - 2){
  85. $('#branch-@i').hide();
  86. }
  87. // add omit link
  88. $('#branch-@(branches.size - 1)').before(
  89. $('<a href="javascript:void(0);" class="omit">...</a>').click(function(){
  90. @for(i <- 1 to branches.size - 2){
  91. $('#branch-@i').show();
  92. this.remove();
  93. }
  94. })
  95. );
  96. }
  97.  
  98. @if(tags.size > 5){
  99. // hide tags
  100. @for(i <- 1 to tags.size - 2){
  101. $('#tag-@i').hide();
  102. }
  103. // add omit link
  104. $('#tag-@(tags.size - 1)').before(
  105. $('<a href="javascript:void(0);" class="omit">...</a>').click(function(){
  106. @for(i <- 1 to tags.size - 2){
  107. $('#tag-@i').show();
  108. this.remove();
  109. }
  110. })
  111. );
  112. }
  113. });
  114. </script>
  115. <style type="text/css">
  116. a.branch, a.tag {
  117. color: #888888;
  118. margin-right: 4px;
  119. }
  120.  
  121. a.omit {
  122. margin-right: 4px;
  123. }
  124. </style>