mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-01 07:18:00 +01:00
110 lines
5.1 KiB
Text
110 lines
5.1 KiB
Text
<article class="block communication" id={"post_#{@post.id}"}>
|
|
<%= if not @post.approved and not @post.hidden_from_users and (can?(@conn, :hide, @post) or @post.user_id == @conn.assigns.current_user.id) do %>
|
|
<div class="block__content">
|
|
<div class="block block--fixed block--danger">
|
|
<p>
|
|
<i class="fas fa-exclamation-triangle"></i>
|
|
This post is pending approval from a staff member.
|
|
</p>
|
|
<%= if can?(@conn, :approve, @post) do %>
|
|
<p>
|
|
<ul class="horizontal-list">
|
|
<li>
|
|
<%= link(to: ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/approve", data: [confirm: "Are you sure?"], method: "post", class: "button") do %>
|
|
<i class="fas fa-check"></i>
|
|
Approve
|
|
<% end %>
|
|
</li>
|
|
<li>
|
|
<a class="button togglable-delete-form-link" data-click-toggle={"#inline-reject-form-post-#{@post.id}"} href="#">
|
|
<i class="fa fa-times"></i>
|
|
Reject
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
<%= form_for :post, ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/hide", [class: "togglable-delete-form hidden flex", id: "inline-reject-form-post-#{@post.id}"], fn f -> %>
|
|
<%= text_input(f, :deletion_reason, class: "input input--wide", placeholder: "Deletion Reason", id: "inline-reject-reason-post-#{@post.id}", required: true) %>
|
|
<%= submit("Delete", class: "button") %>
|
|
<% end %>
|
|
</p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<div class={"block__content flex flex--no-wrap #{communication_body_class(@post)}"}>
|
|
<div class="flex__fixed spacing-right">
|
|
<%= render(PhilomenaWeb.UserAttributionView, "_anon_user_avatar.html", object: @post, conn: @conn) %>
|
|
</div>
|
|
<div class="flex__grow communication__body">
|
|
<span class="communication__body__sender-name">
|
|
<%= render(PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @post, awards: true, conn: @conn) %>
|
|
</span>
|
|
<br />
|
|
<%= render(PhilomenaWeb.UserAttributionView, "_anon_user_title.html", object: @post, conn: @conn) %>
|
|
<div class="communication__body__text">
|
|
<%= if @post.hidden_from_users do %>
|
|
<strong class="comment_deleted">
|
|
Deletion reason:
|
|
<%= @post.deletion_reason %>
|
|
<%= if can?(@conn, :hide, @post) and not is_nil(@post.deleted_by) do %>
|
|
(
|
|
<%= @post.deleted_by.name %>
|
|
)
|
|
<% end %>
|
|
</strong>
|
|
<%= if can?(@conn, :hide, @post) do %>
|
|
<%= if @post.destroyed_content do %>
|
|
<br />
|
|
<strong class="comment_deleted">
|
|
This post's contents have been destroyed.
|
|
</strong>
|
|
<% else %>
|
|
<br />
|
|
<%= @body %>
|
|
<% end %>
|
|
<% end %>
|
|
<% else %>
|
|
<%= @body %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="block__content communication__options">
|
|
<div class="flex flex--wrap flex--spaced-out">
|
|
<%= render(PhilomenaWeb.PostView, "_post_options.html", conn: @conn, post: @post) %>
|
|
</div>
|
|
<%= if can?(@conn, :hide, @post) and not hide_staff_tools?(@conn) do %>
|
|
<%= cond do %>
|
|
<% @post.hidden_from_users and not @post.destroyed_content -> %>
|
|
<%= link(to: ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/hide", data: [confirm: "Are you sure?"], method: "delete", class: "communication__interaction") do %>
|
|
<i class="fas fa-check"></i>
|
|
Restore
|
|
<%= if can?(@conn, :delete, @post) do %>
|
|
<%= link(to: ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/delete", data: [confirm: "Are you sure?"], method: "post", class: "communication__interaction") do %>
|
|
<i class="fas fa-times"></i>
|
|
Delete Contents
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
<% not @post.hidden_from_users and not @post.destroyed_content -> %>
|
|
<a class="communication__interaction togglable-delete-form-link" data-click-toggle={"#inline-del-form-post-#{@post.id}"} href="#">
|
|
<i class="fa fa-times"></i>
|
|
Delete
|
|
</a>
|
|
<% true -> %>
|
|
<% end %>
|
|
<%= if can?(@conn, :show, :ip_address) do %>
|
|
<div class="communication__info">
|
|
<%= link_to_ip(@conn, @post.ip) %>
|
|
</div>
|
|
<div class="communication__info">
|
|
<%= link_to_fingerprint(@conn, @post.fingerprint) %>
|
|
</div>
|
|
<% end %>
|
|
<%= form_for :post, ~p"/forums/#{@post.topic.forum}/topics/#{@post.topic}/posts/#{@post}/hide", [class: "togglable-delete-form hidden flex", id: "inline-del-form-post-#{@post.id}"], fn f -> %>
|
|
<%= text_input(f, :deletion_reason, class: "input input--wide", placeholder: "Deletion Reason", id: "inline-del-reason-post-#{@post.id}", required: true) %>
|
|
<%= submit("Delete", class: "button") %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</article>
|