gitea源码

conversation.tmpl 3.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {{if len .comments}}
  2. {{$comment := index .comments 0}}
  3. {{$resolved := $comment.IsResolved}}
  4. {{$invalid := $comment.Invalidated}}
  5. {{$resolveDoer := $comment.ResolveDoer}}
  6. {{$hasReview := and $comment.Review}}
  7. {{$isReviewPending := and $hasReview (eq $comment.Review.Type 0)}}
  8. {{$referenceUrl := printf "%s#%s" $.Issue.Link $comment.HashTag}}
  9. <div class="conversation-holder" data-path="{{$comment.TreePath}}" data-side="{{if lt $comment.Line 0}}left{{else}}right{{end}}" data-idx="{{$comment.UnsignedLine}}">
  10. {{if $resolved}}
  11. <div class="resolved-placeholder">
  12. <div class="flex-text-block tw-flex-wrap grey text">
  13. {{svg "octicon-check"}}
  14. <b>{{$resolveDoer.Name}}</b> {{ctx.Locale.Tr "repo.issues.review.resolved_by"}}
  15. {{if $invalid}}
  16. <!--
  17. We only handle the case $resolved=true and $invalid=true in this template because if the comment is not resolved it has the outdated label in the comments area (not the header above).
  18. The case $resolved=false and $invalid=true is handled in repo/diff/comments.tmpl
  19. -->
  20. <a href="{{$referenceUrl}}" class="ui label basic small tw-ml-2" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
  21. {{ctx.Locale.Tr "repo.issues.review.outdated"}}
  22. </a>
  23. {{end}}
  24. </div>
  25. <div class="flex-text-block">
  26. <button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="btn tiny show-outdated">
  27. {{svg "octicon-unfold" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.issues.review.show_resolved"}}
  28. </button>
  29. <button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="btn tiny hide-outdated tw-hidden">
  30. {{svg "octicon-fold" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.issues.review.hide_resolved"}}
  31. </button>
  32. </div>
  33. </div>
  34. {{end}}
  35. <div id="code-comments-{{$comment.ID}}" class="field comment-code-cloud {{if $resolved}}tw-hidden{{end}}">
  36. <div class="comment-list">
  37. <div class="ui comments">
  38. {{template "repo/diff/comments" dict "root" $ "comments" .comments}}
  39. </div>
  40. </div>
  41. <div class="flex-text-block tw-mt-2 tw-flex-wrap tw-justify-end">
  42. <div class="ui buttons">
  43. <button class="ui icon tiny basic button previous-conversation">
  44. {{svg "octicon-arrow-up" 12}} {{ctx.Locale.Tr "repo.issues.previous"}}
  45. </button>
  46. <button class="ui icon tiny basic button next-conversation">
  47. {{svg "octicon-arrow-down" 12}} {{ctx.Locale.Tr "repo.issues.next"}}
  48. </button>
  49. </div>
  50. {{if and $.CanMarkConversation $hasReview (not $isReviewPending)}}
  51. <button class="ui icon tiny basic button resolve-conversation" data-origin="diff" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$comment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation">
  52. {{if $resolved}}
  53. {{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}}
  54. {{else}}
  55. {{ctx.Locale.Tr "repo.issues.review.resolve_conversation"}}
  56. {{end}}
  57. </button>
  58. {{end}}
  59. {{if and $.SignedUserID (not $.Repository.IsArchived)}}
  60. <button class="comment-form-reply ui primary icon tiny button">
  61. {{svg "octicon-reply" 12}}{{ctx.Locale.Tr "repo.diff.comment.reply"}}
  62. </button>
  63. {{end}}
  64. </div>
  65. {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" $comment.ReviewID "root" $ "comment" $comment}}
  66. </div>
  67. </div>
  68. {{else}}
  69. {{template "repo/diff/conversation_outdated"}}
  70. {{end}}