File tree 4 files changed +23
-6
lines changed
4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change 3
3
### Fixes and improvements
4
4
5
5
- Improve performance of presentation to load slides faster
6
+ - Fix manager layout on small screens
7
+ - Add clickable hyperlinks in messages
6
8
7
9
### v.2.3.0
8
10
Original file line number Diff line number Diff line change
1
+ defmodule ClaperWeb.Helpers do
2
+ def format_body ( body ) do
3
+ url_regex = ~r/ (https?:\/ \/ [^\s ]+)/
4
+
5
+ body
6
+ |> String . split ( url_regex , include_captures: true )
7
+ |> Enum . map ( fn
8
+ "http" <> _rest = url ->
9
+ Phoenix.HTML . raw (
10
+ ~s( <a href="#{ url } " target="_blank" class="cursor-pointer text-primary-500 hover:underline font-medium">#{ url } </a>)
11
+ )
12
+
13
+ text ->
14
+ text
15
+ end )
16
+ end
17
+ end
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ defmodule ClaperWeb.EventLive.ManageablePostComponent do
119
119
<% end %>
120
120
121
121
< p class = "text-xl " >
122
- <%= @ post . body %>
122
+ <%= ClaperWeb.Helpers . format_body ( @ post . body ) %>
123
123
</ p >
124
124
</ div >
125
125
</ div >
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ defmodule ClaperWeb.EventLive.PostComponent do
76
76
) %>
77
77
</ span >
78
78
</ div >
79
- < p > <%= @ post . body %> </ p >
79
+ < p > <%= ClaperWeb.Helpers . format_body ( @ post . body ) %> </ p >
80
80
81
81
< div class = "flex h-6 text-sm float-right text-white space-x-2 " >
82
82
<%= if @ post . like_count > 0 do %>
@@ -176,7 +176,7 @@ defmodule ClaperWeb.EventLive.PostComponent do
176
176
</ div >
177
177
<% end %>
178
178
179
- < p > <%= @ post . body %> </ p >
179
+ < p > <%= ClaperWeb.Helpers . format_body ( @ post . body ) %> </ p >
180
180
181
181
< div class = "flex h-6 text-xs float-right space-x-2 " >
182
182
<%= if @ reaction_enabled do %>
@@ -273,7 +273,5 @@ defmodule ClaperWeb.EventLive.PostComponent do
273
273
end ) )
274
274
end
275
275
276
- defp pinned? ( post ) do
277
- post . pinned == true
278
- end
276
+ defp pinned? ( post ) , do: post . pinned
279
277
end
You can’t perform that action at this time.
0 commit comments