Retrospring/app/views/shared/_comments.html.haml

34 lines
1.6 KiB
Plaintext

- if a.comments.all.count == 0
There are no comments yet.
- else
%ul.comments
- a.comments.order(:created_at).each do |comment|
%li{data: { comment_id: comment.id }}
.media.comments--media
.pull-left
%img.img-rounded.answerbox--img{src: gravatar_url(comment.user)}
.media-body.comments--body
%h6.media-heading.answerbox--question-user= user_screen_name comment.user
- if user_signed_in?
.pull-right
.btn-group
%button.btn.btn-link.btn-sm.dropdown-toggle{data: { toggle: :dropdown }, aria: { expanded: :false }}
%span.caret
%ul.dropdown-menu.dropdown-menu-right{role: :menu}
- if privileged?(comment.user) or privileged?(a.user)
%li.text-danger
%a{href: '#', data: { action: 'ab-comment-destroy', c_id: comment.id }}
%i.fa.fa-trash-o
Delete
- unless comment.user == current_user
%li
%a{href: '#', data: { action: 'ab-comment-report', c_id: comment.id }}
%i.fa.fa-exclamation-triangle
Report
.comments--content
= markdown comment.content
- if user_signed_in?
.form-group.has-feedback{name: 'ab-comment-new-group', data: { a_id: a.id }}
%input.form-control.comments--box{type: :text, placeholder: 'Comment...', name: 'ab-comment-new', data: {a_id: a.id }}
%span.text-muted.form-control-feedback.comments--count{id: "ab-comment-charcount-#{a.id}"} 160