You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
3.4 KiB

  1. {{if .DiffNotAvailable}}
  2. <h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4>
  3. {{else}}
  4. <div class="diff-detail-box diff-box">
  5. <div>
  6. <i class="fa fa-retweet"></i>
  7. {{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
  8. <div class="ui right">
  9. <a class="ui tiny basic black toggle button" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a>
  10. </div>
  11. </div>
  12. <ol class="detail-files hide" id="diff-files">
  13. {{range .Diff.Files}}
  14. <li>
  15. <div class="diff-counter count pull-right">
  16. {{if not .IsBin}}
  17. <span class="add" data-line="{{.Addition}}">{{.Addition}}</span>
  18. <span class="bar">
  19. <span class="pull-left add"></span>
  20. <span class="pull-left del"></span>
  21. </span>
  22. <span class="del" data-line="{{.Deletion}}">{{.Deletion}}</span>
  23. {{else}}
  24. <span>{{$.i18n.Tr "repo.diff.bin"}}</span>
  25. {{end}}
  26. </div>
  27. <!-- todo finish all file status, now modify, add, delete and rename -->
  28. <span class="status {{DiffTypeToStr .Type}} poping up" data-content="{{DiffTypeToStr .Type}}" data-variation="inverted tiny" data-position="right center">&nbsp;</span>
  29. <a class="file" href="#diff-{{.Index}}">{{.Name}}</a>
  30. </li>
  31. {{end}}
  32. </ol>
  33. </div>
  34. {{range $i, $file := .Diff.Files}}
  35. <div class="diff-file-box diff-box file-content" id="diff-{{.Index}}">
  36. <h4 class="ui top attached normal header">
  37. <div class="diff-counter count ui left">
  38. {{if not $file.IsBin}}
  39. <span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
  40. <span class="bar">
  41. <span class="pull-left add"></span>
  42. <span class="pull-left del"></span>
  43. </span>
  44. <span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>
  45. {{else}}
  46. {{$.i18n.Tr "repo.diff.bin"}}
  47. {{end}}
  48. </div>
  49. <span class="file">{{$file.Name}}</span>
  50. <div class="ui right">
  51. {{if $file.IsDeleted}}
  52. <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
  53. {{else}}
  54. <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
  55. {{end}}
  56. </div>
  57. </h4>
  58. <div class="ui attached table segment">
  59. {{$isImage := (call $.IsImageFile $file.Name)}}
  60. {{if $isImage}}
  61. <div class="center">
  62. <img src="{{$.RawPath}}/{{EscapePound .Name}}">
  63. </div>
  64. {{else}}
  65. <div class="file-body file-code code-view code-diff">
  66. <table>
  67. <tbody>
  68. {{range .Sections}}
  69. {{range $k, $line := .Lines}}
  70. <tr class="{{DiffLineTypeToStr .Type}}-code nl-{{$k}} ol-{{$k}}">
  71. <td class="lines-num lines-num-old">
  72. <span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span>
  73. </td>
  74. <td class="lines-num lines-num-new">
  75. <span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
  76. </td>
  77. <td class="lines-code">
  78. <pre>{{$line.Content}}</pre>
  79. </td>
  80. </tr>
  81. {{end}}
  82. {{end}}
  83. </tbody>
  84. </table>
  85. </div>
  86. {{end}}
  87. </div>
  88. </div>
  89. <br>
  90. {{end}}
  91. {{end}}