Improve html tree component

This commit is contained in:
Thelonius Kort
2023-05-03 22:37:43 +02:00
parent 7990b74bf0
commit 8a0e2f22c1
3 changed files with 18 additions and 4 deletions

View File

@ -18,4 +18,13 @@ defmodule OutlookWeb.ViewHelpers do
def strip_links(html) do
raise "Yet to be implemented!"
end
def elipsed_text(text, length) do
if String.length(text) < length do
text
else
part_length = (length - 3) / 2 |> trunc()
"#{String.slice(text, 0..part_length)}#{String.slice(text, -part_length..-1)}"
end
end
end