Preparation for future/past list
This commit is contained in:
parent
71de72db40
commit
b68b3c9a62
2 changed files with 6 additions and 4 deletions
|
|
@ -4,7 +4,8 @@ end
|
||||||
|
|
||||||
def generate_event_pages()
|
def generate_event_pages()
|
||||||
articles = get_events()
|
articles = get_events()
|
||||||
generate_yearly_archive(articles, :startdate, '/events', 'Veranstaltungen des CCC Stuttgart', 'event_archive')
|
generate_yearly_archive(articles, :startdate, '/events', 'Veranstaltungen des CCC Stuttgart',
|
||||||
|
'event_archive', { :comingtitle => 'Kommende Veranstaltungen', :pasttitle => 'Vergangene Veranstaltungen' })
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_activities()
|
def get_activities()
|
||||||
|
|
@ -13,7 +14,8 @@ end
|
||||||
|
|
||||||
def generate_activity_pages()
|
def generate_activity_pages()
|
||||||
articles = get_activities()
|
articles = get_activities()
|
||||||
generate_yearly_archive(articles, :startdate, '/activities', 'Aktionen und Aktivitäten', 'event_archive')
|
generate_yearly_archive(articles, :startdate, '/activities', 'Aktionen und Aktivitäten',
|
||||||
|
'event_archive', { :comingtitle => 'Kommende Aktionen', :pasttitle => 'Vergangene Aktionen' })
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_regulars_tables()
|
def get_regulars_tables()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
require 'ostruct'
|
require 'ostruct'
|
||||||
|
|
||||||
def generate_yearly_archive(articles, date_attribute, basepath, title, templatename = 'article_archive')
|
def generate_yearly_archive(articles, date_attribute, basepath, title, templatename = 'article_archive', attributes = {})
|
||||||
currentyear = Time.now.year
|
currentyear = Time.now.year
|
||||||
yearmap = articles.group_by { |item| item[date_attribute].year }
|
yearmap = articles.group_by { |item| item[date_attribute].year }
|
||||||
if !yearmap.has_key?(currentyear)
|
if !yearmap.has_key?(currentyear)
|
||||||
|
|
@ -22,7 +22,7 @@ def generate_yearly_archive(articles, date_attribute, basepath, title, templaten
|
||||||
end
|
end
|
||||||
@items << Nanoc::Item.new(
|
@items << Nanoc::Item.new(
|
||||||
"<%= render '#{templatename}' #{linkprev} #{linknext} %>",
|
"<%= render '#{templatename}' #{linkprev} #{linknext} %>",
|
||||||
{ :title => "#{title} #{year}", :kind => "page", :archiveitems => yearmap[year] },
|
attributes.merge({ :title => "#{title} #{year}", :kind => "page", :archiveitems => yearmap[year] }),
|
||||||
"#{basepath}/#{year}/")
|
"#{basepath}/#{year}/")
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue