diff_box_unified.tmpl 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. {{range $i, $file := .Diff.Files}}
  2. <div class="diff-file-box diff-box file-content" id="diff-{{.Index}}">
  3. <h4 class="ui top attached normal header">
  4. <div class="diff-counter count ui left">
  5. {{if $file.IsBin}}
  6. {{$.i18n.Tr "repo.diff.bin"}}
  7. {{else if not $file.IsRenamed}}
  8. <span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
  9. <span class="bar">
  10. <span class="pull-left add"></span>
  11. <span class="pull-left del"></span>
  12. </span>
  13. <span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>
  14. {{end}}
  15. </div>
  16. <span class="file">{{if $file.IsRenamed}}{{$file.OldName}} &rarr; {{end}}{{$file.Name}}</span>
  17. <div class="ui right">
  18. {{if $file.IsDeleted}}
  19. <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
  20. {{else}}
  21. <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
  22. {{end}}
  23. </div>
  24. </h4>
  25. <div class="ui attached table segment">
  26. {{if not $file.IsRenamed}}
  27. {{$isImage := (call $.IsImageFile $file.Name)}}
  28. {{if and $isImage}}
  29. <div class="center">
  30. <img src="{{$.RawPath}}/{{EscapePound .Name}}">
  31. </div>
  32. {{else}}
  33. <div class="file-body file-code code-view code-diff">
  34. <table>
  35. <tbody>
  36. {{range $j, $section := .Sections}}
  37. {{range $k, $line := .Lines}}
  38. <tr class="{{DiffLineTypeToStr .Type}}-code nl-{{$k}} ol-{{$k}}">
  39. {{if eq .Type 4}}
  40. <td colspan="2" class="lines-num">
  41. {{if gt $j 0}}<span class="fold octicon octicon-fold"></span>{{end}}
  42. </td>
  43. {{else}}
  44. <td class="lines-num lines-num-old">
  45. <span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span>
  46. </td>
  47. <td class="lines-num lines-num-new">
  48. <span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
  49. </td>
  50. {{end}}
  51. <td class="lines-code">
  52. <pre>{{$line.Content}}</pre>
  53. </td>
  54. </tr>
  55. {{end}}
  56. {{end}}
  57. </tbody>
  58. </table>
  59. </div>
  60. {{end}}
  61. {{end}}
  62. </div>
  63. </div>
  64. <br>
  65. {{end}}