20 lines
749 B
Plaintext
20 lines
749 B
Plaintext
:ruby
|
||
# Create a calendar with an event (standard method)
|
||
cal = Icalendar::Calendar.new
|
||
tzid = @event.region.tzid
|
||
cal.event do |e|
|
||
e.dtstamp = Icalendar::Values::DateTime.new @event.decision_time, tzid: tzid
|
||
e.uid = "#{event.id}@#{request.domain}"
|
||
e.dtstart = Icalendar::Values::DateTime.new @event.start_time, tzid: tzid
|
||
e.dtend = Icalendar::Values::DateTime.new @event.end_time, tzid: tzid
|
||
e.summary = @event.title
|
||
e.description = to_markdown @event.description.tr '\'', '’'
|
||
e.location = @event.full_address
|
||
e.organizer = "mailto:#{@event.contact}"
|
||
e.x_alt_desc = Icalendar::Values::Text.new @event.description, FMTTYPE: 'text/html'
|
||
end
|
||
|
||
cal.publish
|
||
|
||
= cal.to_ical
|