Split actions from comments into separate partial

This commit is contained in:
Andreas Nedbal 2022-08-21 15:04:12 +02:00
parent 5562bd0de0
commit 2a2f1a9988
2 changed files with 13 additions and 12 deletions

View File

@ -0,0 +1,12 @@
.dropdown-menu.dropdown-menu-right{ role: :menu }
%a.dropdown-item{ href: "#", data: { target: "#modal-view-comment#{comment.id}-smiles", toggle: :modal } }
%i.fa.fa-fw.fa-smile-o
= t(".view_smiles")
- if privileged?(comment.user) || privileged?(answer.user)
%a.dropdown-item.text-danger{ href: "#", data: { action: "ab-comment-destroy", c_id: comment.id } }
%i.fa.fa-fw.fa-trash-o
= t("voc.delete")
- unless comment.user == current_user
%a.dropdown-item{ href: "#", data: { action: "ab-comment-report", c_id: comment.id } }
%i.fa.fa-fw.fa-exclamation-triangle
= t("voc.report")

View File

@ -34,18 +34,7 @@
.btn-group .btn-group
%button.btn.btn-link.btn-sm.dropdown-toggle{ data: { toggle: :dropdown }, aria: { expanded: false } } %button.btn.btn-link.btn-sm.dropdown-toggle{ data: { toggle: :dropdown }, aria: { expanded: false } }
%span.caret %span.caret
.dropdown-menu.dropdown-menu-right{ role: :menu } = render "actions/comment", comment: comment, answer: a
%a.dropdown-item{ href: "#", data: { target: "#modal-view-comment#{comment.id}-smiles", toggle: :modal } }
%i.fa.fa-fw.fa-smile-o
= t(".actions.view_smiles")
- if privileged?(comment.user) || privileged?(a.user)
%a.dropdown-item.text-danger{ href: "#", data: { action: "ab-comment-destroy", c_id: comment.id } }
%i.fa.fa-fw.fa-trash-o
= t("voc.delete")
- unless comment.user == current_user
%a.dropdown-item{ href: "#", data: { action: "ab-comment-report", c_id: comment.id } }
%i.fa.fa-fw.fa-exclamation-triangle
= t("voc.report")
- if user_signed_in? - if user_signed_in?
.form-group.has-feedback.comment__input-group{ name: "ab-comment-new-group", data: { a_id: a.id } } .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(".placeholder"), name: "ab-comment-new", data: { a_id: a.id } } %input.form-control.comment__input{ type: :text, placeholder: t(".placeholder"), name: "ab-comment-new", data: { a_id: a.id } }