From 18afac1ebbb8fbd6f370a0b088486c825c62b0e6 Mon Sep 17 00:00:00 2001 From: ajuvercr Date: Fri, 6 Dec 2019 20:37:33 +0100 Subject: [PATCH 1/6] minimal --- layouts/eventpost.erb | 3 +++ layouts/events.erb | 24 ++++++++++++++++++++++++ layouts/partials/_soon_tile.erb | 33 +++++++++++++++++++++++++++++++++ lib/helpers/events.rb | 8 ++++++-- 4 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 layouts/partials/_soon_tile.erb diff --git a/layouts/eventpost.erb b/layouts/eventpost.erb index 2a6d72d..182024c 100644 --- a/layouts/eventpost.erb +++ b/layouts/eventpost.erb @@ -73,6 +73,8 @@ + +<% if item[:locationlink] %>
@@ -83,6 +85,7 @@
+<% end %> diff --git a/layouts/events.erb b/layouts/events.erb index 14478c5..c381c86 100644 --- a/layouts/events.erb +++ b/layouts/events.erb @@ -61,4 +61,28 @@ <% end %> + + <% unless soon_events().empty? %> +
+ +
+ <% end %> diff --git a/layouts/partials/_soon_tile.erb b/layouts/partials/_soon_tile.erb new file mode 100644 index 0000000..f46b4c9 --- /dev/null +++ b/layouts/partials/_soon_tile.erb @@ -0,0 +1,33 @@ +<% if @event[:banner] %> + +<% elsif @event[:color] %> + +<% else %> + +<% end %> +
+ <% if nil && @event[:image] %> + + <% end %> +
+

+ <%= @event[:title] %> +

+ +
+ <%= @event[:description] %> +
+ +
+ +
+ <%= fa :'clock-o' , fw: true %><%= @event[:time].strftime('%A %d %B, %H:%M') %> +
+ <%= fa :'map-marker', fw: true %><%= @event[:location] %> +
+
+ +
+
diff --git a/lib/helpers/events.rb b/lib/helpers/events.rb index 9f4480c..cb8501d 100644 --- a/lib/helpers/events.rb +++ b/lib/helpers/events.rb @@ -3,14 +3,18 @@ require 'uri' module EventsHelper - def all_events(year = nil) + def all_events(year = nil, soon = nil) items_ = if year @items.find_all("/events/#{year}/*.md") else @items.find_all('/events/*/*.md') end - items_.sort_by { |x| x[:time] } + items_.select { |x| x[:soon] == soon }.sort_by { |x| x[:time] } + end + + def soon_events() + all_events(nil, true) end def upcoming_events(year = nil) From afdfa9869537267af9f15dc7bb4049ad01a86d0c Mon Sep 17 00:00:00 2001 From: ajuvercr Date: Fri, 6 Dec 2019 22:14:02 +0100 Subject: [PATCH 2/6] Let's go --- content/assets/stylesheets/includes/tiles.scss | 4 ++-- content/events/19-20/ctf2.md | 7 +++++++ content/events/19-20/godot.md | 8 ++++++++ content/events/19-20/spelletjesavond2.md | 8 ++++++++ layouts/events.erb | 18 ++++++++++-------- lib/helpers/preprocess.rb | 1 - 6 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 content/events/19-20/ctf2.md create mode 100644 content/events/19-20/godot.md create mode 100644 content/events/19-20/spelletjesavond2.md diff --git a/content/assets/stylesheets/includes/tiles.scss b/content/assets/stylesheets/includes/tiles.scss index eb03ade..1893093 100644 --- a/content/assets/stylesheets/includes/tiles.scss +++ b/content/assets/stylesheets/includes/tiles.scss @@ -55,7 +55,7 @@ $top_coder_size: 80px; .content { color: white; - h1, h2 { + h1, h2, h3 { color: inherit; } a, a:visited { @@ -130,7 +130,7 @@ $top_coder_size: 80px; .content { position: relative; - h1, h2 { + h1, h2, h3 { color: white; } diff --git a/content/events/19-20/ctf2.md b/content/events/19-20/ctf2.md new file mode 100644 index 0000000..063c93b --- /dev/null +++ b/content/events/19-20/ctf2.md @@ -0,0 +1,7 @@ +--- +title: 'Capture The Flag II' +description: Zeus CTF in aanloop naar de Belgische Cybersecuritychallenge +time: '12-11-2019 18:00' +location: 'Kelder Zeus WPI' +soon: true +--- diff --git a/content/events/19-20/godot.md b/content/events/19-20/godot.md new file mode 100644 index 0000000..ade633c --- /dev/null +++ b/content/events/19-20/godot.md @@ -0,0 +1,8 @@ +--- +title: Game Development - Godot +description: Maak je eerste spel met Godot, we focussen op Flappy Bird! +color: '#478CBF' +time: '12-11-2019 18:00' +location: 'Kelder Zeus WPI' +soon: true +--- diff --git a/content/events/19-20/spelletjesavond2.md b/content/events/19-20/spelletjesavond2.md new file mode 100644 index 0000000..3ef92b4 --- /dev/null +++ b/content/events/19-20/spelletjesavond2.md @@ -0,0 +1,8 @@ +--- +title: Spelletjesavond +description: Kom samen met andere Zeussers en Zeusinnen spelletjes spelen! +color: lightblue +time: '12-11-2019 18:00' +location: 'Kelder Zeus WPI' +soon: true +--- diff --git a/layouts/events.erb b/layouts/events.erb index c381c86..827c71f 100644 --- a/layouts/events.erb +++ b/layouts/events.erb @@ -64,25 +64,27 @@ <% unless soon_events().empty? %>
- +
<% end %> diff --git a/lib/helpers/preprocess.rb b/lib/helpers/preprocess.rb index 3574b6a..6f8a3f4 100644 --- a/lib/helpers/preprocess.rb +++ b/lib/helpers/preprocess.rb @@ -5,7 +5,6 @@ module PreprocessHelper time: 'An event item should include the :time attribute, which describes the begin time and date of the event.', title: 'The event does not include a :title', location: 'The event should include a :location, a textual description', - locationlink: 'The event does not include a :locationlink, which is a querystring which is used for Google Maps' } } end From d1ab7c73d110d043e9473d9b4f89751c4ca7c9e2 Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Mon, 13 Jan 2020 14:09:04 +0100 Subject: [PATCH 3/6] Fix syntax error due to merge --- lib/helpers/preprocess.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/helpers/preprocess.rb b/lib/helpers/preprocess.rb index bb23b51..41abf9a 100644 --- a/lib/helpers/preprocess.rb +++ b/lib/helpers/preprocess.rb @@ -1,11 +1,11 @@ module PreprocessHelper def required_attrs { - event: { - time: 'An event item should include the :time attribute, which describes the begin time and date of the event.', - title: 'The event does not include a :title', - location: 'The event should include a :location, a textual description', - locationlink: 'The event does not include a :locationlink, which is a querystring which is used for Google Maps', + event: { + time: 'An event item should include the :time attribute, which describes the begin time and date of the event.', + title: 'The event does not include a :title', + location: 'The event should include a :location, a textual description', + }, privacy: { status: 'A privacy item must include the status of the project' } From 647d942412c9a1d9178b99c51102cd74163ce6ca Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Mon, 13 Jan 2020 14:31:30 +0100 Subject: [PATCH 4/6] Html improvements: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use partial instead of inline - Correct background colour if event has none - Don't use tag, use - Use UTF8 ™ character --- layouts/events.erb | 23 +++++-------------- layouts/partials/_soon_tile.erb | 40 ++++++++++----------------------- 2 files changed, 18 insertions(+), 45 deletions(-) diff --git a/layouts/events.erb b/layouts/events.erb index 827c71f..c967bf7 100644 --- a/layouts/events.erb +++ b/layouts/events.erb @@ -57,33 +57,22 @@

Sorry.

No events planned yet this year.

-

Soon TM.

+

Soon™.

<% end %> - <% unless soon_events().empty? %> + <% unless soon_events.empty? %>
<% end %> diff --git a/layouts/partials/_soon_tile.erb b/layouts/partials/_soon_tile.erb index f46b4c9..cea1f67 100644 --- a/layouts/partials/_soon_tile.erb +++ b/layouts/partials/_soon_tile.erb @@ -1,33 +1,17 @@ -<% if @event[:banner] %> - -<% elsif @event[:color] %> - -<% else %> - -<% end %> +
+ style="background-image: linear-gradient(to top right,rgba(255,255,255,0),rgba(0,0,0,.60)); background-color:<%= event[:color] %>;" + <% else %> + style="background-image: linear-gradient(to top right,rgba(255,255,255,0),rgba(0,0,0,.60)); background-color: lightgrey;" + <% end %> + > From 93aef1e251d3c43b856c9a7de1aeecdc9d78a144 Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Mon, 13 Jan 2020 14:31:55 +0100 Subject: [PATCH 5/6] No parentheses when no params --- lib/helpers/events.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helpers/events.rb b/lib/helpers/events.rb index cb8501d..7e682dd 100644 --- a/lib/helpers/events.rb +++ b/lib/helpers/events.rb @@ -13,7 +13,7 @@ module EventsHelper items_.select { |x| x[:soon] == soon }.sort_by { |x| x[:time] } end - def soon_events() + def soon_events all_events(nil, true) end From d8323ecfef105a09ce86e75d6872fde383324efe Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Mon, 13 Jan 2020 14:34:12 +0100 Subject: [PATCH 6/6] Don't put soon events in ical --- lib/helpers/ical.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/helpers/ical.rb b/lib/helpers/ical.rb index 1369e0f..e11e1ef 100644 --- a/lib/helpers/ical.rb +++ b/lib/helpers/ical.rb @@ -2,9 +2,9 @@ module IcalHelper def event_calendar cal = Icalendar::Calendar.new - items.find_all('/events/*/*.md').each do |i| - cal.add_event(event_for(i)) - end + items.find_all('/events/*/*.md') + .select { |x| x[:soon] == nil } + .each {|i| cal.add_event(event_for(i)) } cal.to_ical end