Add icalendar files (fixes #2147)

This commit is contained in:
Sasi Olin 2021-02-14 22:56:45 +01:00 committed by Henne Vogelsang
parent 32164c47db
commit d540092bfc
No known key found for this signature in database
GPG key ID: 9D6164C2955FADE0
6 changed files with 80 additions and 0 deletions

View file

@ -21,4 +21,31 @@ module ConferenceHelper
'%20Sponsorship'
].join
end
# adds events to icalendar for proposals in a conference
def icalendar_proposals(calendar, proposals, conference)
proposals.each do |proposal|
calendar.event do |e|
e.dtstart = proposal.time
e.dtend = proposal.time + proposal.event_type.length * 60
e.duration = "PT#{proposal.event_type.length}M"
e.created = proposal.created_at
e.last_modified = proposal.updated_at
e.summary = proposal.title
e.description = proposal.abstract
e.uid = proposal.guid
e.url = conference_program_proposal_url(conference.short_title, proposal.id)
v = conference.venue
e.geo = v.latitude, v.longitude if v.latitude && v.longitude
location = ''
location += "#{proposal.room.name} - " if proposal.room.name
location += " - #{v.street}, " if v.street
location += "#{v.postalcode} #{v.city}, " if v.postalcode && v.city
location += "#{v.country_name}, " if v.country_name
e.location = location
e.categories = conference.title, "Difficulty: #{proposal.difficulty_level.title}", "Track: #{proposal.track.name}"
end
end
calendar
end
end