gitlab-org--gitlab-foss/app/presenters/event_presenter.rb
Jan Provaznik f494587973 Add event presenter
This presenter will be used in an upcoming MR which adds
rendering of epic events on group activity page.
2019-09-10 10:11:38 +00:00

20 lines
412 B
Ruby

# frozen_string_literal: true
class EventPresenter < Gitlab::View::Presenter::Delegated
presents :event
def resource_parent_name
resource_parent&.full_name || ''
end
def target_link_options
case resource_parent
when Group
[event.group, event.target]
when Project
[event.project.namespace.becomes(Namespace), event.project, event.target]
else
''
end
end
end