2020-05-10 05:22:04 -07:00
|
|
|
- if a.comments.all.count.zero?
|
2022-01-29 12:28:24 -08:00
|
|
|
= t "views.answerbox.no_comment"
|
2014-12-09 06:32:29 -08:00
|
|
|
- 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-10 05:22:04 -07:00
|
|
|
%li.comment{ data: { comment_id: comment.id } }
|
2022-01-29 12:28:24 -08:00
|
|
|
%div{ 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
|
2022-07-23 03:06:05 -07:00
|
|
|
%a{ href: user_path(comment.user) }
|
2022-01-29 12:16:47 -08:00
|
|
|
%img.comment__user-avatar.avatar-sm{ src: comment.user.profile_picture.url(:medium) }
|
2020-05-02 12:23:04 -07:00
|
|
|
.media-body
|
|
|
|
%h6.media-heading.comment__user
|
2015-05-16 20:36:23 -07:00
|
|
|
= user_screen_name comment.user
|
2020-05-10 05:22:04 -07:00
|
|
|
%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
|
2020-11-16 09:18:42 -08:00
|
|
|
- if !user_signed_in? && comment.smile_count.positive?
|
2022-01-29 12:28:24 -08:00
|
|
|
%button.btn.btn-link.answerbox__action{ name: "ab-smile-comment", disabled: true }
|
2022-02-01 14:58:41 -08:00
|
|
|
%i.fa.fa-fw.fa-smile-o
|
2020-11-16 09:18:42 -08:00
|
|
|
%span{ id: "ab-comment-smile-count-#{comment.id}" }= comment.smile_count
|
2020-05-02 12:23:04 -07:00
|
|
|
- if user_signed_in?
|
2022-02-27 06:43:19 -08:00
|
|
|
- if current_user.smiled? comment
|
2022-01-29 12:28:24 -08:00
|
|
|
%button.btn.btn-link.answerbox__action{ type: :button, name: "ab-smile-comment", data: { c_id: comment.id, action: :unsmile } }
|
2020-05-02 12:23:04 -07:00
|
|
|
%i.fa.fa-fw.fa-frown-o
|
2020-05-10 05:22:04 -07:00
|
|
|
%span{ id: "ab-comment-smile-count-#{comment.id}" }= comment.smile_count
|
2020-05-02 12:23:04 -07:00
|
|
|
- else
|
2022-01-29 12:28:24 -08:00
|
|
|
%button.btn.btn-link.answerbox__action{ type: :button, name: "ab-smile-comment", data: { c_id: comment.id, action: :smile } }
|
2020-05-02 12:23:04 -07:00
|
|
|
%i.fa.fa-fw.fa-smile-o
|
2020-05-10 05:22:04 -07:00
|
|
|
%span{ id: "ab-comment-smile-count-#{comment.id}" }= comment.smile_count
|
2020-05-02 12:23:04 -07:00
|
|
|
.btn-group
|
2020-05-10 05:22:04 -07:00
|
|
|
%button.btn.btn-link.btn-sm.dropdown-toggle{ data: { toggle: :dropdown }, aria: { expanded: false } }
|
2020-05-02 12:23:04 -07:00
|
|
|
%span.caret
|
2020-05-10 05:22:04 -07:00
|
|
|
.dropdown-menu.dropdown-menu-right{ role: :menu }
|
2022-02-01 14:57:57 -08:00
|
|
|
%a.dropdown-item{ href: "#", data: { target: "#modal-view-comment#{comment.id}-smiles", toggle: :modal } }
|
2022-02-01 14:58:41 -08:00
|
|
|
%i.fa.fa-fw.fa-smile-o
|
2022-07-30 09:50:46 -07:00
|
|
|
= t(".actions.view_smiles")
|
2020-05-10 05:22:04 -07:00
|
|
|
- if privileged?(comment.user) || privileged?(a.user)
|
2022-01-29 12:28:24 -08:00
|
|
|
%a.dropdown-item.text-danger{ href: "#", data: { action: "ab-comment-destroy", c_id: comment.id } }
|
2022-02-01 14:58:41 -08:00
|
|
|
%i.fa.fa-fw.fa-trash-o
|
2022-07-30 09:50:46 -07:00
|
|
|
= t("voc.delete")
|
2020-05-02 12:23:04 -07:00
|
|
|
- unless comment.user == current_user
|
2022-01-29 12:28:24 -08:00
|
|
|
%a.dropdown-item{ href: "#", data: { action: "ab-comment-report", c_id: comment.id } }
|
2022-02-01 14:58:41 -08:00
|
|
|
%i.fa.fa-fw.fa-exclamation-triangle
|
2022-07-30 09:50:46 -07:00
|
|
|
= t("voc.report")
|
2014-12-05 11:17:44 -08:00
|
|
|
- if user_signed_in?
|
2022-01-29 12:28:24 -08: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 } }
|
2020-05-10 05:22:04 -07:00
|
|
|
%span.text-muted.form-control-feedback.comment__character-count{ id: "ab-comment-charcount-#{a.id}" } 160
|