aboutsummaryrefslogtreecommitdiff
path: root/lib/waev_web/views/exports_view.ex
diff options
context:
space:
mode:
authorGuillermo Ramos2020-02-11 17:41:13 +0100
committerGuillermo Ramos2020-02-11 17:41:13 +0100
commitc8961cafed719ae0e3113b1cc4bb1e5dac5d62d1 (patch)
treede5fc6d1c70cc2217da3671139f6a8d784ea5b73 /lib/waev_web/views/exports_view.ex
parenta4d1e9a81551dea9d8d57ba34b0f9bc7be6c9321 (diff)
downloadwaev-c8961cafed719ae0e3113b1cc4bb1e5dac5d62d1.tar.gz
Mix format
Diffstat (limited to 'lib/waev_web/views/exports_view.ex')
-rw-r--r--lib/waev_web/views/exports_view.ex30
1 files changed, 17 insertions, 13 deletions
diff --git a/lib/waev_web/views/exports_view.ex b/lib/waev_web/views/exports_view.ex
index 4fc9a9e..680454c 100644
--- a/lib/waev_web/views/exports_view.ex
+++ b/lib/waev_web/views/exports_view.ex
@@ -3,13 +3,13 @@ defmodule WaevWeb.ExportsView do
def party_peek(assigns, party) do
~E"""
-<div class="party-peek">
- <figure>
- <%= party_avatar(assigns, party, :big) %>
- <figcaption><%= party.name %></figcaption>
- </figure>
-</div>
-"""
+ <div class="party-peek">
+ <figure>
+ <%= party_avatar(assigns, party, :big) %>
+ <figcaption><%= party.name %></figcaption>
+ </figure>
+ </div>
+ """
end
def party_avatar(assigns, party, size) do
@@ -18,20 +18,24 @@ defmodule WaevWeb.ExportsView do
:tiny -> "avatar--tiny"
:big -> "avatar--big"
end
+
~E"""
-<img class="avatar <%= modifier %>" src="<%= Routes.exports_path(@conn, :get_avatar, @id, party.name) %>" />
-"""
+ <img class="avatar <%= modifier %>" src="<%= Routes.exports_path(@conn, :get_avatar, @id, party.name) %>" />
+ """
end
def highlight_urls(nil), do: ""
+
def highlight_urls(text) do
- url_re = ~r/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/
+ url_re =
+ ~r/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/
url_re
|> Regex.scan(text)
- |> Enum.reduce(text, fn [url|_], t ->
- String.replace(t, url, "<a target=\"_blank\" href=#{url}>#{url}</a>", global: false)
- |> raw()
+ |> Enum.reduce(text, fn [url | _], t ->
+ t
+ |> String.replace(url, "<a target=\"_blank\" href=#{url}>#{url}</a>", global: false)
+ |> raw()
end)
end
end