mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 20:37:59 +01:00
65 lines
3.8 KiB
Text
65 lines
3.8 KiB
Text
- options = render PhilomenaWeb.CommentView, "_comment_link.html", comment: @comment, conn: @conn
|
|
- block_class = if @comment.hidden_from_users, do: "block--danger", else: ""
|
|
|
|
article.block.communication id="comment_#{@comment.id}" class=block_class
|
|
= if not @comment.approved and not @comment.hidden_from_users and (can?(@conn, :hide, @comment) or @comment.user_id == @conn.assigns.current_user.id) do
|
|
.block__content
|
|
.block.block--fixed.block--danger
|
|
p
|
|
i.fas.fa-exclamation-triangle>
|
|
' This comment is pending approval from a staff member.
|
|
= if can?(@conn, :approve, @comment) do
|
|
p
|
|
ul.horizontal-list
|
|
li
|
|
= link(to: ~p"/images/#{@comment.image_id}/comments/#{@comment}/approve", data: [confirm: "Are you sure?"], method: "post", class: "button") do
|
|
i.fas.fa-check>
|
|
' Approve
|
|
li
|
|
a.button.togglable-delete-form-link href="#" data-click-toggle="#inline-reject-form-comment-#{@comment.id}"
|
|
i.fa.fa-times>
|
|
' Reject
|
|
|
|
= form_for :comment, ~p"/images/#{@comment.image_id}/comments/#{@comment}/hide", [class: "togglable-delete-form hidden flex", id: "inline-reject-form-comment-#{@comment.id}"], fn f ->
|
|
= text_input f, :deletion_reason, class: "input input--wide", placeholder: "Deletion Reason", id: "inline-reject-reason-comment-#{@comment.id}", required: true
|
|
= submit "Delete", class: "button"
|
|
|
|
.block__content.flex.flex--no-wrap class=communication_body_class(@comment)
|
|
= render PhilomenaWeb.CommunicationView, "_body.html", object: @comment, body: @body, conn: @conn, name: "comment", options: options
|
|
|
|
= if not @comment.hidden_from_users or can?(@conn, :edit, @comment) do
|
|
.block__content.communication__options
|
|
.flex.flex--wrap.flex--spaced-out
|
|
= render PhilomenaWeb.CommentView, "_comment_options.html", comment: @comment, conn: @conn
|
|
|
|
= if can?(@conn, :hide, @comment) do
|
|
.flex__spacer
|
|
.js-staff-action
|
|
.communication__options__staff
|
|
= cond do
|
|
- @comment.hidden_from_users and not @comment.destroyed_content ->
|
|
= link(to: ~p"/images/#{@comment.image_id}/comments/#{@comment}/hide", data: [confirm: "Are you sure?"], method: "delete", class: "communication__interaction") do
|
|
i.fas.fa-check>
|
|
' Restore
|
|
|
|
= if can?(@conn, :delete, @comment) do
|
|
= link(to: ~p"/images/#{@comment.image_id}/comments/#{@comment}/delete", data: [confirm: "Are you sure?"], method: "post", class: "communication__interaction") do
|
|
i.fas.fa-times>
|
|
' Delete Contents
|
|
|
|
- not @comment.hidden_from_users and not @comment.destroyed_content ->
|
|
a.button.button--danger.button--transparent.togglable-delete-form-link href="#" data-click-toggle="#inline-del-form-comment-#{@comment.id}"
|
|
i.fas.fa-times>
|
|
' Delete
|
|
|
|
- true ->
|
|
|
|
= if can?(@conn, :show, :ip_address) do
|
|
.button.button--warning.button--transparent.js-staff-action
|
|
=<> link_to_ip(@conn, @comment.ip)
|
|
.button.button--warning.button--transparent.js-staff-action
|
|
=<> link_to_fingerprint(@conn, @comment.fingerprint)
|
|
|
|
= form_for :comment, ~p"/images/#{@comment.image_id}/comments/#{@comment}/hide", [class: "togglable-delete-form hidden flex", id: "inline-del-form-comment-#{@comment.id}"], fn f ->
|
|
= text_input f, :deletion_reason, class: "input input--wide", placeholder: "Deletion Reason", id: "inline-del-reason-comment-#{@comment.id}", required: true
|
|
= submit "Delete", class: "button"
|