Commit 13fec18a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Truncate some text from dashboard events

parent c9f741bb
...@@ -235,4 +235,11 @@ module ApplicationHelper ...@@ -235,4 +235,11 @@ module ApplicationHelper
"Search" "Search"
end end
end end
def first_line(str)
lines = str.split("\n")
line = lines.first
line += "..." if lines.size > 1
line
end
end end
...@@ -123,6 +123,8 @@ module EventsHelper ...@@ -123,6 +123,8 @@ module EventsHelper
end end
def event_note(text) def event_note(text)
sanitize(markdown(truncate(text, length: 150)), tags: %w(a img b pre p)) text = first_line(text)
text = truncate(text, length: 150)
sanitize(markdown(text), tags: %w(a img b pre p))
end end
end end
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
%strong= event.ref_name %strong= event.ref_name
- else - else
= link_to project_commits_path(event.project, event.ref_name) do = link_to project_commits_path(event.project, event.ref_name) do
%strong= event.ref_name %strong= truncate(event.ref_name, length: 30)
at at
%strong= link_to_project event.project %strong= link_to_project event.project
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment