comments.jade 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. template(name="commentForm")
  2. .new-comment.js-new-comment(
  3. class="{{#if commentFormIsOpen}}is-open{{/if}}")
  4. +userAvatar(userId=currentUser._id noRemove=true)
  5. form.js-new-comment-form
  6. +editor(class="js-new-comment-input")
  7. | {{getUnsavedValue 'cardComment' currentCard._id}}
  8. .add-controls
  9. button.primary.confirm.clear.js-add-comment(type="submit") {{_ 'comment'}}
  10. template(name="comments")
  11. .comments
  12. each commentData in getComments
  13. +comment(commentData)
  14. template(name="comment")
  15. .comment
  16. +userAvatar(userId=userId)
  17. p.comment-desc
  18. span.comment-member
  19. +memberName(user=user)
  20. +inlinedForm(classNames='js-edit-comment')
  21. +editor(autofocus=true)
  22. = text
  23. .edit-controls
  24. button.primary(type="submit") {{_ 'edit'}}
  25. .fa.fa-times-thin.js-close-inlined-form
  26. else
  27. .comment-text
  28. +viewer
  29. = text
  30. +commentReactions(reactions=reactions commentId=_id)
  31. span(title=createdAt).comment-meta {{ moment createdAt }}
  32. if($eq currentUser._id userId)
  33. +editOrDeleteComment
  34. else if currentUser.isBoardAdmin
  35. +editOrDeleteComment
  36. template(name="editOrDeleteComment")
  37. = ' - '
  38. a.js-open-inlined-form {{_ "edit"}}
  39. = ' - '
  40. a.js-delete-comment {{_ "delete"}}
  41. template(name="deleteCommentPopup")
  42. p {{_ "comment-delete"}}
  43. button.js-confirm.negate.full(type="submit") {{_ 'delete'}}
  44. template(name="commentReactions")
  45. .reactions
  46. each reaction in reactions
  47. span.reaction(class="{{#if isSelected reaction.userIds}}selected{{/if}}" data-codepoint="#{reaction.reactionCodepoint}" title="{{userNames reaction.userIds}}")
  48. span.reaction-codepoint !{reaction.reactionCodepoint}
  49. span.reaction-count #{reaction.userIds.length}
  50. if (currentUser.isBoardMember)
  51. a.open-comment-reaction-popup(title="{{_ 'addReactionPopup-title'}}")
  52. i.fa.fa-smile-o
  53. i.fa.fa-plus
  54. template(name="addReactionPopup")
  55. .reactions-popup
  56. each codepoint in codepoints
  57. span.add-comment-reaction(data-codepoint="#{codepoint}") !{codepoint}