diff --git a/app/views/admin/comment/components/comment.pug b/app/views/admin/comment/components/comment.pug new file mode 100644 index 0000000..2b34262 --- /dev/null +++ b/app/views/admin/comment/components/comment.pug @@ -0,0 +1,50 @@ +mixin renderComment (comment) + article(data-comment-id= comment._id).uk-comment.dtp-site-comment + header.uk-comment-header + div(uk-grid).uk-grid-medium.uk-flex-middle + .uk-width-auto + if comment.author.picture && comment.author.picture.small + img(src= `/image/${comment.author.picture.small._id}`).site-profile-picture.sb-small.uk-comment-avatar + else + img(src="/img/default-member.png").site-profile-picture.sb-small.uk-comment-avatar + + .uk-width-expand + h4.uk-comment-title.uk-margin-remove= comment.author.displayName || comment.author.username + .uk-comment-meta= moment(comment.created).fromNow() + + .uk-comment-body + case comment.status + when 'published' + if comment.flags && comment.flags.isNSFW + div.uk-alert.uk-alert-info.uk-border-rounded + div(uk-grid).uk-grid-small.uk-text-small.uk-flex-middle + .uk-width-expand NSFW comment hidden by default. Use the eye to show/hide. + .uk-width-auto + button( + type="button", + uk-toggle={ target: `.comment-content[data-comment-id="${comment._id}"]` }, + title="Show/hide the comment text", + ).uk-button.uk-button-link + span + i.fas.fa-eye + .comment-content(data-comment-id= comment._id, hidden= comment.flags ? comment.flags.isNSFW : false)!= marked.parse(comment.content) + when 'removed' + .comment-content.uk-text-muted [comment removed] + when 'mod-warn' + alert + span A warning has been added to this comment. + button(type="button", uk-toggle={ target: `.comment-content[data-comment-id="${comment._id}"]` }) + .comment-content(data-comment-id= comment._id, hidden)!= marked.parse(comment.content) + when 'mod-removed' + .comment-content.uk-text-muted [comment removed] + + //- Comment meta bar + div(uk-grid).uk-grid-small + .uk-width-auto + +renderLabeledIcon('fa-chevron-up', formatCount(comment.resourceStats.upvoteCount)) + .uk-width-auto + +renderLabeledIcon('fa-chevron-down', formatCount(comment.resourceStats.downvoteCount)) + .uk-width-auto + +renderLabeledIcon('fa-comment', formatCount(comment.commentStats.replyCount)) + .uk-width-auto + +renderLabeledIcon('fa-reply', 'reply') \ No newline at end of file diff --git a/app/views/admin/index.pug b/app/views/admin/index.pug index 7d55400..1197b54 100644 --- a/app/views/admin/index.pug +++ b/app/views/admin/index.pug @@ -2,8 +2,9 @@ extends layouts/main block content include user/components/list-item + include comment/components/comment + include ../chat/components/message - include ../comment/components/comment div(uk-grid) div(class="uk-width-1-1 uk-width-auto@m")