2024-05-31 20:07:00 +02:00
- options = render PhilomenaWeb.CommentView, "_comment_link.html", comment: @comment, conn: @conn
2024-06-06 20:21:21 +02:00
- block_class = if @comment.hidden_from_users, do: "block--danger", else: ""
2024-05-31 20:07:00 +02:00
2024-06-06 20:21:21 +02:00
article.block.communication id="comment_#{@comment.id}" class=block_class
2022-03-22 22:23:30 +01:00
= 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
2024-06-06 22:28:35 +02:00
= link(to: ~p"/images/#{@comment.image_id}/comments/#{@comment}/approve", data: [confirm: "Are you sure?"], method: "post", class: "button") do
2022-03-22 22:23:30 +01:00
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
2024-06-06 22:28:35 +02:00
= 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 ->
2022-03-22 22:23:30 +01:00
= 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"
2019-12-12 00:58:00 +01:00
.block__content.flex.flex--no-wrap class=communication_body_class(@comment)
2024-05-31 20:07:00 +02:00
= render PhilomenaWeb.CommunicationView, "_body.html", object: @comment, body: @body, conn: @conn, name: "comment", options: options
2019-12-12 05:41:33 +01:00
2024-06-06 20:21:21 +02:00
= 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 ->
2024-06-06 22:28:35 +02:00
= link(to: ~p"/images/#{@comment.image_id}/comments/#{@comment}/hide", data: [confirm: "Are you sure?"], method: "delete", class: "communication__interaction") do
2024-06-06 20:21:21 +02:00
i.fas.fa-check>
' Restore
2024-05-07 22:52:17 +02:00
2024-06-06 20:21:21 +02:00
= if can?(@conn, :delete, @comment) do
2024-06-06 22:28:35 +02:00
= link(to: ~p"/images/#{@comment.image_id}/comments/#{@comment}/delete", data: [confirm: "Are you sure?"], method: "post", class: "communication__interaction") do
2024-06-06 20:21:21 +02:00
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
2019-12-12 05:41:33 +01:00
2024-06-06 20:21:21 +02:00
- true ->
2019-12-12 05:41:33 +01:00
2024-06-06 20:21:21 +02:00
= 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)
2019-12-12 05:41:33 +01:00
2024-06-06 22:28:35 +02:00
= 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 ->
2024-06-06 20:21:21 +02:00
= 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"