ip/fp info on images

This commit is contained in:
Luna D 2019-12-05 15:25:37 -05:00
parent 76dce674ea
commit 621c6587d8
No known key found for this signature in database
GPG key ID: D0F46C94720BAA4B
3 changed files with 16 additions and 13 deletions

View file

@ -25,7 +25,7 @@ article.block.communication id="comment_#{@comment.id}"
= if can?(@conn, :manage, @comment) do
/ todo: link_to_ip
.communication__info
=<> @comment.ip
=<> link_to_ip(@comment.ip)
.communication__info
=<> link_to_fingerprint(@comment.fingerprint)
/- if can?(:hide, Comment)

View file

@ -50,8 +50,14 @@
div
' Uploaded
=> pretty_time(@image.created_at)
span.image_uploader
' by
=> render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @image, awards: true, conn: @conn
= if can?(@conn, :manage, @image) do
=<> link_to_ip(@image.ip)
=<> link_to_fingerprint(@image.fingerprint)
a href="#"
i.fa.fa-edit
span.image-size
| &nbsp;
= @image.image_width

View file

@ -104,19 +104,16 @@ defmodule PhilomenaWeb.AppView do
|> to_string()
end
defp text_or_na(text), do: text
defp text_or_na(nil), do: "N/A"
# todo: make ip a real link
def link_to_ip(ip) do
if ip do
ip
else
"N/A"
end
link(text_or_na(ip), to: "#")
end
# todo: make fp a real link
def link_to_fingerprint(fp) do
if fp do
fp |> String.slice(0..6)
else
"N/A"
end
link(String.slice(text_or_na(fp), 0..6), to: "#")
end
end