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 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {{$file := .file}}
  2. {{range $j, $section := $file.Sections}}
  3. {{range $k, $line := $section.Lines}}
  4. <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
  5. {{if eq .GetType 4}}
  6. <td colspan="2" class="lines-num">
  7. {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
  8. <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>
  9. {{end}}
  10. {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
  11. <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>
  12. {{end}}
  13. {{if eq $line.GetExpandDirection 2}}
  14. <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>
  15. {{end}}
  16. </td>
  17. {{else}}
  18. <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>
  19. <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>
  20. {{end}}
  21. <td class="lines-type-marker"><span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td>
  22. {{if eq .GetType 4}}
  23. <td class="chroma lines-code blob-hunk"><span class="mono wrap">{{$section.GetComputedInlineDiffFor $line}}</span></td>
  24. {{else}}
  25. <td class="chroma 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">{{$section.GetComputedInlineDiffFor $line}}</span></td>
  26. {{end}}
  27. </tr>
  28. {{if gt (len $line.Comments) 0}}
  29. {{$resolved := (index $line.Comments 0).IsResolved}}
  30. {{$resolveDoer := (index $line.Comments 0).ResolveDoer}}
  31. {{$isNotPending := (not (eq (index $line.Comments 0).Review.Type 0))}}
  32. <tr>
  33. <td colspan="2" class="lines-num"></td>
  34. <td class="add-comment-left add-comment-right" colspan="2">
  35. {{if $resolved}}
  36. <div class = "ui attached header">
  37. <span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.root.i18n.Tr "repo.issues.review.resolved_by"}}</span>
  38. <button id="show-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="ui compact right labeled button show-outdated">
  39. {{svg "octicon-unfold" 16}}
  40. {{$.root.i18n.Tr "repo.issues.review.show_resolved"}}
  41. </button>
  42. <button id="hide-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="hide ui compact right labeled button hide-outdated">
  43. {{svg "octicon-fold" 16}}
  44. {{$.root.i18n.Tr "repo.issues.review.hide_resolved"}}
  45. </button>
  46. </div>
  47. {{end}}
  48. <div id="code-comments-{{(index $line.Comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}hide{{end}}">
  49. <div class="comment-list">
  50. <ui class="ui comments">
  51. {{ template "repo/diff/comments" dict "root" $.root "comments" $line.Comments}}
  52. </ui>
  53. </div>
  54. {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $line.Comments 0).ReviewID "root" $.root "comment" (index $line.Comments 0)}}
  55. {{if and $.root.CanMarkConversation $isNotPending}}
  56. <button class="ui icon tiny button resolve-conversation" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $line.Comments 0).ID}}" data-update-url="{{$.root.RepoLink}}/issues/resolve_conversation" >
  57. {{if $resolved}}
  58. {{$.root.i18n.Tr "repo.issues.review.un_resolve_conversation"}}
  59. {{else}}
  60. {{$.root.i18n.Tr "repo.issues.review.resolve_conversation"}}
  61. {{end}}
  62. </button>
  63. {{end}}
  64. </div>
  65. </td>
  66. </tr>
  67. {{end}}
  68. {{end}}
  69. {{end}}