From 90a63748141c4f92e01944ca1cbd06c1fc92f052 Mon Sep 17 00:00:00 2001 From: Lorin Werthen Date: Wed, 8 Feb 2017 17:05:48 +0100 Subject: [PATCH] improve ical --- content/events/16-17/hashcode.md | 1 + lib/helpers/ical.rb | 12 ++++++++---- lib/helpers/preprocess.rb | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/content/events/16-17/hashcode.md b/content/events/16-17/hashcode.md index 53c31fc..82945fa 100644 --- a/content/events/16-17/hashcode.md +++ b/content/events/16-17/hashcode.md @@ -3,6 +3,7 @@ title: Hashcode description: Zeus organiseert een UGent Hashcode Hub created_at: 27-01-2017 time: 23-02-2017 18:30 +end: 23-02-2017 23:00 location: A3, S9 locationlink: Sterre,Ghent Belgium banner: https://hashcode.withgoogle.com/resources/images/hero_2.jpg diff --git a/lib/helpers/ical.rb b/lib/helpers/ical.rb index fee375a..446fb62 100644 --- a/lib/helpers/ical.rb +++ b/lib/helpers/ical.rb @@ -10,10 +10,14 @@ module IcalHelper end def event_for(item) - event = Icalendar::Event.new - event.dtstart = item[:time] - event.summary = item[:title] + e = Icalendar::Event.new + e.dtstart = item[:time] + e.dtend = item[:end] if item[:end] + e.summary = item[:title] + e.description = item[:description] + "\n\n" + item.reps[:text].compiled_content + e.location = item[:location] + e.url = @config[:base_url] + item.path - event + e end end diff --git a/lib/helpers/preprocess.rb b/lib/helpers/preprocess.rb index 732b3dd..0dbfcdf 100644 --- a/lib/helpers/preprocess.rb +++ b/lib/helpers/preprocess.rb @@ -39,6 +39,7 @@ module PreprocessHelper def convert_event_time_to_timestamps all_events.each do |event| event[:time] = DateTime.parse(event[:time]) + event[:end] = DateTime.parse(event[:end]) if event[:end] end end end