From 0d5a41fd35d608594ca14df6f18960427bb569af Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 15 Jul 2024 11:59:02 -0400 Subject: [PATCH] [Enhancement] Render URL attributes as a link (#299) * Render URLs as links when listing items from a map * Applies suggestions from MR feedback --- lib/pinchflat_web/components/core_components.ex | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/pinchflat_web/components/core_components.ex b/lib/pinchflat_web/components/core_components.ex index 58f785ce..0bad772b 100644 --- a/lib/pinchflat_web/components/core_components.ex +++ b/lib/pinchflat_web/components/core_components.ex @@ -19,6 +19,7 @@ defmodule PinchflatWeb.CoreComponents do import PinchflatWeb.Gettext alias Phoenix.LiveView.JS + alias PinchflatWeb.CustomComponents.TextComponents @doc """ Renders a modal. @@ -644,7 +645,11 @@ defmodule PinchflatWeb.CoreComponents do
  • <%= k %>: - <%= v %> + <%= if is_binary(v) && URI.parse(v).scheme && URI.parse(v).scheme =~ "http" do %> + <%= v %> + <% else %> + <%= v %> + <% end %>