THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

test
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.

79 lines
4.6KB

  1. @**
  2. * Yona, 21st Century Project Hosting SW
  3. *
  4. * Copyright Yona & Yobi Authors & NAVER Corp. & NAVER LABS Corp.
  5. * https://yona.io
  6. **@
  7. @(project:Project, post:Posting)
  8. @import org.apache.commons.lang3.StringUtils
  9. @import utils.TemplateHelper._
  10. @import utils.AccessControl._
  11. @import utils.JodaDateUtil
  12. @import play.libs.Json.toJson
  13. @import utils.Markdown
  14. @import controllers.api.IssueApi
  15. @import models.enumeration.ResourceType
  16. @isAuthorComment(commentId: String) = @{
  17. if(commentId == UserApp.currentUser().loginId) {"author"}
  18. }
  19. <div class="comment-header"><i class="yobicon-comments"></i> <strong>@Messages("common.comment")</strong> <strong class="num">@post.comments.size</strong></div>
  20. <hr class="nm" />
  21. <ul class="comments">
  22. @for(comment <-post.comments){
  23. @defining(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.UPDATE)) { isAllowedUpdate =>
  24. @if(comment.getParentComment == null){
  25. <li class="comment @isAuthorComment(comment.authorLoginId)" id="comment-@comment.id">
  26. @common.childCommentsAnchorDiv(post, comment)
  27. <div class="comment-avatar">
  28. <a href="@routes.UserApp.userInfo(comment.authorLoginId)" class="avatar-wrap" data-toggle="tooltip" data-placement="top" title="@comment.authorName">
  29. <img src="@User.findByLoginId(comment.authorLoginId).avatarUrl(64)" width="32" height="32" alt="@comment.authorLoginId">
  30. </a>
  31. </div>
  32. <div class="media-body">
  33. <div class="meta-info">
  34. <span class="comment_author">
  35. <span class="resp-comment-avatar">
  36. <a href="@userInfo(comment.authorLoginId)" class="avatar-wrap" data-toggle="tooltip" data-placement="top" title="@comment.authorName">
  37. <img src="@User.findByLoginId(comment.authorLoginId).avatarUrl(64)" width="32" height="32" alt="@comment.authorName">
  38. </a>
  39. </span>
  40. <a href="@routes.UserApp.userInfo(comment.authorLoginId)" data-toggle="tooltip" data-placement="top" title="@comment.authorLoginId"><strong>@comment.authorName</strong></a>
  41. </span>
  42. <span class="ago-date">
  43. <a href="#comment-@comment.id" class="ago" title="@JodaDateUtil.getDateString(comment.createdDate)">@utils.TemplateHelper.agoOrDateString(comment.createdDate)</a>
  44. </span>
  45. <span class="act-row pull-right">
  46. @if(StringUtils.isNotBlank(IssueApi.TRANSLATION_API)){
  47. <button type="button" class="icon btn-transparent ml10 comment-translate" data-toggle="tooltip" data-comment-id="@comment.id" title="@Messages("button.translation")"><i class="yobicon-lang"></i></button>
  48. }
  49. @if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.READ)) {
  50. <button type="button" class="btn-transparent ml10" data-toggle="comment-edit" data-comment-id="@comment.id" title="@Messages("common.comment.edit")"><i class="yobicon-edit-2"></i></button>
  51. }
  52. @if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.DELETE)) {
  53. <button type="button" class="btn-transparent ml6" data-toggle="comment-delete" data-request-uri="@routes.BoardApp.deleteComment(project.owner, project.name, post.getNumber, comment.id)" title="@Messages("common.comment.delete")"><i class="yobicon-trash"></i></button>
  54. }
  55. </span>
  56. </div>
  57. @common.commentUpdateForm(comment, routes.BoardApp.newComment(project.owner, project.name, post.getNumber).toString(), comment.contents, isAllowedUpdate)
  58. <div id="comment-body-@comment.id">
  59. @common.tasklistBar()
  60. <div class="comment-body markdown-wrap" data-via-email="@OriginalEmail.exists(comment.asResource)" data-allowed-update="@isAllowedUpdate" >@Html(Markdown.render(comment.contents, project))</div>
  61. <div class="attachments pull-right" data-attachments="@toJson(AttachmentApp.getFileList(ResourceType.NONISSUE_COMMENT.toString(), comment.id.toString()))"></div>
  62. </div>
  63. </div>
  64. @common.childComments(post, comment, ResourceType.NONISSUE_COMMENT)
  65. </li>
  66. }
  67. }
  68. }
  69. </ul>