Improve html tree component
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user