diff --git a/lib/philomena_web/templates/comment/_comment.html.slime b/lib/philomena_web/templates/comment/_comment.html.slime index ced8c1fb..bf84bec3 100644 --- a/lib/philomena_web/templates/comment/_comment.html.slime +++ b/lib/philomena_web/templates/comment/_comment.html.slime @@ -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) diff --git a/lib/philomena_web/templates/image/_image_meta.html.slime b/lib/philomena_web/templates/image/_image_meta.html.slime index 59f0875f..20d1fe37 100644 --- a/lib/philomena_web/templates/image/_image_meta.html.slime +++ b/lib/philomena_web/templates/image/_image_meta.html.slime @@ -50,8 +50,14 @@ div ' Uploaded => pretty_time(@image.created_at) - ' by - => render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @image, awards: true, conn: @conn + 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 |   = @image.image_width diff --git a/lib/philomena_web/views/app_view.ex b/lib/philomena_web/views/app_view.ex index e204bd84..76fac213 100644 --- a/lib/philomena_web/views/app_view.ex +++ b/lib/philomena_web/views/app_view.ex @@ -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