2022-03-24 17:31:57 +01:00
|
|
|
defmodule PhilomenaWeb.Admin.ApprovalView do
|
|
|
|
use PhilomenaWeb, :view
|
|
|
|
|
|
|
|
alias PhilomenaWeb.Admin.ReportView
|
|
|
|
|
2024-04-29 03:13:51 +02:00
|
|
|
def truncated_ip_link(ip), do: ReportView.truncated_ip_link(ip)
|
2022-03-24 17:31:57 +01:00
|
|
|
|
|
|
|
def image_thumb(conn, image) do
|
|
|
|
render(PhilomenaWeb.ImageView, "_image_container.html",
|
|
|
|
image: image,
|
|
|
|
size: :thumb_tiny,
|
|
|
|
conn: conn
|
|
|
|
)
|
|
|
|
end
|
2023-06-02 19:37:03 +02:00
|
|
|
|
|
|
|
def class_for_image(%{processed: false}), do: "block--warning"
|
|
|
|
def class_for_image(%{thumbnails_generated: false}), do: "block--warning"
|
|
|
|
|
|
|
|
def class_for_image(%{image_is_animated: a, image_duration: d, image_format: "png"})
|
|
|
|
when a or d > 0.04,
|
|
|
|
do: "block--danger"
|
|
|
|
|
|
|
|
def class_for_image(%{image_format: "svg"}), do: "block--warning"
|
|
|
|
def class_for_image(%{image_format: f}) when f in ["webm", "gif"], do: "block--danger"
|
|
|
|
def class_for_image(_), do: ""
|
|
|
|
|
|
|
|
def warning_text(%{processed: false}), do: "(not processed)"
|
|
|
|
def warning_text(%{thumbnails_generated: false}), do: "(not processed)"
|
|
|
|
|
|
|
|
def warning_text(%{image_is_animated: a, image_duration: d, image_format: "png"})
|
|
|
|
when a or d > 0.04,
|
|
|
|
do: "(animated png)"
|
|
|
|
|
|
|
|
def warning_text(%{image_format: "svg"}), do: "(svg)"
|
|
|
|
def warning_text(%{image_format: f}) when f in ["webm", "gif"], do: "(video)"
|
|
|
|
def warning_text(_), do: ""
|
2022-03-24 17:31:57 +01:00
|
|
|
end
|