ICAL export MVP

This commit is contained in:
Petko Bordjukov 2019-10-28 13:16:43 +02:00
parent 4e97ad0eaa
commit 9dc216f30b
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,24 @@
<%
cal = Icalendar::Calendar.new
@events.each do |event|
next unless event&.slot&.starts_at
cal.event do |ical_event|
ical_event.dtstart = event.slot.starts_at
ical_event.dtend = event.slot.ends_at
ical_event.summary = event.title
ical_event.description = event.description
ical_event.created = event.created_at
ical_event.last_modified = event.updated_at
ical_event.location = event.slot.hall.name
ical_event.url = "https://www.openfest.org/2019/bg/full-schedule-bg/#lecture-#{event.id}"
ical_event.alarm do |alarm|
alarm.summary = event.title
alarm.trigger = "-PT15M"
end
end
end
cal.publish
-%>
<%= raw cal.to_ical %>

View File

@ -4,3 +4,4 @@
# Mime::Type.register "text/richtext", :rtf # Mime::Type.register "text/richtext", :rtf
Mime::Type.register "image/svg+xml", :svg Mime::Type.register "image/svg+xml", :svg
Mime::Type.register "text/calendar", :ics