Commit 08e52a56 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Refactor event title for notes

parent d0357f3b
...@@ -91,4 +91,32 @@ module EventsHelper ...@@ -91,4 +91,32 @@ module EventsHelper
url_for([event.project, event.note_target]) url_for([event.project, event.note_target])
end end
end end
def event_note_title_html(event)
if event.note_target
if event.note_commit?
link_to project_commit_path(event.project, event.note_commit_id), class: "commit_short_id" do
"#{event.note_target_type} #{event.note_short_commit_id}"
end
elsif event.note_project_snippet?
link_to(project_snippet_path(event.project, event.note_target)) do
content_tag :strong do
"#{event.note_target_type} ##{truncate event.note_target_id}"
end
end
else
link_to event_note_target_path(event) do
content_tag :strong do
"#{event.note_target_type} ##{truncate event.note_target_id}"
end
end
end
elsif event.wall_note?
link_to 'wall', project_wall_path(event.project)
else
content_tag :strong do
"(deleted)"
end
end
end
end end
.event-title .event-title
%span.author_name= link_to_author event %span.author_name= link_to_author event
%span.event_label commented on %span.event_label commented on #{event_note_title_html(event)} at
- if event.note_target
- if event.note_commit?
= event.note_target_type
= link_to event.note_short_commit_id, project_commit_path(event.project, event.note_commit_id), class: "commit_short_id"
- elsif event.note_project_snippet?
= link_to project_snippet_path(event.project, event.note_target) do
%strong
#{event.note_target_type} ##{truncate event.note_target_id}
- else
= link_to event_note_target_path(event) do
%strong
#{event.note_target_type} ##{truncate event.note_target_id}
- elsif event.wall_note?
= link_to 'wall', project_wall_path(event.project)
- else
%strong (deleted)
at
- if event.project - if event.project
= link_to_project event.project = link_to_project event.project
- else - else
......
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