Fix the problems with bumping the current acedemic year while no posts have been made
This commit is contained in:
parent
786c73eaeb
commit
481b0f57b9
6 changed files with 24 additions and 5 deletions
2
Rules
2
Rules
|
@ -41,7 +41,7 @@ end
|
||||||
# ARCHIVES
|
# ARCHIVES
|
||||||
#
|
#
|
||||||
compile '/blog/*' do
|
compile '/blog/*' do
|
||||||
layout '/archive_page.*'
|
layout '/blogs.*'
|
||||||
layout '/generic.*'
|
layout '/generic.*'
|
||||||
layout '/default.*'
|
layout '/default.*'
|
||||||
filter :erb
|
filter :erb
|
||||||
|
|
|
@ -34,6 +34,14 @@
|
||||||
<%= render '/partials/_blog_preview.*', post: post %>
|
<%= render '/partials/_blog_preview.*', post: post %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<% if posts_in_year(@item[:academic_year]).empty? %>
|
||||||
|
<div class="content has-text-centered">
|
||||||
|
<h1>Sorry.</h1>
|
||||||
|
<h2>No blog posts yet this year.</h2>
|
||||||
|
<h4 class="has-text-grey"><i>Soon TM.<i></h4>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -52,5 +52,13 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if past_events(@item[:academic_year]).empty? and upcoming_events(@item[:academic_year]).empty? %>
|
||||||
|
<div class="content has-text-centered">
|
||||||
|
<h1>Sorry.</h1>
|
||||||
|
<h2>No events planned yet this year.</h2>
|
||||||
|
<h4 class="has-text-grey"><i>Soon TM.<i></h4>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,6 +6,8 @@ module ArchiveHelper
|
||||||
.map { |i| i.identifier.to_s[/\d\d-\d\d/] })
|
.map { |i| i.identifier.to_s[/\d\d-\d\d/] })
|
||||||
.to_a
|
.to_a
|
||||||
.sort
|
.sort
|
||||||
|
.push(@config[:academic_year])
|
||||||
|
.uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
def academic_years_blog_items
|
def academic_years_blog_items
|
||||||
|
|
|
@ -46,7 +46,10 @@ module PreprocessHelper
|
||||||
|
|
||||||
def create_yearly_items(type)
|
def create_yearly_items(type)
|
||||||
type = type.to_s
|
type = type.to_s
|
||||||
years = @items.find_all("/#{type.downcase}/*/*").map { |i| i.identifier.to_s[/\d\d-\d\d/] }.uniq
|
years = @items.find_all("/#{type.downcase}/*/*")
|
||||||
|
.map { |i| i.identifier.to_s[/\d\d-\d\d/] }
|
||||||
|
.push(@config[:academic_year])
|
||||||
|
.uniq
|
||||||
|
|
||||||
years.each do |year|
|
years.each do |year|
|
||||||
@items.create(
|
@items.create(
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
title: Zeus WPI
|
title: Zeus WPI
|
||||||
# If you update this, make sure to create a new directory for blogs and events,
|
academic_year: 19-20
|
||||||
# and add an entry to both.
|
|
||||||
academic_year: 18-19
|
|
||||||
# Needed for atom_feed
|
# Needed for atom_feed
|
||||||
author_name: ''
|
author_name: ''
|
||||||
author_uri: ''
|
author_uri: ''
|
||||||
|
|
Loading…
Reference in a new issue