diff.tmpl 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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>{{.Commit.Message}}</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. <img class="avatar-30" src="{{AvatarLink .Commit.Author.Email}}" />
  34. {{if .Author}}
  35. <a href="{{AppSubUrl}}/{{.Author}}"><strong>{{.Commit.Author.Name}}</strong></a>
  36. {{else}}
  37. <strong>{{.Commit.Author.Name}}</strong>
  38. {{end}}
  39. <span class="text-grey" id="authored-time">{{TimeSince .Commit.Author.When $.Lang}}</span>
  40. </p>
  41. </div>
  42. </div>
  43. {{end}}
  44. {{if .DiffNotAvailable}}
  45. <h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4>
  46. {{else}}
  47. <div class="diff-detail-box diff-box">
  48. <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>
  49. <p class="showing">
  50. <i class="fa fa-retweet"></i>
  51. {{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
  52. </p>
  53. <ol class="detail-files collapse hide" id="diff-files">
  54. {{range .Diff.Files}}
  55. <li>
  56. <div class="diff-counter count pull-right">
  57. {{if not .IsBin}}
  58. <span class="add" data-line="{{.Addition}}">{{.Addition}}</span>
  59. <span class="bar">
  60. <span class="pull-left add"></span>
  61. <span class="pull-left del"></span>
  62. </span>
  63. <span class="del" data-line="{{.Deletion}}">{{.Deletion}}</span>
  64. {{else}}
  65. <span>{{$.i18n.Tr "repo.diff.bin"}}</span>
  66. {{end}}
  67. </div>
  68. <!-- todo finish all file status, now modify, add, delete and rename -->
  69. <span class="status {{DiffTypeToStr .Type}}" data-toggle="tooltip" data-placement="right" title="{{DiffTypeToStr .Type}}">&nbsp;</span>
  70. <a class="file" href="#diff-{{.Index}}">{{.Name}}</a>
  71. </li>
  72. {{end}}
  73. </ol>
  74. </div>
  75. {{range .Diff.Files}}
  76. <div class="panel panel-radius diff-file-box diff-box file-content" id="diff-{{.Index}}">
  77. <div class="panel-header">
  78. <div class="diff-counter count pull-left">
  79. {{if not .IsBin}}
  80. <span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
  81. <span class="bar">
  82. <span class="pull-left add"></span>
  83. <span class="pull-left del"></span>
  84. </span>
  85. <span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>
  86. {{else}}
  87. {{$.i18n.Tr "repo.diff.bin"}}
  88. {{end}}
  89. </div>
  90. <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>
  91. <span class="file">{{.Name}}</span>
  92. </div>
  93. {{$isImage := (call $.IsImageFile .Name)}}
  94. <div class="panel-body file-body file-code code-view code-diff">
  95. {{if $isImage}}
  96. <div class="text-center">
  97. <img src="{{$.RawPath}}/{{.Name}}">
  98. </div>
  99. {{else}}
  100. <table>
  101. <tbody>
  102. {{range .Sections}}
  103. {{range .Lines}}
  104. <tr class="{{DiffLineTypeToStr .Type}}-code nl-1 ol-1">
  105. <td class="lines-num lines-num-old">
  106. <span rel="L1">{{if .LeftIdx}}{{.LeftIdx}}{{end}}</span>
  107. </td>
  108. <td class="lines-num lines-num-new">
  109. <span rel="L1">{{if .RightIdx}}{{.RightIdx}}{{end}}</span>
  110. </td>
  111. <td class="lines-code">
  112. <pre>{{ToUtf8 .Content}}</pre>
  113. </td>
  114. </tr>
  115. {{end}}
  116. {{end}}
  117. </tbody>
  118. </table>
  119. {{end}}
  120. </div>
  121. </div>
  122. <br>
  123. {{end}}
  124. {{end}}
  125. </div>
  126. </div>
  127. {{template "ng/base/footer" .}}