Retrospring/app/views/answerbox/_comments.haml

53 lines
3.1 KiB
Plaintext
Raw Normal View History

2014-12-05 11:17:44 -08:00
- if a.comments.all.count == 0
2015-05-26 18:53:53 -07:00
= t 'views.answerbox.no_comment'
- else
2020-05-02 12:23:04 -07:00
%ul.comment__container
2015-04-22 09:19:14 -07:00
- a.comments.order(:created_at).each do |comment|
2020-05-02 12:23:04 -07:00
%li.comment{data: { comment_id: comment.id }}
%div{class: "ab-comment-smile-list", style: "height: 0; width: 0"}= render "modal/comment_smiles", comment: comment
2020-05-02 12:23:04 -07:00
.media
2014-12-27 06:12:57 -08:00
.pull-left
2020-05-02 12:23:04 -07:00
%img.comment__user-avatar.avatar-md{src: comment.user.profile_picture.url(:medium)}
.media-body
%h6.media-heading.comment__user
2015-05-16 20:36:23 -07:00
= user_screen_name comment.user
%span.text-muted{title: comment.created_at, data: { toggle: :tooltip, placement: :right }}
= "#{time_ago_in_words(comment.created_at)} ago"
2020-05-02 12:23:04 -07:00
.comment__content
= markdown comment.content
.pull-right
%span.d-none.d-sm-inline.text-muted
- unless user_signed_in?
- if comment.smile_count > 0
%button.btn.btn-link.answerbox__action{name: 'ab-smile-comment', disabled: true}
%i.fa.fa-smile-o
%span{id: "ab-comment-smile-count-#{comment.id}"}= comment.smile_count
2020-05-02 12:23:04 -07:00
- if user_signed_in?
- if current_user.smiled_comment? comment
%button.btn.btn-link.answerbox__action{type: :button, name: 'ab-smile-comment', data: { c_id: comment.id, action: :unsmile }}
%i.fa.fa-fw.fa-frown-o
%span{id: "ab-comment-smile-count-#{comment.id}"}= comment.smile_count
- else
%button.btn.btn-link.answerbox__action{type: :button, name: 'ab-smile-comment', data: { c_id: comment.id, action: :smile }}
%i.fa.fa-fw.fa-smile-o
%span{id: "ab-comment-smile-count-#{comment.id}"}= comment.smile_count
.btn-group
%button.btn.btn-link.btn-sm.dropdown-toggle{data: { toggle: :dropdown }, aria: { expanded: :false }}
%span.caret
.dropdown-menu.dropdown-menu-right{role: :menu}
%a.dropdown-item{href: '#', type: :button, data: { target: "#modal-view-comment#{comment.id}-smiles", toggle: :modal}}
%i.fa.fa-smile-o
= t 'views.actions.view'
- if privileged?(comment.user) or privileged?(a.user)
%a.dropdown-item.text-danger{href: '#', data: { action: 'ab-comment-destroy', c_id: comment.id }}
%i.fa.fa-trash-o
= t 'views.actions.delete'
- unless comment.user == current_user
%a.dropdown-item{href: '#', data: { action: 'ab-comment-report', c_id: comment.id }}
%i.fa.fa-exclamation-triangle
= t 'views.acions.report'
2014-12-05 11:17:44 -08:00
- if user_signed_in?
2020-05-02 12:23:04 -07:00
.form-group.has-feedback.comment__input-group{name: 'ab-comment-new-group', data: { a_id: a.id }}
%input.form-control.comment__input{type: :text, placeholder: t('views.placeholder.comment'), name: 'ab-comment-new', data: {a_id: a.id }}
%span.text-muted.form-control-feedback.comment__character-count{id: "ab-comment-charcount-#{a.id}"} 160