From 537178d99153c9a55365920d27e655716c8f7c12 Mon Sep 17 00:00:00 2001 From: Stefan Schlott Date: Thu, 19 Feb 2015 22:50:28 +0100 Subject: [PATCH] Placeholder for events without description --- Rules | 1 + content/_data/platzhalter.yaml | 37 ++++++++++++++++++++++++++++++++++ lib/eventlists.rb | 18 +++++++++-------- 3 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 content/_data/platzhalter.yaml diff --git a/Rules b/Rules index 28aa6c39..eb6e01cd 100644 --- a/Rules +++ b/Rules @@ -3,6 +3,7 @@ preprocess do expand_event_list("/_data/chaosevents/") expand_event_list("/_data/stammtisch/", "CCCS Stammtisch") + expand_event_list("/_data/platzhalter/", nil, true) calculate_to_dates fix_timezones merge_location_data diff --git a/content/_data/platzhalter.yaml b/content/_data/platzhalter.yaml new file mode 100644 index 00000000..cacbc3a1 --- /dev/null +++ b/content/_data/platzhalter.yaml @@ -0,0 +1,37 @@ +--- +events: +- title: CCCS Vortragsabend (Thema noch offen) + startdate: 2015-01-08T19:30:00Z + duration: 2h + location: + location: bib +- title: CCCS Vortragsabend (Thema noch offen) + startdate: 2015-02-12T19:30:00Z + duration: 2h + location: + location: bib +- title: CCCS Vortragsabend (Thema noch offen) + startdate: 2015-02-12T19:30:00Z + duration: 2h + location: + location: bib +- title: CCCS Vortragsabend (Thema noch offen) + startdate: 2015-03-12T19:30:00Z + duration: 2h + location: + location: bib +- title: CCCS Vortragsabend (Thema noch offen) + startdate: 2015-04-09T19:30:00Z + duration: 2h + location: + location: bib +- title: CCCS Vortragsabend (Thema noch offen) + startdate: 2015-05-14T19:30:00Z + duration: 2h + location: + location: bib +- title: CCCS Vortragsabend (Thema noch offen) + startdate: 2015-06-11T19:30:00Z + duration: 2h + location: + location: bib diff --git a/lib/eventlists.rb b/lib/eventlists.rb index bd94806a..274e3036 100644 --- a/lib/eventlists.rb +++ b/lib/eventlists.rb @@ -1,12 +1,14 @@ -def expand_event_list(itemId, defaultTitle = nil) +def expand_event_list(itemId, defaultTitle = nil, skipIfDatePresent = false) @items[itemId][:events].each_with_index do |event,n| - metadata = { - :title => defaultTitle, - :public => true - } - metadata.merge!(event) - metadata[:kind]='event' - @items << Nanoc::Item.new("<%= render 'event_body' %>", metadata, "#{itemId}#{n}/") + if (!skipIfDatePresent || !@items.any?{ |i| i[:startdate]==event[:startdate] }) + metadata = { + :title => defaultTitle, + :public => true + } + metadata.merge!(event) + metadata[:kind]='event' + @items << Nanoc::Item.new("<%= render 'event_body' %>", metadata, "#{itemId}#{n}/") + end end end