Merge pull request #56 from ZeusWPI/blogposts

Blogposts
This commit is contained in:
Wout Schellaert 2016-09-27 21:29:01 +02:00 committed by GitHub
commit 78a381dea1
7 changed files with 55 additions and 32 deletions

8
Rules
View file

@ -28,11 +28,13 @@ preprocess do
academic_years.each do |year| academic_years.each do |year|
@items.create( @items.create(
'', '',
{ academic_year: year }, { academic_year: year, title: "Blog" },
"/archives/#{year}-#{year + 1}.html", "/blog/#{year}-#{year + 1}.html",
binary: false binary: false
) )
end end
academic_years_items[academic_years.max][:navigable] = true
end end
# #
@ -48,7 +50,7 @@ end
# #
# ARCHIVES # ARCHIVES
# #
compile '/archives/*' do compile '/blog/*' do
layout '/archive_page.*' layout '/archive_page.*'
layout '/generic.*' layout '/generic.*'
layout '/default.*' layout '/default.*'

View file

@ -1,11 +0,0 @@
---
navigable: true
title: Archieven
---
<ul class = "archive_list">
<% academic_years_items.each do |year, item| %>
<li>
<%= link_to pretty_year(year), item %>
</li>
<% end %>
</ul>

View file

@ -3,3 +3,14 @@
font-size: 4em; font-size: 4em;
} }
} }
.padbox{
margin-bottom:10px;
}
.bolder a{
color:#565C5E;
font-weight: bold;
font-size: 20pt;
font-family: 'Avenir';
}

View file

@ -0,0 +1,7 @@
---
title: moar review
description: blub
banner: https://i.ytimg.com/vi/tntOCGkgt98/maxresdefault.jpg
created_at: 24-10-2016
---
blub

View file

@ -1,4 +1,5 @@
--- ---
banner: https://thumbs.dreamstime.com/z/letter-c-cat-4240140.jpg
title: C review title: C review
description: We hebben even wat dingen in C geschreven, en dit zijn onze meningen description: We hebben even wat dingen in C geschreven, en dit zijn onze meningen
created_at: 23-10-2016 created_at: 23-10-2016

View file

@ -1,19 +1,32 @@
<% posts_in_year(item[:academic_year]).each do |post| %> <div class="columns" >
<a href="<%= relative_path_to(post) %>"> <div class="column">
<div class="box"> <% posts_in_year(item[:academic_year]).each do |post| %>
<article class="media"> <a href="<%= relative_path_to(post) %>" >
<figure class="media-left"> <div class="box padbox">
<p class="image is-64x64"> <article class="media">
<img src="<%= post[:banner] %>"> <figure class="media-left">
</p> <p class="image is-64x64">
</figure> <img src="<%= post[:banner] %>">
<div class="media-content"> </p>
<div class="content"> </figure>
<h2><%= post[:title] %></h2> <div class="media-content">
<%= excerptize(post.reps[:text].compiled_content, length: 200) %> <div class="content">
</div> <h2><%= post[:title] %></h2>
<%= excerptize(post.reps[:text].compiled_content, length: 200) %>
</div>
</div>
</article>
</div> </div>
</article> </a>
<% end %>
</div> </div>
</a> <div class="column is-narrow">
<% end %> <ul class = "archive_list">
<% academic_years_items.each do |year, item| %>
<li class="bolder">
<%= link_to pretty_year(year), item %>
</li>
<% end %>
</ul>
</div>
</div>

View file

@ -11,7 +11,7 @@ module ArchiveHelper
end end
def academic_years_items def academic_years_items
academic_years.map { |y| [y, items["/archives/#{y}-#{y + 1}.html"]] }.to_h academic_years.to_a.reverse.map { |y| [y, items["/blog/#{y}-#{y + 1}.html"]] }.to_h
end end
def pretty_year(year) def pretty_year(year)