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.

section_unified.tmpl 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. {{$file := .file}}
  2. {{$highlightClass := $file.GetHighlightClass}}
  3. {{range $j, $section := $file.Sections}}
  4. {{range $k, $line := $section.Lines}}
  5. <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
  6. {{if eq .GetType 4}}
  7. <td colspan="2" class="lines-num">
  8. {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
  9. <i class="ui blob-excerpt fa fa-caret-down" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"></i>
  10. {{end}}
  11. {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
  12. <i class="ui blob-excerpt fa fa-caret-up" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=up" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}"></i>
  13. {{end}}
  14. {{if or (eq $line.GetExpandDirection 2)}}
  15. <span class="ui blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">{{svg "octicon-fold" 16}}</span>
  16. {{end}}
  17. </td>
  18. {{else}}
  19. <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}"></span></td>
  20. <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}"></span></td>
  21. {{end}}
  22. <td class="lines-type-marker"><span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td>
  23. <td class="lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}">{{if and $.root.SignedUserID $line.CanComment $.root.PageIsPullFiles}}<a class="ui green button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}" data-path="{{$file.Name}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">+</a>{{end}}<span class="mono wrap{{if $highlightClass}} language-{{$highlightClass}}{{else}} nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</span></td>
  24. </tr>
  25. {{if gt (len $line.Comments) 0}}
  26. <tr>
  27. <td colspan="2" class="lines-num"></td>
  28. <td class="lines-type-marker"></td>
  29. <td class="add-comment-left add-comment-right">
  30. <div class="field comment-code-cloud">
  31. <div class="comment-list">
  32. <ui class="ui comments">
  33. {{ template "repo/diff/comments" dict "root" $.root "comments" $line.Comments}}
  34. </ui>
  35. </div>
  36. {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $line.Comments 0).ReviewID "root" $.root "comment" (index $line.Comments 0)}}
  37. </div>
  38. </td>
  39. </tr>
  40. {{end}}
  41. {{end}}
  42. {{end}}