diff.tmpl 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. {{template "ng/base/head" .}}
  2. {{template "ng/base/header" .}}
  3. <div id="repo-wrapper">
  4. {{template "repo/header" .}}
  5. <div class="container clear" id="diff-page">
  6. {{if .IsDiffCompare }}
  7. <div class="panel panel-info panel-radius compare-head-box">
  8. <div class="panel-header">
  9. <a class="pull-right btn btn-blue btn-header btn-medium btn-radius" rel="nofollow" href="{{.SourcePath}}">{{.i18n.Tr "repo.diff.browse_source"}}</a>
  10. <h4><a href="{{$.RepoLink}}/commit/{{.BeforeCommitId}}" class="label label-green">{{ShortSha .BeforeCommitId}}</a> ... <a href="{{$.RepoLink}}/commit/{{.AfterCommitId}}" class="label label-green">{{ShortSha .AfterCommitId}}</a></h4>
  11. </div>
  12. <div class="panel-body compare">
  13. {{template "repo/commits_table" .}}
  14. </div>
  15. </div>
  16. {{else}}
  17. <div class="panel panel-info panel-radius diff-head-box">
  18. <div class="panel-header">
  19. <a class="pull-right btn btn-blue btn-header btn-medium btn-radius" rel="nofollow" href="{{.SourcePath}}">{{.i18n.Tr "repo.diff.browse_source"}}</a>
  20. <h4 class="commit-message">{{RenderCommitMessage .Commit.Message $.RepoLink}}</h4>
  21. </div>
  22. <div class="panel-body">
  23. <span class="pull-right">
  24. <ul class="list-unstyled">
  25. <li class="inline">{{.i18n.Tr "repo.diff.parent"}}</li>
  26. {{range .Parents}}
  27. <li class="inline"><a href="{{$.RepoLink}}/commit/{{.}}"><span class="label label-blue">{{ShortSha .}}</span></a></li>
  28. {{end}}
  29. <li class="inline">{{.i18n.Tr "repo.diff.commit"}} <span class="label label-blue">{{ShortSha .CommitId}}</span></li>
  30. </ul>
  31. </span>
  32. <p class="author">
  33. {{if .Author}}
  34. <img class="avatar-30" src="{{.Author.AvatarLink}}" />
  35. <a href="{{AppSubUrl}}/{{.Author.Name}}"><strong>{{.Commit.Author.Name}}</strong></a>
  36. {{else}}
  37. <img class="avatar-30" src="{{AvatarLink .Commit.Author.Email}}" />
  38. <strong>{{.Commit.Author.Name}}</strong>
  39. {{end}}
  40. <span class="text-grey" id="authored-time">{{TimeSince .Commit.Author.When $.Lang}}</span>
  41. </p>
  42. </div>
  43. </div>
  44. {{end}}
  45. {{if .DiffNotAvailable}}
  46. <h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4>
  47. {{else}}
  48. <div class="diff-detail-box diff-box">
  49. <a class="pull-right btn btn-gray btn-header btn-radius text-black" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a>
  50. <p class="showing">
  51. <i class="fa fa-retweet"></i>
  52. {{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
  53. </p>
  54. <ol class="detail-files collapse hide" id="diff-files">
  55. {{range .Diff.Files}}
  56. <li>
  57. <div class="diff-counter count pull-right">
  58. {{if not .IsBin}}
  59. <span class="add" data-line="{{.Addition}}">{{.Addition}}</span>
  60. <span class="bar">
  61. <span class="pull-left add"></span>
  62. <span class="pull-left del"></span>
  63. </span>
  64. <span class="del" data-line="{{.Deletion}}">{{.Deletion}}</span>
  65. {{else}}
  66. <span>{{$.i18n.Tr "repo.diff.bin"}}</span>
  67. {{end}}
  68. </div>
  69. <!-- todo finish all file status, now modify, add, delete and rename -->
  70. <span class="status {{DiffTypeToStr .Type}}" data-toggle="tooltip" data-placement="right" title="{{DiffTypeToStr .Type}}">&nbsp;</span>
  71. <a class="file" href="#diff-{{.Index}}">{{.Name}}</a>
  72. </li>
  73. {{end}}
  74. </ol>
  75. </div>
  76. {{range $i, $file := .Diff.Files}}
  77. <div class="panel panel-radius diff-file-box diff-box file-content" id="diff-{{.Index}}">
  78. <div class="panel-header">
  79. <div class="diff-counter count pull-left">
  80. {{if not $file.IsBin}}
  81. <span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
  82. <span class="bar">
  83. <span class="pull-left add"></span>
  84. <span class="pull-left del"></span>
  85. </span>
  86. <span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>
  87. {{else}}
  88. {{$.i18n.Tr "repo.diff.bin"}}
  89. {{end}}
  90. </div>
  91. {{if $file.IsDeleted}}
  92. <a class="btn btn-gray btn-header btn-radius text-black pull-right" rel="nofollow" href="{{$.BeforeSourcePath}}/{{.Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
  93. {{else}}
  94. <a class="btn btn-gray btn-header btn-radius text-black pull-right" rel="nofollow" href="{{$.SourcePath}}/{{.Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
  95. {{end}}
  96. <span class="file">{{$file.Name}}</span>
  97. </div>
  98. {{$isImage := (call $.IsImageFile $file.Name)}}
  99. <div class="panel-body file-body file-code code-view code-diff">
  100. {{if $isImage}}
  101. <div class="text-center">
  102. <img src="{{$.RawPath}}/{{.Name}}">
  103. </div>
  104. {{else}}
  105. <table>
  106. <tbody>
  107. {{range .Sections}}
  108. {{range $k, $line := .Lines}}
  109. <tr class="{{DiffLineTypeToStr .Type}}-code nl-{{$k}} ol-{{$k}}">
  110. <td class="lines-num lines-num-old">
  111. <span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span>
  112. </td>
  113. <td class="lines-num lines-num-new">
  114. <span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
  115. </td>
  116. <td class="lines-code">
  117. <pre>{{$line.Content}}</pre>
  118. </td>
  119. </tr>
  120. {{end}}
  121. {{end}}
  122. </tbody>
  123. </table>
  124. {{end}}
  125. </div>
  126. </div>
  127. <br>
  128. {{end}}
  129. {{end}}
  130. </div>
  131. </div>
  132. {{template "ng/base/footer" .}}