mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-15 07:36:41 +10:00
Truncate some text from dashboard events
This commit is contained in:
@@ -235,4 +235,11 @@ module ApplicationHelper
|
||||
"Search"
|
||||
end
|
||||
end
|
||||
|
||||
def first_line(str)
|
||||
lines = str.split("\n")
|
||||
line = lines.first
|
||||
line += "..." if lines.size > 1
|
||||
line
|
||||
end
|
||||
end
|
||||
|
||||
@@ -123,6 +123,8 @@ module EventsHelper
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%strong= event.ref_name
|
||||
- else
|
||||
= link_to project_commits_path(event.project, event.ref_name) do
|
||||
%strong= event.ref_name
|
||||
%strong= truncate(event.ref_name, length: 30)
|
||||
at
|
||||
%strong= link_to_project event.project
|
||||
|
||||
|
||||
Reference in New Issue
Block a user