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
|
||||
#
|
||||
compile '/blog/*' do
|
||||
layout '/archive_page.*'
|
||||
layout '/blogs.*'
|
||||
layout '/generic.*'
|
||||
layout '/default.*'
|
||||
filter :erb
|
||||
|
|
|
@ -34,6 +34,14 @@
|
|||
<%= render '/partials/_blog_preview.*', post: post %>
|
||||
<% end %>
|
||||
</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>
|
|
@ -52,5 +52,13 @@
|
|||
</div>
|
||||
<% 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>
|
||||
|
|
|
@ -6,6 +6,8 @@ module ArchiveHelper
|
|||
.map { |i| i.identifier.to_s[/\d\d-\d\d/] })
|
||||
.to_a
|
||||
.sort
|
||||
.push(@config[:academic_year])
|
||||
.uniq
|
||||
end
|
||||
|
||||
def academic_years_blog_items
|
||||
|
|
|
@ -46,7 +46,10 @@ module PreprocessHelper
|
|||
|
||||
def create_yearly_items(type)
|
||||
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|
|
||||
@items.create(
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
title: Zeus WPI
|
||||
# If you update this, make sure to create a new directory for blogs and events,
|
||||
# and add an entry to both.
|
||||
academic_year: 18-19
|
||||
academic_year: 19-20
|
||||
# Needed for atom_feed
|
||||
author_name: ''
|
||||
author_uri: ''
|
||||
|
|
Loading…
Reference in a new issue