Display email-friendly names and emails in events csv export
This commit is contained in:
parent
de5795910f
commit
29da04d51f
|
@ -14,11 +14,14 @@ module EventsHelper
|
||||||
end.join(', ').html_safe
|
end.join(', ').html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def participant_names_or_emails(event)
|
def participant_names_with_emails(event)
|
||||||
event.participants.map do |participant|
|
event.participants.map do |participant|
|
||||||
participant.try(:personal_profile, current_conference).try(:name) ||
|
if participant.personal_profile(event.conference).present?
|
||||||
participant.personal_profiles.last.try(:name) ||
|
profile = participant.personal_profile(event.conference)
|
||||||
|
"#{profile.name} <#{participant.email}>"
|
||||||
|
else
|
||||||
participant.email
|
participant.email
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<%- csv_headers = %w{id title subtitle type track language paticipants status} -%>
|
<%- csv_headers = %w{id title subtitle type track language paticipants status} -%>
|
||||||
<%= CSV.generate_line(csv_headers).html_safe -%>
|
<%= CSV.generate_line(csv_headers).html_safe -%>
|
||||||
<%- @events.each do |event| -%>
|
<%- @events.each do |event| -%>
|
||||||
<%= CSV.generate_line([event.id, event.title, event.subtitle, event.event_type.name, event.track.name, event.language, participant_names_or_emails(event).join(', '), event.status]).html_safe -%>
|
<%= CSV.generate_line([event.id, event.title, event.subtitle, event.event_type.name, event.track.name, event.language, participant_names_with_emails(event).join(', '), event.status]).html_safe -%>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
|
Loading…
Reference in New Issue