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 = if can?(@conn, :manage, @comment) do
/ todo: link_to_ip / todo: link_to_ip
.communication__info .communication__info
=<> @comment.ip =<> link_to_ip(@comment.ip)
.communication__info .communication__info
=<> link_to_fingerprint(@comment.fingerprint) =<> link_to_fingerprint(@comment.fingerprint)
/- if can?(:hide, Comment) /- if can?(:hide, Comment)

View file

@ -50,8 +50,14 @@
div div
' Uploaded ' Uploaded
=> pretty_time(@image.created_at) => pretty_time(@image.created_at)
span.image_uploader
' by ' by
=> render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @image, awards: true, conn: @conn => 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 span.image-size
| &nbsp; | &nbsp;
= @image.image_width = @image.image_width

View file

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