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.

93 lines
3.6 KiB

9 years ago
9 years ago
  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 $file.IsBin}}
  39. {{$.i18n.Tr "repo.diff.bin"}}
  40. {{else if not $file.IsRenamed}}
  41. <span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
  42. <span class="bar">
  43. <span class="pull-left add"></span>
  44. <span class="pull-left del"></span>
  45. </span>
  46. <span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>
  47. {{end}}
  48. </div>
  49. <span class="file">{{if $file.IsRenamed}}{{$file.OldName}} &rarr; {{end}}{{$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. {{if not $file.IsRenamed}}
  60. {{$isImage := (call $.IsImageFile $file.Name)}}
  61. {{if and $isImage}}
  62. <div class="center">
  63. <img src="{{$.RawPath}}/{{EscapePound .Name}}">
  64. </div>
  65. {{else}}
  66. <div class="file-body file-code code-view code-diff">
  67. <table>
  68. <tbody>
  69. {{range .Sections}}
  70. {{range $k, $line := .Lines}}
  71. <tr class="{{DiffLineTypeToStr .Type}}-code nl-{{$k}} ol-{{$k}}">
  72. <td class="lines-num lines-num-old">
  73. <span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span>
  74. </td>
  75. <td class="lines-num lines-num-new">
  76. <span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
  77. </td>
  78. <td class="lines-code">
  79. <pre>{{$line.Content}}</pre>
  80. </td>
  81. </tr>
  82. {{end}}
  83. {{end}}
  84. </tbody>
  85. </table>
  86. </div>
  87. {{end}}
  88. {{end}}
  89. </div>
  90. </div>
  91. <br>
  92. {{end}}
  93. {{end}}