2015-10-15 19:06:41 +03:00
|
|
|
module EventsHelper
|
2016-10-08 22:40:56 +03:00
|
|
|
def links_to_event_participants_for(event)
|
2019-04-28 21:10:54 +03:00
|
|
|
event.participants_with_personal_profiles.map { |participant|
|
2016-10-15 05:59:07 +03:00
|
|
|
if participant.has_personal_profile?
|
|
|
|
link_to icon(:user, participant.name),
|
|
|
|
management_conference_personal_profile_path(participant.personal_profile_id, conference_id: event.conference.id)
|
2016-10-08 22:40:56 +03:00
|
|
|
else
|
2019-04-28 21:10:54 +03:00
|
|
|
link_to icon("user-plus", participant.personal_email),
|
2016-10-08 22:40:56 +03:00
|
|
|
new_management_conference_personal_profile_path(conference_id: event.conference.id,
|
|
|
|
user_id: participant.id),
|
2019-04-28 21:10:54 +03:00
|
|
|
title: t("management.events.event.create_profile"), class: "bg-danger"
|
2016-10-08 22:40:56 +03:00
|
|
|
end
|
2019-04-28 21:10:54 +03:00
|
|
|
}.join(", ").html_safe
|
2015-10-15 19:06:41 +03:00
|
|
|
end
|
2016-10-09 02:55:31 +03:00
|
|
|
|
2016-10-09 05:30:25 +03:00
|
|
|
def participant_names_with_emails(event)
|
2016-10-09 02:55:31 +03:00
|
|
|
event.participants.map do |participant|
|
2016-10-09 05:30:25 +03:00
|
|
|
if participant.personal_profile(event.conference).present?
|
|
|
|
profile = participant.personal_profile(event.conference)
|
|
|
|
"#{profile.name} <#{participant.email}>"
|
|
|
|
else
|
2016-10-09 02:55:31 +03:00
|
|
|
participant.email
|
2016-10-09 05:30:25 +03:00
|
|
|
end
|
2016-10-09 02:55:31 +03:00
|
|
|
end
|
|
|
|
end
|
2017-10-23 00:29:21 +03:00
|
|
|
|
|
|
|
def participant_names(event)
|
2019-04-28 21:10:54 +03:00
|
|
|
event.participants.map { |participant|
|
2017-10-23 00:29:21 +03:00
|
|
|
if participant.personal_profile(event.conference).present?
|
|
|
|
profile = participant.personal_profile(event.conference)
|
2019-04-28 21:10:54 +03:00
|
|
|
profile.name.to_s
|
2017-10-23 00:29:21 +03:00
|
|
|
end
|
2019-04-28 21:10:54 +03:00
|
|
|
}.compact
|
2017-10-23 00:29:21 +03:00
|
|
|
end
|
2015-10-15 19:06:41 +03:00
|
|
|
end
|