Merge branch 'master' of github.com:ZeusWPI/zeus.ugent.be into feature/historiek

This commit is contained in:
Lorin Werthen 2017-06-14 08:26:16 +02:00
commit 1572ea8a50
No known key found for this signature in database
GPG key ID: F11FFC921E0E08E0
15 changed files with 165 additions and 80 deletions

View file

@ -1,6 +1,8 @@
# zeus.ugent.be # zeus.ugent.be
[![Build Status](https://travis-ci.org/ZeusWPI/zeus.ugent.be.svg?branch=master)](https://travis-ci.org/ZeusWPI/zeus.ugent.be) [![Build Status](https://travis-ci.org/ZeusWPI/zeus.ugent.be.svg?branch=master)](https://travis-ci.org/ZeusWPI/zeus.ugent.be)
[![Code Climate](https://codeclimate.com/github/ZeusWPI/zeus.ugent.be.png)](https://codeclimate.com/github/ZeusWPI/zeus.ugent.be) [![Code Climate](https://codeclimate.com/github/ZeusWPI/zeus.ugent.be.png)](https://codeclimate.com/github/ZeusWPI/zeus.ugent.be)
[![PageSpeed](https://pagespeed-badges.herokuapp.com/?url=zeus.ugent.be&strat=desktop&showStratLabel=true)](https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fzeus.ugent.be&tab=desktop)
[![PageSpeed](https://pagespeed-badges.herokuapp.com/?url=zeus.ugent.be&strat=mobile&showStratLabel=true)](https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fzeus.ugent.be&tab=mobile)
## Setup ## Setup

18
Rules
View file

@ -16,7 +16,8 @@ preprocess do
# We don't want to compile old blogposts in development # We don't want to compile old blogposts in development
ignore_old_blogposts if development? ignore_old_blogposts if development?
update_blog_attributes update_blog_attributes
create_blog_items create_yearly_items('Blog')
create_yearly_items('Events')
convert_event_time_to_timestamps convert_event_time_to_timestamps
end end
@ -42,7 +43,16 @@ end
# #
# EVENTS # EVENTS
# #
compile '/events/**/*' do
# Overview page
compile '/events/*' do
layout '/events.*'
layout '/generic.*'
layout '/default.*'
filter :erb
end
compile '/events/*/*' do
filter :kramdown filter :kramdown
layout '/eventpost.*' layout '/eventpost.*'
@ -50,12 +60,12 @@ compile '/events/**/*' do
filter :erb filter :erb
end end
compile '/events/**/*', rep: :text do compile '/events/*/*', rep: :text do
filter :kramdown filter :kramdown
filter :strip_html filter :strip_html
end end
compile '/events/**/*', rep: :ical do compile '/events/*/*', rep: :ical do
filter :ical filter :ical
write ext: 'ics' write ext: 'ics'
end end

View file

@ -35,7 +35,6 @@
#logo-link { #logo-link {
#logo { #logo {
padding-top: 10px;
padding-left: 10px; padding-left: 10px;
width: 100px; width: 100px;
} }
@ -75,3 +74,13 @@
} }
} }
} }
.hero {
#logo {
padding-top: 25px;
}
.nav-right {
padding-right: 10px;
}
}

View file

@ -33,8 +33,12 @@
margin-top: 30px; margin-top: 30px;
} }
.logo-wrapper {
padding-top: 0;
padding-bottom: 0;
}
.logo { .logo {
height: 10vw;
width: 10vw; width: 10vw;
min-width: 100px; min-width: 100px;
min-height: 100px; min-height: 100px;
@ -42,12 +46,14 @@
margin-right: auto; margin-right: auto;
display: flex; display: flex;
align-items: center; align-items: center;
height: 100%;
} }
.logo-initial { .logo-initial {
margin: auto; margin: auto;
color: white; color: white;
font-size: 6vw; font-size: 5rem;
font-family: $family-sans-serif; font-family: $family-sans-serif;
} }

View file

@ -1,34 +0,0 @@
---
navigable: true
title: Events
order: 20
---
<div class="container">
<div class="content">
<h1>Upcoming events</h1>
</div>
<% upcoming_events.each_slice(2) do |slice| %>
<div class="columns">
<% slice.each do |event| %>
<div class="tile is-parent ">
<%= render '/partials/_events_tile.*', event: event %>
</div>
<% end %>
</div>
<% end %>
</div>
<div class="container">
<div class="content">
<h1>Past events</h1>
</div>
<% past_events.each_slice(2) do |slice| %>
<div class="columns">
<% slice.each do |event| %>
<div class="tile is-parent ">
<%= render '/partials/_events_tile.*', event: event %>
</div>
<% end %>
</div>
<% end %>
</div>

View file

@ -5,7 +5,7 @@
Academiejaar Academiejaar
</p> </p>
<ul class="menu-list"> <ul class="menu-list">
<% academic_years_items.each do |year, item| %> <% academic_years_blog_items.each do |year, item| %>
<% if @item_rep && @item_rep.path == item.path %> <% if @item_rep && @item_rep.path == item.path %>
<li> <li>
<a href="#" class="is-active"> <a href="#" class="is-active">

View file

@ -18,37 +18,46 @@
<meta property="fb:app_id" content="597670540410704"> <meta property="fb:app_id" content="597670540410704">
<link href="https://cdnjs.cloudflare.com/ajax/libs/Tipue-Search/5.0.0/tipuesearch.css" rel="stylesheet"> <!-- Inline JS -->
<!-- Google Analytics --> <!-- Google Analytics -->
<script> <script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-25444917-1', 'auto'); ga('create', 'UA-25444917-1', 'auto');
ga('send', 'pageview'); ga('send', 'pageview');
</script> </script>
<!-- CSS -->
<!-- TiptueSearch CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Tipue-Search/5.0.0/tipuesearch.css" >
<!-- Custom CSS -->
<%= asset :css, :main %>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
<!-- Animate.css -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<!-- External JS -->
<!-- Google Analytics -->
<script async src='https://www.google-analytics.com/analytics.js'></script> <script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- Hotjar Tracking Code for zeus.ugent.be --> <!-- Hotjar Tracking Code for zeus.ugent.be -->
<script> <script>
(function(h,o,t,j,a,r){ (function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)}; h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:392303,hjsv:5}; h._hjSettings={hjid:392303,hjsv:5};
a=o.getElementsByTagName('head')[0]; a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1; r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv; r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r); a.appendChild(r);
})(window,document,'//static.hotjar.com/c/hotjar-','.js?sv='); })(window,document,'//static.hotjar.com/c/hotjar-','.js?sv=');
</script> </script>
<%= asset :css, :main %>
<!-- Font Awesome -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<%= content_for(@item, :head) %> <%= content_for(@item, :head) %>
</head> </head>
<body class="site"> <body class="site">
<div class="wrapper"> <div class="wrapper">
<%= yield %> <%= yield %>

56
layouts/events.erb Normal file
View file

@ -0,0 +1,56 @@
<div class="columns">
<div class="column is-2 is-narrow">
<aside class="menu">
<p class="menu-label">
Academiejaar
</p>
<ul class="menu-list">
<% academic_years_event_items.each do |year, item| %>
<% if @item_rep && @item_rep.path == item.path %>
<li>
<a href="#" class="is-active">
<%= pretty_year(year) %>
</a>
</li>
<% else %>
<li>
<%= link_to pretty_year(year), item %>
</li>
<% end %>
<% end %>
</ul>
</aside>
</div>
<div class="column">
<% unless upcoming_events(@item[:academic_year]).empty? %>
<div class="content">
<h1>Upcoming events</h1>
</div>
<% upcoming_events(@item[:academic_year]).each_slice(2) do |slice| %>
<div class="columns">
<% slice.each do |event| %>
<div class="tile is-parent ">
<%= render '/partials/_events_tile.*', event: event %>
</div>
<% end %>
</div>
<% end %>
<% end %>
<% unless past_events(@item[:academic_year]).empty? %>
<div class="content">
<h1>Past events</h1>
</div>
<% past_events(@item[:academic_year]).each_slice(2) do |slice| %>
<div class="columns">
<% slice.each do |event| %>
<div class="tile is-parent ">
<%= render '/partials/_events_tile.*', event: event %>
</div>
<% end %>
</div>
<% end %>
<% end %>
</div>
</div>

View file

@ -1,6 +1,6 @@
<div id="<%= project.identifier.without_ext.split('/')[-1] %>" class="container project content"> <div id="<%= project.identifier.without_ext.split('/')[-1] %>" class="container project content">
<article class="columns is-mobile"> <article class="columns is-mobile">
<div class="column is-one-quarter"> <div class="column is-gapless is-narrow logo-wrapper">
<% if project[:logo_image] %> <% if project[:logo_image] %>
<div class="logo"> <div class="logo">
<%= asset :img, project[:logo_image] %> <%= asset :img, project[:logo_image] %>

View file

@ -3,7 +3,7 @@ module ArchiveHelper
Set.new(items.find_all('/blog/*/*').map { |i| i.identifier.to_s[/\d\d-\d\d/] }).to_a Set.new(items.find_all('/blog/*/*').map { |i| i.identifier.to_s[/\d\d-\d\d/] }).to_a
end end
def academic_years_items def academic_years_blog_items
academic_years.reverse.map { |y| [y, items["/blog/#{y}.html"]] } academic_years.reverse.map { |y| [y, items["/blog/#{y}.html"]] }
end end

View file

@ -1,17 +1,31 @@
# frozen_string_literal: true
require 'uri' require 'uri'
module EventsHelper module EventsHelper
def all_events def all_events(year = nil)
@items.find_all('/events/*/*.md').sort_by { |x| x[:time] } items_ = if year
@items.find_all("/events/#{year}/*.md")
else
@items.find_all('/events/*/*.md')
end end
def upcoming_events items_.sort_by { |x| x[:time] }
all_events.reject { |x| x[:time] <= Date.today }
end end
def past_events def upcoming_events(year = nil)
all_events.reject { |x| x[:time] > Date.today }.reverse all_events(year).reject { |x| x[:time] <= Date.today }
end end
def past_events(year = nil)
all_events(year).reject { |x| x[:time] > Date.today }.reverse
end
def academic_years_event_items
items.find_all('/events/*').map { |e| [e[:academic_year], e] }.reverse
end
def grouped_events def grouped_events
@items.find_all('/events/*/*/main.md') @items.find_all('/events/*/*/main.md')
end end

View file

@ -18,17 +18,19 @@ module PreprocessHelper
end end
end end
def create_blog_items def create_yearly_items(type)
# academic_years is defined in archives.rb type = type.to_s
academic_years.each do |year| years = @items.find_all("/#{type.downcase}/*/*").map { |i| i.identifier.to_s[/\d\d-\d\d/] }.uniq
years.each do |year|
@items.create( @items.create(
'', '',
{ academic_year: year, title: 'Blog' }, { academic_year: year, title: type },
"/blog/#{year}.html" "/#{type.downcase}/#{year}.html"
) )
end end
academic_years_items[0][1].update_attributes( @items["/#{type.downcase}/#{years[-1]}.html"].update_attributes(
navigable: true, navigable: true,
order: 10 order: 10
) )

11
package-lock.json generated Normal file
View file

@ -0,0 +1,11 @@
{
"name": "zeus.ugent.be",
"version": "0.0.1",
"lockfileVersion": 1,
"dependencies": {
"bulma": {
"version": "https://registry.npmjs.org/bulma/-/bulma-0.4.2.tgz",
"integrity": "sha1-O+jIMs9mWL/EIey0H23FqKDHwOU="
}
}
}

View file

@ -7,6 +7,6 @@
"license": "MIT", "license": "MIT",
"repository": "https://github.com/ZeusWPI/zeus.ugent.be", "repository": "https://github.com/ZeusWPI/zeus.ugent.be",
"dependencies": { "dependencies": {
"bulma": "0.4.1" "bulma": "0.4.2"
} }
} }