The new ical generators
This commit is contained in:
parent
32a5eb605b
commit
c1546d9684
|
@ -0,0 +1,20 @@
|
|||
:ruby
|
||||
domain = root_url.gsub(/www/, '').gsub(/http.?:../, '').gsub(/:.*/, '')
|
||||
|
||||
# Create a calendar with an event (standard method)
|
||||
cal = Icalendar::Calendar.new
|
||||
@events.each do |event|
|
||||
cal.event do |e|
|
||||
e.dtstamp = Icalendar::Values::DateTime.new event.decision_time
|
||||
e.uid = "#{event.id}@#{domain}"
|
||||
e.dtstart = Icalendar::Values::DateTime.new event.start_time
|
||||
e.dtend = Icalendar::Values::DateTime.new event.end_time
|
||||
e.summary = event.title
|
||||
e.description = event.description.tr '\'', '’'
|
||||
e.location = event.full_address.tr '\'', '’'
|
||||
end
|
||||
end
|
||||
|
||||
cal.publish
|
||||
|
||||
= cal.to_ical
|
|
@ -0,0 +1,14 @@
|
|||
:ruby
|
||||
# Create a calendar with an event (standard method)
|
||||
cal = Icalendar::Calendar.new
|
||||
cal.event do |e|
|
||||
e.dtstart = Icalendar::Values::DateTime.new @event.start_time
|
||||
e.dtend = Icalendar::Values::DateTime.new @event.end_time
|
||||
e.summary = @event.title
|
||||
e.description = strip_tags(@event.description).tr '\'', '’'
|
||||
e.location = @event.full_address
|
||||
end
|
||||
|
||||
cal.publish
|
||||
|
||||
= cal.to_ical
|
Loading…
Reference in New Issue